diff --git a/Dockerfile b/Dockerfile
index 011f39929..7f0a37ea5 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -24,4 +24,4 @@ RUN $ANDROID_HOME/tools/bin/sdkmanager "build-tools;${ANDROID_BUILD_TOOLS_VERSIO
ENV PATH ${ANDROID_NDK_HOME}:$PATH
ENV PATH ${ANDROID_NDK_HOME}/prebuilt/linux-x86_64/bin/:$PATH
-CMD mkdir -p /home/source/TMessagesProj/build/outputs/apk && mkdir -p /home/source/TMessagesProj/build/outputs/native-debug-symbols && cp -R /home/source/. /home/gradle && cd /home/gradle && gradle assembleRelease && cp -R /home/gradle/TMessagesProj/build/outputs/apk/. /home/source/TMessagesProj/build/outputs/apk && cp -R /home/gradle/TMessagesProj/build/outputs/native-debug-symbols/. /home/source/TMessagesProj/build/outputs/native-debug-symbols
+CMD mkdir -p /home/source/TMessagesProj/build/outputs/apk && mkdir -p /home/source/TMessagesProj/build/outputs/native-debug-symbols && cp -R /home/source/. /home/gradle && cd /home/gradle && gradle assembleRelease && gradle assembleStandalone && cp -R /home/gradle/TMessagesProj/build/outputs/apk/. /home/source/TMessagesProj/build/outputs/apk && cp -R /home/gradle/TMessagesProj/build/outputs/native-debug-symbols/. /home/source/TMessagesProj/build/outputs/native-debug-symbols
diff --git a/TMessagesProj/build.gradle b/TMessagesProj/build.gradle
index 68e83acd4..cf50a975a 100644
--- a/TMessagesProj/build.gradle
+++ b/TMessagesProj/build.gradle
@@ -143,6 +143,17 @@ android {
ndk.debugSymbolLevel = 'FULL'
}
+ standalone {
+ debuggable false
+ jniDebuggable false
+ signingConfig signingConfigs.release
+ applicationIdSuffix ".web"
+ minifyEnabled true
+ multiDexEnabled true
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+ ndk.debugSymbolLevel = 'FULL'
+ }
+
release {
debuggable false
jniDebuggable false
@@ -167,6 +178,10 @@ android {
manifest.srcFile 'config/debug/AndroidManifest.xml'
}
+ sourceSets.standalone {
+ manifest.srcFile 'config/release/AndroidManifest.xml'
+ }
+
sourceSets.release {
manifest.srcFile 'config/release/AndroidManifest.xml'
}
@@ -243,9 +258,6 @@ android {
sourceSets.debug {
manifest.srcFile 'config/debug/AndroidManifest_SDK23.xml'
}
- /*sourceSets.debugAsan {
- manifest.srcFile 'config/debug/AndroidManifest_SDK23.xml'
- }*/
sourceSets.release {
manifest.srcFile 'config/release/AndroidManifest_SDK23.xml'
}
@@ -276,19 +288,19 @@ android {
sourceSets.debug {
manifest.srcFile 'config/debug/AndroidManifest_SDK23.xml'
}
- /*sourceSets.debugAsan {
- manifest.srcFile 'config/debug/AndroidManifest_SDK23.xml'
- }*/
sourceSets.release {
manifest.srcFile 'config/release/AndroidManifest_SDK23.xml'
}
+ sourceSets.standalone {
+ manifest.srcFile 'config/release/AndroidManifest_standalone.xml'
+ }
ext {
abiVersionCode = 9
}
}
}
- defaultConfig.versionCode = 2274
+ defaultConfig.versionCode = 2284
applicationVariants.all { variant ->
variant.outputs.all { output ->
@@ -307,7 +319,7 @@ android {
defaultConfig {
minSdkVersion 16
targetSdkVersion 29
- versionName "7.6.1"
+ versionName "7.7.0"
vectorDrawables.generatedDensities = ['mdpi', 'hdpi', 'xhdpi', 'xxhdpi']
diff --git a/TMessagesProj/config/release/AndroidManifest_standalone.xml b/TMessagesProj/config/release/AndroidManifest_standalone.xml
new file mode 100644
index 000000000..3c87a4403
--- /dev/null
+++ b/TMessagesProj/config/release/AndroidManifest_standalone.xml
@@ -0,0 +1,67 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/TMessagesProj/google-services.json b/TMessagesProj/google-services.json
index 019c926bc..640e841b2 100755
--- a/TMessagesProj/google-services.json
+++ b/TMessagesProj/google-services.json
@@ -6,35 +6,6 @@
"storage_bucket": "tmessages2.appspot.com"
},
"client": [
- {
- "client_info": {
- "mobilesdk_app_id": "1:760348033671:android:dc022572c167a16c",
- "android_client_info": {
- "package_name": "org.telegram.messenger.beta"
- }
- },
- "oauth_client": [
- {
- "client_id": "760348033671-2hh8ebmuflsnjoc0kldkfells9rhtfni.apps.googleusercontent.com",
- "client_type": 3
- }
- ],
- "api_key": [
- {
- "current_key": "AIzaSyA-t0jLPjUt2FxrA8VPK2EiYHcYcboIR6k"
- }
- ],
- "services": {
- "appinvite_service": {
- "other_platform_oauth_client": [
- {
- "client_id": "760348033671-jiv412evc1r36rl4k7vhl1ba83atdmot.apps.googleusercontent.com",
- "client_type": 3
- }
- ]
- }
- }
- },
{
"client_info": {
"mobilesdk_app_id": "1:760348033671:android:f6afd7b67eae3860",
@@ -57,7 +28,65 @@
"appinvite_service": {
"other_platform_oauth_client": [
{
- "client_id": "760348033671-jiv412evc1r36rl4k7vhl1ba83atdmot.apps.googleusercontent.com",
+ "client_id": "760348033671-2hh8ebmuflsnjoc0kldkfells9rhtfni.apps.googleusercontent.com",
+ "client_type": 3
+ }
+ ]
+ }
+ }
+ },
+ {
+ "client_info": {
+ "mobilesdk_app_id": "1:760348033671:android:dc022572c167a16c",
+ "android_client_info": {
+ "package_name": "org.telegram.messenger.beta"
+ }
+ },
+ "oauth_client": [
+ {
+ "client_id": "760348033671-2hh8ebmuflsnjoc0kldkfells9rhtfni.apps.googleusercontent.com",
+ "client_type": 3
+ }
+ ],
+ "api_key": [
+ {
+ "current_key": "AIzaSyA-t0jLPjUt2FxrA8VPK2EiYHcYcboIR6k"
+ }
+ ],
+ "services": {
+ "appinvite_service": {
+ "other_platform_oauth_client": [
+ {
+ "client_id": "760348033671-2hh8ebmuflsnjoc0kldkfells9rhtfni.apps.googleusercontent.com",
+ "client_type": 3
+ }
+ ]
+ }
+ }
+ },
+ {
+ "client_info": {
+ "mobilesdk_app_id": "1:760348033671:android:7396e651423888c3f66e22",
+ "android_client_info": {
+ "package_name": "org.telegram.messenger.web"
+ }
+ },
+ "oauth_client": [
+ {
+ "client_id": "760348033671-2hh8ebmuflsnjoc0kldkfells9rhtfni.apps.googleusercontent.com",
+ "client_type": 3
+ }
+ ],
+ "api_key": [
+ {
+ "current_key": "AIzaSyA-t0jLPjUt2FxrA8VPK2EiYHcYcboIR6k"
+ }
+ ],
+ "services": {
+ "appinvite_service": {
+ "other_platform_oauth_client": [
+ {
+ "client_id": "760348033671-2hh8ebmuflsnjoc0kldkfells9rhtfni.apps.googleusercontent.com",
"client_type": 3
}
]
@@ -66,4 +95,4 @@
}
],
"configuration_version": "1"
-}
+}
\ No newline at end of file
diff --git a/TMessagesProj/jni/CMakeLists.txt b/TMessagesProj/jni/CMakeLists.txt
index 579b8ec23..d955668c6 100644
--- a/TMessagesProj/jni/CMakeLists.txt
+++ b/TMessagesProj/jni/CMakeLists.txt
@@ -399,7 +399,7 @@ target_compile_definitions(sqlite PUBLIC
#voip
include(${CMAKE_HOME_DIRECTORY}/voip/CMakeLists.txt)
-set(NATIVE_LIB "tmessages.37")
+set(NATIVE_LIB "tmessages.38")
#tmessages
add_library(${NATIVE_LIB} SHARED
diff --git a/TMessagesProj/jni/TgNetWrapper.cpp b/TMessagesProj/jni/TgNetWrapper.cpp
index 84f9bb4cd..aa7c4c933 100644
--- a/TMessagesProj/jni/TgNetWrapper.cpp
+++ b/TMessagesProj/jni/TgNetWrapper.cpp
@@ -371,7 +371,7 @@ void setSystemLangCode(JNIEnv *env, jclass c, jint instanceNum, jstring langCode
}
}
-void init(JNIEnv *env, jclass c, jint instanceNum, jint version, jint layer, jint apiId, jstring deviceModel, jstring systemVersion, jstring appVersion, jstring langCode, jstring systemLangCode, jstring configPath, jstring logPath, jstring regId, jstring cFingerprint, jstring installerId, jint timezoneOffset, jint userId, jboolean enablePushConnection, jboolean hasNetwork, jint networkType) {
+void init(JNIEnv *env, jclass c, jint instanceNum, jint version, jint layer, jint apiId, jstring deviceModel, jstring systemVersion, jstring appVersion, jstring langCode, jstring systemLangCode, jstring configPath, jstring logPath, jstring regId, jstring cFingerprint, jstring installerId, jstring packageId, jint timezoneOffset, jint userId, jboolean enablePushConnection, jboolean hasNetwork, jint networkType) {
const char *deviceModelStr = env->GetStringUTFChars(deviceModel, 0);
const char *systemVersionStr = env->GetStringUTFChars(systemVersion, 0);
const char *appVersionStr = env->GetStringUTFChars(appVersion, 0);
@@ -382,8 +382,9 @@ void init(JNIEnv *env, jclass c, jint instanceNum, jint version, jint layer, jin
const char *regIdStr = env->GetStringUTFChars(regId, 0);
const char *cFingerprintStr = env->GetStringUTFChars(cFingerprint, 0);
const char *installerIdStr = env->GetStringUTFChars(installerId, 0);
+ const char *packageIdStr = env->GetStringUTFChars(packageId, 0);
- ConnectionsManager::getInstance(instanceNum).init((uint32_t) version, layer, apiId, std::string(deviceModelStr), std::string(systemVersionStr), std::string(appVersionStr), std::string(langCodeStr), std::string(systemLangCodeStr), std::string(configPathStr), std::string(logPathStr), std::string(regIdStr), std::string(cFingerprintStr), std::string(installerIdStr), timezoneOffset, userId, true, enablePushConnection, hasNetwork, networkType);
+ ConnectionsManager::getInstance(instanceNum).init((uint32_t) version, layer, apiId, std::string(deviceModelStr), std::string(systemVersionStr), std::string(appVersionStr), std::string(langCodeStr), std::string(systemLangCodeStr), std::string(configPathStr), std::string(logPathStr), std::string(regIdStr), std::string(cFingerprintStr), std::string(installerIdStr), std::string(packageIdStr), timezoneOffset, userId, true, enablePushConnection, hasNetwork, networkType);
if (deviceModelStr != 0) {
env->ReleaseStringUTFChars(deviceModel, deviceModelStr);
@@ -415,6 +416,9 @@ void init(JNIEnv *env, jclass c, jint instanceNum, jint version, jint layer, jin
if (installerIdStr != 0) {
env->ReleaseStringUTFChars(installerId, installerIdStr);
}
+ if (packageIdStr != 0) {
+ env->ReleaseStringUTFChars(packageId, packageIdStr);
+ }
}
void setJava(JNIEnv *env, jclass c, jboolean useJavaByteBuffers) {
@@ -440,7 +444,7 @@ static JNINativeMethod ConnectionsManagerMethods[] = {
{"native_setProxySettings", "(ILjava/lang/String;ILjava/lang/String;Ljava/lang/String;Ljava/lang/String;)V", (void *) setProxySettings},
{"native_getConnectionState", "(I)I", (void *) getConnectionState},
{"native_setUserId", "(II)V", (void *) setUserId},
- {"native_init", "(IIIILjava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;IIZZI)V", (void *) init},
+ {"native_init", "(IIIILjava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;IIZZI)V", (void *) init},
{"native_setLangCode", "(ILjava/lang/String;)V", (void *) setLangCode},
{"native_setRegId", "(ILjava/lang/String;)V", (void *) setRegId},
{"native_setSystemLangCode", "(ILjava/lang/String;)V", (void *) setSystemLangCode},
diff --git a/TMessagesProj/jni/tgnet/ApiScheme.cpp b/TMessagesProj/jni/tgnet/ApiScheme.cpp
index 62c23955a..e638324f9 100644
--- a/TMessagesProj/jni/tgnet/ApiScheme.cpp
+++ b/TMessagesProj/jni/tgnet/ApiScheme.cpp
@@ -1172,7 +1172,7 @@ UserProfilePhoto *UserProfilePhoto::TLdeserialize(NativeByteBuffer *stream, uint
case 0x4f11bae1:
result = new TL_userProfilePhotoEmpty();
break;
- case 0x69d3ab26:
+ case 0xcc656077:
result = new TL_userProfilePhoto();
break;
default:
@@ -1194,6 +1194,9 @@ void TL_userProfilePhoto::readParams(NativeByteBuffer *stream, int32_t instanceN
photo_id = stream->readInt64(&error);
photo_small = std::unique_ptr(FileLocation::TLdeserialize(stream, stream->readUint32(&error), instanceNum, error));
photo_big = std::unique_ptr(FileLocation::TLdeserialize(stream, stream->readUint32(&error), instanceNum, error));
+ if ((flags & 2) != 0) {
+ stripped_thumb = std::unique_ptr(stream->readByteArray(&error));
+ }
dc_id = stream->readInt32(&error);
}
@@ -1204,6 +1207,9 @@ void TL_userProfilePhoto::serializeToStream(NativeByteBuffer *stream) {
stream->writeInt64(photo_id);
photo_small->serializeToStream(stream);
photo_big->serializeToStream(stream);
+ if ((flags & 2) != 0) {
+ stream->writeByteArray(stripped_thumb.get());
+ }
stream->writeInt32(dc_id);
}
diff --git a/TMessagesProj/jni/tgnet/ApiScheme.h b/TMessagesProj/jni/tgnet/ApiScheme.h
index 330579d37..132441805 100644
--- a/TMessagesProj/jni/tgnet/ApiScheme.h
+++ b/TMessagesProj/jni/tgnet/ApiScheme.h
@@ -257,6 +257,7 @@ public:
int64_t photo_id;
std::unique_ptr photo_small;
std::unique_ptr photo_big;
+ std::unique_ptr stripped_thumb;
int32_t dc_id;
static UserProfilePhoto *TLdeserialize(NativeByteBuffer *stream, uint32_t constructor, int32_t instanceNum, bool &error);
@@ -273,7 +274,7 @@ public:
class TL_userProfilePhoto : public UserProfilePhoto {
public:
- static const uint32_t constructor = 0x69d3ab26;
+ static const uint32_t constructor = 0xcc656077;
void readParams(NativeByteBuffer *stream, int32_t instanceNum, bool &error);
void serializeToStream(NativeByteBuffer *stream);
diff --git a/TMessagesProj/jni/tgnet/ConnectionsManager.cpp b/TMessagesProj/jni/tgnet/ConnectionsManager.cpp
index 5a8a92362..518c6d17f 100644
--- a/TMessagesProj/jni/tgnet/ConnectionsManager.cpp
+++ b/TMessagesProj/jni/tgnet/ConnectionsManager.cpp
@@ -2494,6 +2494,7 @@ void ConnectionsManager::processRequestQueue(uint32_t connectionTypes, uint32_t
if (request->rawRequest->initFunc != nullptr) {
request->rawRequest->initFunc(request->messageId);
}
+ if (LOGS_ENABLED) DEBUG_D("messageId for token = %d, 0x%" PRIx64, request->requestToken, request->messageId);
uint32_t requestLength = request->rpcRequest->getObjectSize();
if (request->requestFlags & RequestFlagCanCompress) {
@@ -2593,8 +2594,8 @@ void ConnectionsManager::processRequestQueue(uint32_t connectionTypes, uint32_t
Datacenter *datacenter = getDatacenterWithId(iter->first);
if (datacenter != nullptr) {
bool scannedPreviousRequests = false;
- int64_t lastSentMessageRpcId = 0;
bool needQuickAck = false;
+ int64_t lastSentMessageRpcId = 0;
std::vector> &array = iter->second;
size_t count = array.size();
for (uint32_t b = 0; b < count; b++) {
@@ -2609,13 +2610,18 @@ void ConnectionsManager::processRequestQueue(uint32_t connectionTypes, uint32_t
std::vector currentRequests;
for (uint32_t a = 0; a < count; a++) {
NetworkMessage *currentNetworkMessage = array[a].get();
- TL_message *currentMessage = currentNetworkMessage->message.get();
if (currentNetworkMessage->invokeAfter) {
- currentRequests.push_back(currentMessage->msg_id);
+ currentRequests.push_back(currentNetworkMessage->message->msg_id);
}
}
int64_t maxRequestId = 0;
+ if (lastInvokeAfterMessageId != 0) {
+ int64_t timeMessage = (int64_t) (lastInvokeAfterMessageId / 4294967296.0);
+ if (getCurrentTime() - timeMessage <= 30) {
+ maxRequestId = lastInvokeAfterMessageId;
+ }
+ }
for (requestsIter iter2 = runningRequests.begin(); iter2 != runningRequests.end(); iter2++) {
Request *request = iter2->get();
if (request->requestFlags & RequestFlagInvokeAfter) {
@@ -2634,11 +2640,11 @@ void ConnectionsManager::processRequestQueue(uint32_t connectionTypes, uint32_t
TL_invokeAfterMsg *request = new TL_invokeAfterMsg();
request->msg_id = lastSentMessageRpcId;
if (message->outgoingBody != nullptr) {
- if (LOGS_ENABLED) DEBUG_D("wrap outgoingBody(%p, %s) to TL_invokeAfterMsg", message->outgoingBody, typeid(*message->outgoingBody).name());
+ if (LOGS_ENABLED) DEBUG_D("wrap outgoingBody(%p, %s) to TL_invokeAfterMsg, token = %d, after 0x%" PRIx64, message->outgoingBody, typeid(*message->outgoingBody).name(), networkMessage->requestId, request->msg_id);
request->outgoingQuery = message->outgoingBody;
message->outgoingBody = nullptr;
} else {
- if (LOGS_ENABLED) DEBUG_D("wrap body(%p, %s) to TL_invokeAfterMsg", message->body.get(), typeid(*(message->body.get())).name());
+ if (LOGS_ENABLED) DEBUG_D("wrap body(%p, %s) to TL_invokeAfterMsg, token = %d, after 0x%" PRIx64, message->body.get(), typeid(*(message->body.get())).name(), networkMessage->requestId, request->msg_id);
request->query = std::move(message->body);
}
message->body = std::unique_ptr(request);
@@ -2646,6 +2652,7 @@ void ConnectionsManager::processRequestQueue(uint32_t connectionTypes, uint32_t
}
lastSentMessageRpcId = message->msg_id;
+ lastInvokeAfterMessageId = message->msg_id;
}
}
@@ -2764,6 +2771,13 @@ std::unique_ptr ConnectionsManager::wrapInLayer(TLObject *object, Data
objectValue->key = "installer";
objectValue->value = std::unique_ptr(jsonString);
+ objectValue = new TL_jsonObjectValue();
+ jsonObject->value.push_back(std::unique_ptr(objectValue));
+ jsonString = new TL_jsonString();
+ jsonString->value = package;
+ objectValue->key = "package_id";
+ objectValue->value = std::unique_ptr(jsonString);
+
objectValue = new TL_jsonObjectValue();
jsonObject->value.push_back(std::unique_ptr(objectValue));
@@ -3212,7 +3226,7 @@ void ConnectionsManager::applyDnsConfig(NativeByteBuffer *buffer, std::string ph
});
}
-void ConnectionsManager::init(uint32_t version, int32_t layer, int32_t apiId, std::string deviceModel, std::string systemVersion, std::string appVersion, std::string langCode, std::string systemLangCode, std::string configPath, std::string logPath, std::string regId, std::string cFingerpting, std::string installerId, int32_t timezoneOffset, int32_t userId, bool isPaused, bool enablePushConnection, bool hasNetwork, int32_t networkType) {
+void ConnectionsManager::init(uint32_t version, int32_t layer, int32_t apiId, std::string deviceModel, std::string systemVersion, std::string appVersion, std::string langCode, std::string systemLangCode, std::string configPath, std::string logPath, std::string regId, std::string cFingerpting, std::string installerId, std::string packageId, int32_t timezoneOffset, int32_t userId, bool isPaused, bool enablePushConnection, bool hasNetwork, int32_t networkType) {
currentVersion = version;
currentLayer = layer;
currentApiId = apiId;
@@ -3224,6 +3238,7 @@ void ConnectionsManager::init(uint32_t version, int32_t layer, int32_t apiId, st
currentRegId = regId;
certFingerprint = cFingerpting;
installer = installerId;
+ package = packageId;
currentDeviceTimezone = timezoneOffset;
currentSystemLangCode = systemLangCode;
currentUserId = userId;
diff --git a/TMessagesProj/jni/tgnet/ConnectionsManager.h b/TMessagesProj/jni/tgnet/ConnectionsManager.h
index d44a9d589..740e86830 100644
--- a/TMessagesProj/jni/tgnet/ConnectionsManager.h
+++ b/TMessagesProj/jni/tgnet/ConnectionsManager.h
@@ -63,7 +63,7 @@ public:
void pauseNetwork();
void setNetworkAvailable(bool value, int32_t type, bool slow);
void setIpStrategy(uint8_t value);
- void init(uint32_t version, int32_t layer, int32_t apiId, std::string deviceModel, std::string systemVersion, std::string appVersion, std::string langCode, std::string systemLangCode, std::string configPath, std::string logPath, std::string regId, std::string cFingerprint, std::string installerId, int32_t timezoneOffset, int32_t userId, bool isPaused, bool enablePushConnection, bool hasNetwork, int32_t networkType);
+ void init(uint32_t version, int32_t layer, int32_t apiId, std::string deviceModel, std::string systemVersion, std::string appVersion, std::string langCode, std::string systemLangCode, std::string configPath, std::string logPath, std::string regId, std::string cFingerprint, std::string installerId, std::string packageId, int32_t timezoneOffset, int32_t userId, bool isPaused, bool enablePushConnection, bool hasNetwork, int32_t networkType);
void setProxySettings(std::string address, uint16_t port, std::string username, std::string password, std::string secret);
void setLangCode(std::string langCode);
void setRegId(std::string regId);
@@ -206,6 +206,7 @@ private:
requestsList runningRequests;
std::vector requestingSaltsForDc;
int32_t lastPingId = 0;
+ int64_t lastInvokeAfterMessageId = 0;
int32_t currentNetworkType = NETWORK_TYPE_WIFI;
uint32_t currentVersion = 1;
@@ -218,6 +219,7 @@ private:
std::string currentRegId;
std::string certFingerprint;
std::string installer;
+ std::string package;
int32_t currentDeviceTimezone = 0;
std::string currentSystemLangCode;
std::string currentConfigPath;
diff --git a/TMessagesProj/src/main/AndroidManifest.xml b/TMessagesProj/src/main/AndroidManifest.xml
index f09039892..a25e951b0 100644
--- a/TMessagesProj/src/main/AndroidManifest.xml
+++ b/TMessagesProj/src/main/AndroidManifest.xml
@@ -75,8 +75,6 @@
android:name="org.telegram.messenger.ApplicationLoader"
android:allowBackup="false"
android:hardwareAccelerated="@bool/useHardwareAcceleration"
- android:icon="@mipmap/ic_launcher"
- android:roundIcon="@mipmap/ic_launcher_round"
android:largeHeap="true"
android:theme="@style/Theme.TMessages.Start"
android:manageSpaceActivity="org.telegram.ui.ExternalActionActivity"
diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/AndroidUtilities.java b/TMessagesProj/src/main/java/org/telegram/messenger/AndroidUtilities.java
index d4038df6a..1b80d906b 100644
--- a/TMessagesProj/src/main/java/org/telegram/messenger/AndroidUtilities.java
+++ b/TMessagesProj/src/main/java/org/telegram/messenger/AndroidUtilities.java
@@ -49,6 +49,7 @@ import android.provider.MediaStore;
import android.provider.Settings;
import androidx.core.content.FileProvider;
+import androidx.core.graphics.ColorUtils;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import androidx.viewpager.widget.ViewPager;
@@ -185,6 +186,8 @@ public class AndroidUtilities {
private static Paint roundPaint;
private static RectF bitmapRect;
+ public static final RectF rectTmp = new RectF();
+
public static Pattern WEB_URL = null;
static {
@@ -365,6 +368,22 @@ public class AndroidUtilities {
int end;
}
+ private static Boolean standaloneApp;
+ public static boolean isStandaloneApp() {
+ if (standaloneApp == null) {
+ standaloneApp = "org.telegram.messenger.web".equals(ApplicationLoader.applicationContext.getPackageName());
+ }
+ return standaloneApp;
+ }
+
+ private static Boolean betaApp;
+ public static boolean isBetaApp() {
+ if (betaApp == null) {
+ betaApp = "org.telegram.messenger.beta".equals(ApplicationLoader.applicationContext.getPackageName());
+ }
+ return betaApp;
+ }
+
private static String makeUrl(String url, String[] prefixes, Matcher matcher) {
boolean hasPrefix = false;
for (int i = 0; i < prefixes.length; i++) {
@@ -2477,6 +2496,17 @@ public class AndroidUtilities {
}
}
+ public static String formatFullDuration(int duration) {
+ int h = duration / 3600;
+ int m = duration / 60 % 60;
+ int s = duration % 60;
+ if (duration < 0) {
+ return String.format(Locale.US, "-%02d:%02d:%02d", Math.abs(h), Math.abs(m), Math.abs(s));
+ } else {
+ return String.format(Locale.US, "%02d:%02d:%02d", h, m, s);
+ }
+ }
+
public static String formatDurationNoHours(int duration, boolean isLong) {
int m = duration / 60;
int s = duration % 60;
@@ -3666,10 +3696,9 @@ public class AndroidUtilities {
view.setScaleY(1f);
}
view.setTag(1);
- } else {
+ } else if (!show && view.getTag() != null){
view.animate().setListener(null).cancel();
if (animated) {
- view.animate().alpha(1f).scaleY(1f).scaleX(1f).setDuration(150).start();
view.animate().alpha(0).scaleY(scaleFactor).scaleX(scaleFactor).setListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
@@ -3680,6 +3709,13 @@ public class AndroidUtilities {
view.setVisibility(View.GONE);
}
view.setTag(null);
+ } else if (!animated) {
+ view.animate().setListener(null).cancel();
+ view.setVisibility(show ? View.VISIBLE : View.GONE);
+ view.setTag(show ? 1 : null);
+ view.setAlpha(1f);
+ view.setScaleX(1f);
+ view.setScaleY(1f);
}
}
}
diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/BuildVars.java b/TMessagesProj/src/main/java/org/telegram/messenger/BuildVars.java
index fc2b16a07..e34e8528f 100644
--- a/TMessagesProj/src/main/java/org/telegram/messenger/BuildVars.java
+++ b/TMessagesProj/src/main/java/org/telegram/messenger/BuildVars.java
@@ -18,8 +18,8 @@ public class BuildVars {
public static boolean LOGS_ENABLED = false;
public static boolean USE_CLOUD_STRINGS = true;
public static boolean CHECK_UPDATES = true;
- public static int BUILD_VERSION = 2274;
- public static String BUILD_VERSION_STRING = "7.6.0";
+ public static int BUILD_VERSION = 2284;
+ public static String BUILD_VERSION_STRING = "7.7.0";
public static int APP_ID = 4;
public static String APP_HASH = "014b35b6184100b085b0d0572f9b5103";
public static String APPCENTER_HASH = "a5b5c4f5-51da-dedc-9918-d9766a22ca7c";
diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/ChatObject.java b/TMessagesProj/src/main/java/org/telegram/messenger/ChatObject.java
index 43512c885..571a75a6d 100644
--- a/TMessagesProj/src/main/java/org/telegram/messenger/ChatObject.java
+++ b/TMessagesProj/src/main/java/org/telegram/messenger/ChatObject.java
@@ -100,7 +100,7 @@ public class ChatObject {
loadMembers(true);
}
- public void addSelfDummyParticipant() {
+ public void addSelfDummyParticipant(boolean notify) {
int selfId = getSelfId();
if (participants.indexOfKey(selfId) >= 0) {
return;
@@ -109,16 +109,29 @@ public class ChatObject {
selfDummyParticipant.peer = selfPeer;
selfDummyParticipant.muted = true;
selfDummyParticipant.self = true;
- selfDummyParticipant.can_self_unmute = !call.join_muted;
- selfDummyParticipant.date = currentAccount.getConnectionsManager().getCurrentTime();
TLRPC.Chat chat = currentAccount.getMessagesController().getChat(chatId);
+ selfDummyParticipant.can_self_unmute = !call.join_muted || ChatObject.canManageCalls(chat);
+ selfDummyParticipant.date = currentAccount.getConnectionsManager().getCurrentTime();
if (ChatObject.canManageCalls(chat) || !ChatObject.isChannel(chat) || chat.megagroup || selfDummyParticipant.can_self_unmute) {
selfDummyParticipant.active_date = currentAccount.getConnectionsManager().getCurrentTime();
}
+ if (selfId > 0) {
+ TLRPC.UserFull userFull = MessagesController.getInstance(currentAccount.getCurrentAccount()).getUserFull(selfId);
+ if (userFull != null) {
+ selfDummyParticipant.about = userFull.about;
+ }
+ } else {
+ TLRPC.ChatFull chatFull = MessagesController.getInstance(currentAccount.getCurrentAccount()).getChatFull(-selfId);
+ if (chatFull != null) {
+ selfDummyParticipant.about = chatFull.about;
+ }
+ }
participants.put(selfId, selfDummyParticipant);
sortedParticipants.add(selfDummyParticipant);
sortParticipants();
- currentAccount.getNotificationCenter().postNotificationName(NotificationCenter.groupCallUpdated, chatId, call.id, false);
+ if (notify) {
+ currentAccount.getNotificationCenter().postNotificationName(NotificationCenter.groupCallUpdated, chatId, call.id, false);
+ }
}
public void migrateToChat(TLRPC.Chat chat) {
@@ -129,6 +142,14 @@ public class ChatObject {
}
}
+ public boolean shouldShowPanel() {
+ return call.participants_count > 0 || isScheduled();
+ }
+
+ public boolean isScheduled() {
+ return (call.flags & 128) != 0;
+ }
+
private int getSelfId() {
int selfId;
if (selfPeer != null) {
diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/DownloadController.java b/TMessagesProj/src/main/java/org/telegram/messenger/DownloadController.java
index 56dc589c4..dbbf415c7 100644
--- a/TMessagesProj/src/main/java/org/telegram/messenger/DownloadController.java
+++ b/TMessagesProj/src/main/java/org/telegram/messenger/DownloadController.java
@@ -400,7 +400,7 @@ public class DownloadController extends BaseController implements NotificationCe
if (type == AUTODOWNLOAD_TYPE_PHOTO) {
return PRESET_SIZE_NUM_PHOTO;
} else if (type == AUTODOWNLOAD_TYPE_AUDIO) {
- return PRESET_SIZE_NUM_AUDIO;
+ return PRESET_SIZE_NUM_DOCUMENT;
} else if (type == AUTODOWNLOAD_TYPE_VIDEO) {
return PRESET_SIZE_NUM_VIDEO;
} else if (type == AUTODOWNLOAD_TYPE_DOCUMENT) {
@@ -663,7 +663,12 @@ public class DownloadController extends BaseController implements NotificationCe
preset = getCurrentMobilePreset();
}
int mask = preset.mask[index];
- int maxSize = preset.sizes[typeToIndex(type)];
+ int maxSize;
+ if (type == AUTODOWNLOAD_TYPE_AUDIO) {
+ maxSize = Math.max(512 * 1024, preset.sizes[typeToIndex(type)]);
+ } else {
+ maxSize = preset.sizes[typeToIndex(type)];
+ }
int size = MessageObject.getMessageSize(message);
if (isVideo && preset.preloadVideo && size > maxSize && maxSize > 2 * 1024 * 1024) {
return (mask & type) != 0 ? 2 : 0;
diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/FileLoadOperation.java b/TMessagesProj/src/main/java/org/telegram/messenger/FileLoadOperation.java
index 47696f882..62edaffb8 100644
--- a/TMessagesProj/src/main/java/org/telegram/messenger/FileLoadOperation.java
+++ b/TMessagesProj/src/main/java/org/telegram/messenger/FileLoadOperation.java
@@ -196,7 +196,7 @@ public class FileLoadOperation {
location.id = imageLocation.location.volume_id;
location.volume_id = imageLocation.location.volume_id;
location.local_id = imageLocation.location.local_id;
- location.big = imageLocation.photoPeerBig;
+ location.big = imageLocation.photoPeerType == ImageLocation.TYPE_BIG;
location.peer = imageLocation.photoPeer;
} else if (imageLocation.stickerSet != null) {
location = new TLRPC.TL_inputStickerSetThumb();
diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/ImageLocation.java b/TMessagesProj/src/main/java/org/telegram/messenger/ImageLocation.java
index 2b42979fc..e89e5593c 100644
--- a/TMessagesProj/src/main/java/org/telegram/messenger/ImageLocation.java
+++ b/TMessagesProj/src/main/java/org/telegram/messenger/ImageLocation.java
@@ -23,7 +23,7 @@ public class ImageLocation {
public TLRPC.PhotoSize photoSize;
public TLRPC.Photo photo;
- public boolean photoPeerBig;
+ public int photoPeerType;
public TLRPC.InputPeer photoPeer;
public TLRPC.InputStickerSet stickerSet;
public int imageType;
@@ -99,14 +99,37 @@ public class ImageLocation {
} else {
dc_id = photoSize.location.dc_id;
}
- return getForPhoto(photoSize.location, photoSize.size, photo, null, null, false, dc_id, null, photoSize.type);
+ return getForPhoto(photoSize.location, photoSize.size, photo, null, null, TYPE_SMALL, dc_id, null, photoSize.type);
}
- public static ImageLocation getForUser(TLRPC.User user, boolean big) {
+ public static final int TYPE_BIG = 0;
+ public static final int TYPE_SMALL = 1;
+ public static final int TYPE_STRIPPED = 2;
+
+ public static ImageLocation getForUserOrChat(TLObject object, int type) {
+ if (object instanceof TLRPC.User) {
+ return getForUser((TLRPC.User) object, type);
+ } else if (object instanceof TLRPC.Chat) {
+ return getForChat((TLRPC.Chat) object, type);
+ }
+ return null;
+ }
+
+ public static ImageLocation getForUser(TLRPC.User user, int type) {
if (user == null || user.access_hash == 0 || user.photo == null) {
return null;
}
- TLRPC.FileLocation fileLocation = big ? user.photo.photo_big : user.photo.photo_small;
+ if (type == TYPE_STRIPPED) {
+ if (user.photo.stripped_thumb == null) {
+ return null;
+ }
+ ImageLocation imageLocation = new ImageLocation();
+ imageLocation.photoSize = new TLRPC.TL_photoStrippedSize();
+ imageLocation.photoSize.type = "s";
+ imageLocation.photoSize.bytes = user.photo.stripped_thumb;
+ return imageLocation;
+ }
+ TLRPC.FileLocation fileLocation = type == TYPE_BIG ? user.photo.photo_big : user.photo.photo_small;
if (fileLocation == null) {
return null;
}
@@ -119,14 +142,24 @@ public class ImageLocation {
} else {
dc_id = fileLocation.dc_id;
}
- return getForPhoto(fileLocation, 0, null, null, inputPeer, big, dc_id, null, null);
+ return getForPhoto(fileLocation, 0, null, null, inputPeer, type, dc_id, null, null);
}
- public static ImageLocation getForChat(TLRPC.Chat chat, boolean big) {
+ public static ImageLocation getForChat(TLRPC.Chat chat, int type) {
if (chat == null || chat.photo == null) {
return null;
}
- TLRPC.FileLocation fileLocation = big ? chat.photo.photo_big : chat.photo.photo_small;
+ if (type == TYPE_STRIPPED) {
+ if (chat.photo.stripped_thumb == null) {
+ return null;
+ }
+ ImageLocation imageLocation = new ImageLocation();
+ imageLocation.photoSize = new TLRPC.TL_photoStrippedSize();
+ imageLocation.photoSize.type = "s";
+ imageLocation.photoSize.bytes = chat.photo.stripped_thumb;
+ return imageLocation;
+ }
+ TLRPC.FileLocation fileLocation = type == TYPE_BIG ? chat.photo.photo_big : chat.photo.photo_small;
if (fileLocation == null) {
return null;
}
@@ -148,7 +181,7 @@ public class ImageLocation {
} else {
dc_id = fileLocation.dc_id;
}
- return getForPhoto(fileLocation, 0, null, null, inputPeer, big, dc_id, null, null);
+ return getForPhoto(fileLocation, 0, null, null, inputPeer, type, dc_id, null, null);
}
public static ImageLocation getForSticker(TLRPC.PhotoSize photoSize, TLRPC.Document sticker) {
@@ -163,7 +196,7 @@ public class ImageLocation {
if (stickerSet == null) {
return null;
}
- ImageLocation imageLocation = getForPhoto(photoSize.location, photoSize.size, null, null, null, false, sticker.dc_id, stickerSet, photoSize.type);
+ ImageLocation imageLocation = getForPhoto(photoSize.location, photoSize.size, null, null, null, TYPE_SMALL, sticker.dc_id, stickerSet, photoSize.type);
if (MessageObject.isAnimatedStickerDocument(sticker, true)) {
imageLocation.imageType = FileLoader.IMAGE_TYPE_LOTTIE;
}
@@ -174,7 +207,7 @@ public class ImageLocation {
if (videoSize == null || document == null) {
return null;
}
- ImageLocation location = getForPhoto(videoSize.location, videoSize.size, null, document, null, false, document.dc_id, null, videoSize.type);
+ ImageLocation location = getForPhoto(videoSize.location, videoSize.size, null, document, null, TYPE_SMALL, document.dc_id, null, videoSize.type);
location.imageType = FileLoader.IMAGE_TYPE_ANIMATION;
return location;
}
@@ -183,7 +216,7 @@ public class ImageLocation {
if (videoSize == null || photo == null) {
return null;
}
- ImageLocation location = getForPhoto(videoSize.location, videoSize.size, photo, null, null, false, photo.dc_id, null, videoSize.type);
+ ImageLocation location = getForPhoto(videoSize.location, videoSize.size, photo, null, null, TYPE_SMALL, photo.dc_id, null, videoSize.type);
location.imageType = FileLoader.IMAGE_TYPE_ANIMATION;
if ((videoSize.flags & 1) != 0) {
location.videoSeekTo = (int) (videoSize.video_start_ts * 1000);
@@ -199,7 +232,7 @@ public class ImageLocation {
} else if (photoSize == null || document == null) {
return null;
}
- return getForPhoto(photoSize.location, photoSize.size, null, document, null, false, document.dc_id, null, photoSize.type);
+ return getForPhoto(photoSize.location, photoSize.size, null, document, null, TYPE_SMALL, document.dc_id, null, photoSize.type);
}
public static ImageLocation getForLocal(TLRPC.FileLocation location) {
@@ -215,7 +248,7 @@ public class ImageLocation {
return imageLocation;
}
- private static ImageLocation getForPhoto(TLRPC.FileLocation location, int size, TLRPC.Photo photo, TLRPC.Document document, TLRPC.InputPeer photoPeer, boolean photoPeerBig, int dc_id, TLRPC.InputStickerSet stickerSet, String thumbSize) {
+ private static ImageLocation getForPhoto(TLRPC.FileLocation location, int size, TLRPC.Photo photo, TLRPC.Document document, TLRPC.InputPeer photoPeer, int photoPeerType, int dc_id, TLRPC.InputStickerSet stickerSet, String thumbSize) {
if (location == null || photo == null && photoPeer == null && stickerSet == null && document == null) {
return null;
}
@@ -224,7 +257,7 @@ public class ImageLocation {
imageLocation.photo = photo;
imageLocation.currentSize = size;
imageLocation.photoPeer = photoPeer;
- imageLocation.photoPeerBig = photoPeerBig;
+ imageLocation.photoPeerType = photoPeerType;
imageLocation.stickerSet = stickerSet;
if (location instanceof TLRPC.TL_fileLocationToBeDeprecated) {
imageLocation.location = (TLRPC.TL_fileLocationToBeDeprecated) location;
diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/ImageReceiver.java b/TMessagesProj/src/main/java/org/telegram/messenger/ImageReceiver.java
index c5ce9f6db..bee51b37f 100644
--- a/TMessagesProj/src/main/java/org/telegram/messenger/ImageReceiver.java
+++ b/TMessagesProj/src/main/java/org/telegram/messenger/ImageReceiver.java
@@ -313,6 +313,10 @@ public class ImageReceiver implements NotificationCenter.NotificationCenterDeleg
setImage(imageLocation, imageFilter, thumbLocation, thumbFilter, null, size, ext, parentObject, cacheType);
}
+ public void setImage(ImageLocation fileLocation, String fileFilter, ImageLocation thumbLocation, String thumbFilter, Drawable thumb, Object parentObject, int cacheType) {
+ setImage(null, null, fileLocation, fileFilter, thumbLocation, thumbFilter, thumb, 0, null, parentObject, cacheType);
+ }
+
public void setImage(ImageLocation fileLocation, String fileFilter, ImageLocation thumbLocation, String thumbFilter, Drawable thumb, int size, String ext, Object parentObject, int cacheType) {
setImage(null, null, fileLocation, fileFilter, thumbLocation, thumbFilter, thumb, size, ext, parentObject, cacheType);
}
diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/LocaleController.java b/TMessagesProj/src/main/java/org/telegram/messenger/LocaleController.java
index 3add96e88..c59af7456 100644
--- a/TMessagesProj/src/main/java/org/telegram/messenger/LocaleController.java
+++ b/TMessagesProj/src/main/java/org/telegram/messenger/LocaleController.java
@@ -65,7 +65,7 @@ public class LocaleController {
public FastDateFormat formatterScheduleDay;
public FastDateFormat formatterScheduleYear;
public FastDateFormat formatterMonthYear;
- public FastDateFormat[] formatterScheduleSend = new FastDateFormat[6];
+ public FastDateFormat[] formatterScheduleSend = new FastDateFormat[15];
private HashMap allRules = new HashMap<>();
@@ -1087,7 +1087,53 @@ public class LocaleController {
}
}
+ private static char[] defaultNumbers = new char[]{'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'};
+ private static char[][] otherNumbers = new char[][]{
+ {'٠', '١', '٢', '٣', '٤', '٥', '٦', '٧', '٨', '٩'},
+ {'۰', '۱', '۲', '۳', '۴', '۵', '۶', '۷', '۸', '۹'},
+ {'०', '१', '२', '३', '४', '५', '६', '७', '८', '९'},
+ {'૦', '૧', '૨', '૩', '૪', '૫', '૬', '૭', '૮', '૯'},
+ {'੦', '੧', '੨', '੩', '੪', '੫', '੬', '੭', '੮', '੯'},
+ {'০', '১', '২', '৩', '৪', '৫', '৬', '৭', '৮', '৯'},
+ {'೦', '೧', '೨', '೩', '೪', '೫', '೬', '೭', '೮', '೯'},
+ {'୦', '୧', '୨', '୩', '୪', '୫', '୬', '୭', '୮', '୯'},
+ {'൦', '൧', '൨', '൩', '൪', '൫', '൬', '൭', '൮', '൯'},
+ {'௦', '௧', '௨', '௩', '௪', '௫', '௬', '௭', '௮', '௯'},
+ {'౦', '౧', '౨', '౩', '౪', '౫', '౬', '౭', '౮', '౯'},
+ {'၀', '၁', '၂', '၃', '၄', '၅', '၆', '၇', '၈', '၉'},
+ {'༠', '༡', '༢', '༣', '༤', '༥', '༦', '༧', '༨', '༩'},
+ {'᠐', '᠑', '᠒', '᠓', '᠔', '᠕', '᠖', '᠗', '᠘', '᠙'},
+ {'០', '១', '២', '៣', '៤', '៥', '៦', '៧', '៨', '៩'},
+ {'๐', '๑', '๒', '๓', '๔', '๕', '๖', '๗', '๘', '๙'},
+ {'໐', '໑', '໒', '໓', '໔', '໕', '໖', '໗', '໘', '໙'},
+ {'꧐', '꧑', '꧒', '꧓', '꧔', '꧕', '꧖', '꧗', '꧘', '꧙'}
+ };
+
+ public static String fixNumbers(CharSequence numbers) {
+ StringBuilder builder = new StringBuilder(numbers);
+ for (int c = 0, N = builder.length(); c < N; c++) {
+ char ch = builder.charAt(c);
+ if (ch >= '0' && ch <= '9' || ch == '.' || ch == ',') {
+ continue;
+ }
+ for (int a = 0; a < otherNumbers.length; a++) {
+ for (int b = 0; b < otherNumbers[a].length; b++) {
+ if (ch == otherNumbers[a][b]) {
+ builder.setCharAt(c, defaultNumbers[b]);
+ a = otherNumbers.length;
+ break;
+ }
+ }
+ }
+ }
+ return builder.toString();
+ }
+
public String formatCurrencyString(long amount, String type) {
+ return formatCurrencyString(amount, true, type);
+ }
+
+ public String formatCurrencyString(long amount, boolean fixAnything, String type) {
type = type.toUpperCase();
String customFormat;
double doubleAmount;
@@ -1102,7 +1148,7 @@ public class LocaleController {
case "IRR":
doubleAmount = amount / 100.0f;
- if (amount % 100 == 0) {
+ if (fixAnything && amount % 100 == 0) {
customFormat = " %.0f";
} else {
customFormat = " %.2f";
@@ -1158,7 +1204,7 @@ public class LocaleController {
if (currency != null) {
NumberFormat format = NumberFormat.getCurrencyInstance(currentLocale != null ? currentLocale : systemDefaultLocale);
format.setCurrency(currency);
- if (type.equals("IRR")) {
+ if (fixAnything && type.equals("IRR")) {
format.setMaximumFractionDigits(0);
}
return (discount ? "-" : "") + format.format(doubleAmount);
@@ -1166,6 +1212,46 @@ public class LocaleController {
return (discount ? "-" : "") + String.format(Locale.US, type + customFormat, doubleAmount);
}
+ public static int getCurrencyExpDivider(String type) {
+ switch (type) {
+ case "CLF":
+ return 10000;
+ case "BHD":
+ case "IQD":
+ case "JOD":
+ case "KWD":
+ case "LYD":
+ case "OMR":
+ case "TND":
+ return 1000;
+ case "BIF":
+ case "BYR":
+ case "CLP":
+ case "CVE":
+ case "DJF":
+ case "GNF":
+ case "ISK":
+ case "JPY":
+ case "KMF":
+ case "KRW":
+ case "MGA":
+ case "PYG":
+ case "RWF":
+ case "UGX":
+ case "UYI":
+ case "VND":
+ case "VUV":
+ case "XAF":
+ case "XOF":
+ case "XPF":
+ return 1;
+ case "MRO":
+ return 10;
+ default:
+ return 100;
+ }
+ }
+
public String formatCurrencyDecimalString(long amount, String type, boolean inludeType) {
type = type.toUpperCase();
String customFormat;
@@ -1559,12 +1645,57 @@ public class LocaleController {
formatterScheduleSend[3] = createFormatter(locale, getStringInternal("RemindTodayAt", R.string.RemindTodayAt), "'Remind today at' HH:mm");
formatterScheduleSend[4] = createFormatter(locale, getStringInternal("RemindDayAt", R.string.RemindDayAt), "'Remind on' MMM d 'at' HH:mm");
formatterScheduleSend[5] = createFormatter(locale, getStringInternal("RemindDayYearAt", R.string.RemindDayYearAt), "'Remind on' MMM d yyyy 'at' HH:mm");
+ formatterScheduleSend[6] = createFormatter(locale, getStringInternal("StartTodayAt", R.string.StartTodayAt), "'Start today at' HH:mm");
+ formatterScheduleSend[7] = createFormatter(locale, getStringInternal("StartDayAt", R.string.StartDayAt), "'Start on' MMM d 'at' HH:mm");
+ formatterScheduleSend[8] = createFormatter(locale, getStringInternal("StartDayYearAt", R.string.StartDayYearAt), "'Start on' MMM d yyyy 'at' HH:mm");
+ formatterScheduleSend[9] = createFormatter(locale, getStringInternal("StartShortTodayAt", R.string.StartShortTodayAt), "'Today,' HH:mm");
+ formatterScheduleSend[10] = createFormatter(locale, getStringInternal("StartShortDayAt", R.string.StartShortDayAt), "MMM d',' HH:mm");
+ formatterScheduleSend[11] = createFormatter(locale, getStringInternal("StartShortDayYearAt", R.string.StartShortDayYearAt), "MMM d yyyy, HH:mm");
+ formatterScheduleSend[12] = createFormatter(locale, getStringInternal("StartsTodayAt", R.string.StartsTodayAt), "'Starts today at' HH:mm");
+ formatterScheduleSend[13] = createFormatter(locale, getStringInternal("StartsDayAt", R.string.StartsDayAt), "'Starts on' MMM d 'at' HH:mm");
+ formatterScheduleSend[14] = createFormatter(locale, getStringInternal("StartsDayYearAt", R.string.StartsDayYearAt), "'Starts on' MMM d yyyy 'at' HH:mm");
}
public static boolean isRTLCharacter(char ch) {
return Character.getDirectionality(ch) == Character.DIRECTIONALITY_RIGHT_TO_LEFT || Character.getDirectionality(ch) == Character.DIRECTIONALITY_RIGHT_TO_LEFT_ARABIC || Character.getDirectionality(ch) == Character.DIRECTIONALITY_RIGHT_TO_LEFT_EMBEDDING || Character.getDirectionality(ch) == Character.DIRECTIONALITY_RIGHT_TO_LEFT_OVERRIDE;
}
+ public static String formatStartsTime(long date, int type) {
+ return formatStartsTime(date, type, true);
+ }
+
+ public static String formatStartsTime(long date, int type, boolean needToday) {
+ Calendar calendar = Calendar.getInstance();
+ calendar.setTimeInMillis(System.currentTimeMillis());
+ int currentYear = calendar.get(Calendar.YEAR);
+ int currentDay = calendar.get(Calendar.DAY_OF_YEAR);
+
+ calendar.setTimeInMillis(date * 1000);
+ int selectedYear = calendar.get(Calendar.YEAR);
+ int selectedDay = calendar.get(Calendar.DAY_OF_YEAR);
+
+ int num;
+ if (currentYear == selectedYear) {
+ if (needToday && selectedDay == currentDay) {
+ num = 0;
+ } else {
+ num = 1;
+ }
+ } else {
+ num = 2;
+ }
+ if (type == 1) {
+ num += 3;
+ } else if (type == 2) {
+ num += 6;
+ } else if (type == 3) {
+ num += 9;
+ } else if (type == 4) {
+ num += 12;
+ }
+ return LocaleController.getInstance().formatterScheduleSend[num].format(calendar.getTimeInMillis());
+ }
+
public static String formatSectionDate(long date) {
try {
date *= 1000;
diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/MediaController.java b/TMessagesProj/src/main/java/org/telegram/messenger/MediaController.java
index acd7aa99c..b7ebe4032 100644
--- a/TMessagesProj/src/main/java/org/telegram/messenger/MediaController.java
+++ b/TMessagesProj/src/main/java/org/telegram/messenger/MediaController.java
@@ -883,7 +883,7 @@ public class MediaController implements AudioManager.OnAudioFocusChangeListener,
}
proximitySensor = sensorManager.getDefaultSensor(Sensor.TYPE_PROXIMITY);
PowerManager powerManager = (PowerManager) ApplicationLoader.applicationContext.getSystemService(Context.POWER_SERVICE);
- proximityWakeLock = powerManager.newWakeLock(0x00000020, "proximity");
+ proximityWakeLock = powerManager.newWakeLock(0x00000020, "telegram:proximity_lock");
} catch (Exception e) {
FileLog.e(e);
}
diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/MediaDataController.java b/TMessagesProj/src/main/java/org/telegram/messenger/MediaDataController.java
index 4dfe444a5..f164f841e 100644
--- a/TMessagesProj/src/main/java/org/telegram/messenger/MediaDataController.java
+++ b/TMessagesProj/src/main/java/org/telegram/messenger/MediaDataController.java
@@ -144,6 +144,8 @@ public class MediaDataController extends BaseController {
public static final int TYPE_FEATURED = 3;
public static final int TYPE_EMOJI = 4;
+ public static final int TYPE_GREETINGS = 3;
+
private ArrayList[] stickerSets = new ArrayList[]{new ArrayList<>(), new ArrayList<>(), new ArrayList<>(0), new ArrayList<>(), new ArrayList<>()};
private LongSparseArray[] stickersByIds = new LongSparseArray[]{new LongSparseArray<>(), new LongSparseArray<>(), new LongSparseArray<>(), new LongSparseArray<>(), new LongSparseArray<>()};
private LongSparseArray stickerSetsById = new LongSparseArray<>();
@@ -168,9 +170,9 @@ public class MediaDataController extends BaseController {
private HashMap> allStickers = new HashMap<>();
private HashMap> allStickersFeatured = new HashMap<>();
- private ArrayList[] recentStickers = new ArrayList[]{new ArrayList<>(), new ArrayList<>(), new ArrayList<>()};
- private boolean[] loadingRecentStickers = new boolean[3];
- private boolean[] recentStickersLoaded = new boolean[3];
+ private ArrayList[] recentStickers = new ArrayList[]{new ArrayList<>(), new ArrayList<>(), new ArrayList<>(), new ArrayList<>()};
+ private boolean[] loadingRecentStickers = new boolean[4];
+ private boolean[] recentStickersLoaded = new boolean[4];
private ArrayList recentGifs = new ArrayList<>();
private boolean loadingRecentGifs;
@@ -185,8 +187,10 @@ public class MediaDataController extends BaseController {
private boolean loadingFeaturedStickers;
private boolean featuredStickersLoaded;
+ private TLRPC.Document greetingsSticker;
+
public void cleanup() {
- for (int a = 0; a < 3; a++) {
+ for (int a = 0; a < recentStickers.length; a++) {
recentStickers[a].clear();
loadingRecentStickers[a] = false;
recentStickersLoaded[a] = false;
@@ -283,7 +287,7 @@ public class MediaDataController extends BaseController {
}
public void addRecentSticker(final int type, Object parentObject, TLRPC.Document document, int date, boolean remove) {
- if (!MessageObject.isStickerDocument(document) && !MessageObject.isAnimatedStickerDocument(document, true)) {
+ if (type == TYPE_GREETINGS || !MessageObject.isStickerDocument(document) && !MessageObject.isAnimatedStickerDocument(document, true)) {
return;
}
boolean found = false;
@@ -749,6 +753,8 @@ public class MediaDataController extends BaseController {
cacheType = 3;
} else if (type == TYPE_MASK) {
cacheType = 4;
+ } else if (type == TYPE_GREETINGS) {
+ cacheType = 6;
} else {
cacheType = 5;
}
@@ -777,6 +783,9 @@ public class MediaDataController extends BaseController {
loadingRecentStickers[type] = false;
recentStickersLoaded[type] = true;
}
+ if (type == TYPE_GREETINGS) {
+ preloadNextGreetingsSticker();
+ }
getNotificationCenter().postNotificationName(NotificationCenter.recentDocumentsDidLoad, gif, type);
loadRecents(type, gif, false, false);
});
@@ -794,6 +803,8 @@ public class MediaDataController extends BaseController {
lastLoadTime = preferences.getLong("lastStickersLoadTime", 0);
} else if (type == TYPE_MASK) {
lastLoadTime = preferences.getLong("lastStickersLoadTimeMask", 0);
+ } else if (type == TYPE_GREETINGS) {
+ lastLoadTime = preferences.getLong("lastStickersLoadTimeGreet", 0);
} else {
lastLoadTime = preferences.getLong("lastStickersLoadTimeFavs", 0);
}
@@ -823,6 +834,11 @@ public class MediaDataController extends BaseController {
TLRPC.TL_messages_getFavedStickers req = new TLRPC.TL_messages_getFavedStickers();
req.hash = calcDocumentsHash(recentStickers[type]);
request = req;
+ } else if (type == TYPE_GREETINGS) {
+ TLRPC.TL_messages_getStickers req = new TLRPC.TL_messages_getStickers();
+ req.emoticon = "\uD83D\uDC4B" + Emoji.fixEmoji("⭐");
+ req.hash = calcDocumentsHash(recentStickers[type]);
+ request = req;
} else {
TLRPC.TL_messages_getRecentStickers req = new TLRPC.TL_messages_getRecentStickers();
req.hash = calcDocumentsHash(recentStickers[type]);
@@ -831,7 +847,12 @@ public class MediaDataController extends BaseController {
}
getConnectionsManager().sendRequest(request, (response, error) -> {
ArrayList arrayList = null;
- if (type == TYPE_FAVE) {
+ if (type == TYPE_GREETINGS) {
+ if (response instanceof TLRPC.TL_messages_stickers) {
+ TLRPC.TL_messages_stickers res = (TLRPC.TL_messages_stickers) response;
+ arrayList = res.stickers;
+ }
+ } else if (type == TYPE_FAVE) {
if (response instanceof TLRPC.TL_messages_favedStickers) {
TLRPC.TL_messages_favedStickers res = (TLRPC.TL_messages_favedStickers) response;
arrayList = res.stickers;
@@ -842,12 +863,26 @@ public class MediaDataController extends BaseController {
arrayList = res.stickers;
}
}
- processLoadedRecentDocuments(type, arrayList, gif, 0, true);
+ processLoadedRecentDocuments(type, arrayList, false, 0, true);
});
}
}
}
+ private void preloadNextGreetingsSticker() {
+ if (recentStickers[TYPE_GREETINGS].isEmpty()) {
+ return;
+ }
+ greetingsSticker = recentStickers[TYPE_GREETINGS].get(Utilities.random.nextInt(recentStickers[TYPE_GREETINGS].size()));
+ getFileLoader().loadFile(ImageLocation.getForDocument(greetingsSticker), greetingsSticker, null, 0, 1);
+ }
+
+ public TLRPC.Document getGreetingsSticker() {
+ TLRPC.Document result = greetingsSticker;
+ preloadNextGreetingsSticker();
+ return result;
+ }
+
protected void processLoadedRecentDocuments(final int type, final ArrayList documents, final boolean gif, final int date, boolean replace) {
if (documents != null) {
getMessagesStorage().getStorageQueue().postRunnable(() -> {
@@ -857,7 +892,9 @@ public class MediaDataController extends BaseController {
if (gif) {
maxCount = getMessagesController().maxRecentGifsCount;
} else {
- if (type == TYPE_FAVE) {
+ if (type == TYPE_GREETINGS) {
+ maxCount = 200;
+ } else if (type == TYPE_FAVE) {
maxCount = getMessagesController().maxFaveStickersCount;
} else {
maxCount = getMessagesController().maxRecentStickersCount;
@@ -874,6 +911,8 @@ public class MediaDataController extends BaseController {
cacheType = 3;
} else if (type == TYPE_MASK) {
cacheType = 4;
+ } else if (type == TYPE_GREETINGS) {
+ cacheType = 6;
} else {
cacheType = 5;
}
@@ -899,9 +938,7 @@ public class MediaDataController extends BaseController {
document.serializeToStream(data);
state.bindByteBuffer(10, data);
state.step();
- if (data != null) {
- data.reuse();
- }
+ data.reuse();
}
state.dispose();
database.commitTransaction();
@@ -931,6 +968,8 @@ public class MediaDataController extends BaseController {
editor.putLong("lastStickersLoadTime", System.currentTimeMillis()).commit();
} else if (type == TYPE_MASK) {
editor.putLong("lastStickersLoadTimeMask", System.currentTimeMillis()).commit();
+ } else if (type == TYPE_GREETINGS) {
+ editor.putLong("lastStickersLoadTimeGreet", System.currentTimeMillis()).commit();
} else {
editor.putLong("lastStickersLoadTimeFavs", System.currentTimeMillis()).commit();
}
@@ -941,6 +980,9 @@ public class MediaDataController extends BaseController {
} else {
recentStickers[type] = documents;
}
+ if (type == TYPE_GREETINGS) {
+ preloadNextGreetingsSticker();
+ }
getNotificationCenter().postNotificationName(NotificationCenter.recentDocumentsDidLoad, gif, type);
} else {
diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/MessageObject.java b/TMessagesProj/src/main/java/org/telegram/messenger/MessageObject.java
index 5dcce812e..65cd9ca53 100644
--- a/TMessagesProj/src/main/java/org/telegram/messenger/MessageObject.java
+++ b/TMessagesProj/src/main/java/org/telegram/messenger/MessageObject.java
@@ -2424,7 +2424,10 @@ public class MessageObject {
if (messageOwner instanceof TLRPC.TL_messageService) {
if (messageOwner.action != null) {
- if (messageOwner.action instanceof TLRPC.TL_messageActionGroupCall) {
+ if (messageOwner.action instanceof TLRPC.TL_messageActionGroupCallScheduled) {
+ TLRPC.TL_messageActionGroupCallScheduled action = (TLRPC.TL_messageActionGroupCallScheduled) messageOwner.action;
+ messageText = LocaleController.formatString("ActionGroupCallScheduled", R.string.ActionGroupCallScheduled, LocaleController.formatStartsTime(action.schedule_date, 3, false));
+ } else if (messageOwner.action instanceof TLRPC.TL_messageActionGroupCall) {
if (messageOwner.action.duration != 0) {
String time;
int days = messageOwner.action.duration / (3600 * 24);
diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/MessagesController.java b/TMessagesProj/src/main/java/org/telegram/messenger/MessagesController.java
index 2850da41d..3f5acd008 100644
--- a/TMessagesProj/src/main/java/org/telegram/messenger/MessagesController.java
+++ b/TMessagesProj/src/main/java/org/telegram/messenger/MessagesController.java
@@ -313,9 +313,6 @@ public class MessagesController extends BaseController implements NotificationCe
public volatile boolean ignoreSetOnline;
- private ArrayList preloadedStickers = new ArrayList<>();
- private boolean preloadingSticker;
-
public static class FaqSearchResult {
public String title;
@@ -2390,7 +2387,7 @@ public class MessagesController extends BaseController implements NotificationCe
editor = emojiPreferences.edit();
editor.putLong("lastGifLoadTime", 0).putLong("lastStickersLoadTime", 0).putLong("lastStickersLoadTimeMask", 0).putLong("lastStickersLoadTimeFavs", 0).commit();
editor = mainPreferences.edit();
- editor.remove("archivehint").remove("proximityhint").remove("archivehint_l").remove("gifhint").remove("soundHint").remove("dcDomainName2").remove("webFileDatacenterId").remove("themehint").remove("showFiltersTooltip").commit();
+ editor.remove("archivehint").remove("proximityhint").remove("archivehint_l").remove("gifhint").remove("reminderhint").remove("soundHint").remove("dcDomainName2").remove("webFileDatacenterId").remove("themehint").remove("showFiltersTooltip").commit();
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("shortcut_widget", Activity.MODE_PRIVATE);
SharedPreferences.Editor widgetEditor = null;
@@ -3006,6 +3003,9 @@ public class MessagesController extends BaseController implements NotificationCe
}));
}
}
+ if (result != null && result.call instanceof TLRPC.TL_groupCallDiscarded) {
+ return null;
+ }
return result;
}
@@ -8885,14 +8885,11 @@ public class MessagesController extends BaseController implements NotificationCe
}
public void updateChatAbout(int chat_id, final String about, final TLRPC.ChatFull info) {
- if (info == null) {
- return;
- }
TLRPC.TL_messages_editChatAbout req = new TLRPC.TL_messages_editChatAbout();
req.peer = getInputPeer(-chat_id);
req.about = about;
getConnectionsManager().sendRequest(req, (response, error) -> {
- if (response instanceof TLRPC.TL_boolTrue) {
+ if (response instanceof TLRPC.TL_boolTrue && info != null) {
AndroidUtilities.runOnUIThread(() -> {
info.about = about;
getMessagesStorage().updateChatInfo(info, false);
@@ -9141,7 +9138,7 @@ public class MessagesController extends BaseController implements NotificationCe
}
}
- public void changeChatAvatar(int chat_id, TLRPC.TL_inputChatPhoto oldPhoto, TLRPC.InputFile inputPhoto, final TLRPC.InputFile inputVideo, double videoStartTimestamp, String videoPath, TLRPC.FileLocation smallSize, TLRPC.FileLocation bigSize) {
+ public void changeChatAvatar(int chat_id, TLRPC.TL_inputChatPhoto oldPhoto, TLRPC.InputFile inputPhoto, final TLRPC.InputFile inputVideo, double videoStartTimestamp, String videoPath, TLRPC.FileLocation smallSize, TLRPC.FileLocation bigSize, Runnable callback) {
TLObject request;
TLRPC.InputChatPhoto inputChatPhoto;
if (oldPhoto != null) {
@@ -9221,7 +9218,12 @@ public class MessagesController extends BaseController implements NotificationCe
}
}
processUpdates(updates, false);
- AndroidUtilities.runOnUIThread(() -> getNotificationCenter().postNotificationName(NotificationCenter.updateInterfaces, MessagesController.UPDATE_MASK_AVATAR));
+ AndroidUtilities.runOnUIThread(() -> {
+ if (callback != null) {
+ callback.run();
+ }
+ getNotificationCenter().postNotificationName(NotificationCenter.updateInterfaces, MessagesController.UPDATE_MASK_AVATAR);
+ });
}, ConnectionsManager.RequestFlagInvokeAfter);
}
@@ -13977,7 +13979,7 @@ public class MessagesController extends BaseController implements NotificationCe
}
for (int a = 0, N = reasons.size(); a < N; a++) {
TLRPC.TL_restrictionReason reason = reasons.get(a);
- if ("all".equals(reason.platform) || "android".equals(reason.platform)) {
+ if ("all".equals(reason.platform) || !AndroidUtilities.isStandaloneApp() && !AndroidUtilities.isBetaApp() && "android".equals(reason.platform)) {
return reason.text;
}
}
@@ -14238,9 +14240,6 @@ public class MessagesController extends BaseController implements NotificationCe
if (callback != null) {
callback.onMessagesLoaded(isCache);
}
- if (lower_part > 0 && size == 0) {
- preloadGreetingsSticker();
- }
}
} else if (id == NotificationCenter.loadingMessagesFailed && (Integer) args[0] == classGuid) {
getNotificationCenter().removeObserver(this, NotificationCenter.messagesDidLoadWithoutProcess);
@@ -14263,34 +14262,6 @@ public class MessagesController extends BaseController implements NotificationCe
}
}
- public void preloadGreetingsSticker() {
- if (preloadingSticker) {
- return;
- }
- preloadingSticker = true;
- TLRPC.TL_messages_getStickers req = new TLRPC.TL_messages_getStickers();
- req.emoticon = "\uD83D\uDC4B" + Emoji.fixEmoji("⭐");
- ConnectionsManager.getInstance(currentAccount).sendRequest(req, (response, error) -> {
- if (response instanceof TLRPC.TL_messages_stickers) {
- ArrayList list = ((TLRPC.TL_messages_stickers) response).stickers;
- if (!list.isEmpty()) {
- AndroidUtilities.runOnUIThread(() -> {
- for (int i = 0; i < list.size(); i++) {
- TLRPC.Document sticker = list.get(i);
- FileLoader.getInstance(currentAccount).loadFile(ImageLocation.getForDocument(sticker), sticker, null, 0, 1);
- preloadedStickers.add(sticker);
- }
- NotificationCenter.getInstance(currentAccount).postNotificationName(NotificationCenter.greetingsStickerLoaded);
- });
- }
- }
- });
- }
-
- public TLRPC.Document getPreloadedSticker() {
- return !preloadedStickers.isEmpty() ? preloadedStickers.get(Utilities.random.nextInt(preloadedStickers.size())) : null;
- }
-
public interface MessagesLoadedCallback {
void onMessagesLoaded(boolean fromCache);
void onError();
diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/MessagesStorage.java b/TMessagesProj/src/main/java/org/telegram/messenger/MessagesStorage.java
index 027d952bc..effd95114 100644
--- a/TMessagesProj/src/main/java/org/telegram/messenger/MessagesStorage.java
+++ b/TMessagesProj/src/main/java/org/telegram/messenger/MessagesStorage.java
@@ -6562,6 +6562,7 @@ public class MessagesStorage extends BaseController {
}
int minId = Integer.MAX_VALUE;
int maxId = Integer.MIN_VALUE;
+ ArrayList messageIdsToFix = null;
if (cursor != null) {
while (cursor.next()) {
messagesCount++;
@@ -6572,7 +6573,14 @@ public class MessagesStorage extends BaseController {
if (data != null) {
TLRPC.Message message = TLRPC.Message.TLdeserialize(data, data.readInt32(false), false);
message.send_state = cursor.intValue(2);
- message.id = cursor.intValue(3);
+ long fullMid = cursor.longValue(3);
+ message.id = (int) fullMid;
+ if ((fullMid & 0xffffffff00000000L) == 0xffffffff00000000L && message.id > 0) {
+ if (messageIdsToFix == null) {
+ messageIdsToFix = new ArrayList<>();
+ }
+ messageIdsToFix.add(fullMid);
+ }
if (message.id > 0 && message.send_state != 0 && message.send_state != 3) {
message.send_state = 0;
}
@@ -6678,6 +6686,18 @@ public class MessagesStorage extends BaseController {
}
cursor.dispose();
}
+ if (messageIdsToFix != null) { //TODO remove later
+ SQLitePreparedStatement state = database.executeFast("UPDATE messages SET mid = ? WHERE mid = ?");
+ for (int a = 0, N = messageIdsToFix.size(); a < N; a++) {
+ long id = messageIdsToFix.get(a);
+ state.requery();
+ state.bindLong(1, (int) id);
+ state.bindLong(2, id);
+ state.step();
+ }
+ state.dispose();
+ }
+
Collections.sort(res.messages, (lhs, rhs) -> {
if (lhs.id > 0 && rhs.id > 0) {
diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/NativeLoader.java b/TMessagesProj/src/main/java/org/telegram/messenger/NativeLoader.java
index 80cba1486..03c91b1ad 100644
--- a/TMessagesProj/src/main/java/org/telegram/messenger/NativeLoader.java
+++ b/TMessagesProj/src/main/java/org/telegram/messenger/NativeLoader.java
@@ -22,7 +22,7 @@ import java.util.zip.ZipFile;
public class NativeLoader {
- private final static int LIB_VERSION = 37;
+ private final static int LIB_VERSION = 38;
private final static String LIB_NAME = "tmessages." + LIB_VERSION;
private final static String LIB_SO_NAME = "lib" + LIB_NAME + ".so";
private final static String LOCALE_LIB_SO_NAME = "lib" + LIB_NAME + "loc.so";
diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/NotificationCenter.java b/TMessagesProj/src/main/java/org/telegram/messenger/NotificationCenter.java
index 0327aa6f2..436821059 100644
--- a/TMessagesProj/src/main/java/org/telegram/messenger/NotificationCenter.java
+++ b/TMessagesProj/src/main/java/org/telegram/messenger/NotificationCenter.java
@@ -213,7 +213,6 @@ public class NotificationCenter {
public static final int webRtcMicAmplitudeEvent = totalEvents++;
public static final int webRtcSpeakerAmplitudeEvent = totalEvents++;
public static final int showBulletin = totalEvents++;
- public static final int greetingsStickerLoaded = totalEvents++;
private SparseArray> observers = new SparseArray<>();
private SparseArray> removeAfterBroadcast = new SparseArray<>();
diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/NotificationsController.java b/TMessagesProj/src/main/java/org/telegram/messenger/NotificationsController.java
index 036581e2a..dface0ef3 100644
--- a/TMessagesProj/src/main/java/org/telegram/messenger/NotificationsController.java
+++ b/TMessagesProj/src/main/java/org/telegram/messenger/NotificationsController.java
@@ -1404,6 +1404,8 @@ public class NotificationsController extends BaseController {
}
} else if (messageObject.messageOwner.action instanceof TLRPC.TL_messageActionGroupCall) {
return LocaleController.formatString("NotificationGroupCreatedCall", R.string.NotificationGroupCreatedCall, name, chat.title);
+ } else if (messageObject.messageOwner.action instanceof TLRPC.TL_messageActionGroupCallScheduled) {
+ return messageObject.messageText.toString();
} else if (messageObject.messageOwner.action instanceof TLRPC.TL_messageActionInviteToGroupCall) {
int singleUserId = messageObject.messageOwner.action.user_id;
if (singleUserId == 0 && messageObject.messageOwner.action.users.size() == 1) {
@@ -2023,6 +2025,8 @@ public class NotificationsController extends BaseController {
}
} else if (messageObject.messageOwner.action instanceof TLRPC.TL_messageActionGroupCall) {
msg = LocaleController.formatString("NotificationGroupCreatedCall", R.string.NotificationGroupCreatedCall, name, chat.title);
+ } else if (messageObject.messageOwner.action instanceof TLRPC.TL_messageActionGroupCallScheduled) {
+ msg = messageObject.messageText.toString();
} else if (messageObject.messageOwner.action instanceof TLRPC.TL_messageActionInviteToGroupCall) {
int singleUserId = messageObject.messageOwner.action.user_id;
if (singleUserId == 0 && messageObject.messageOwner.action.users.size() == 1) {
diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/SendMessagesHelper.java b/TMessagesProj/src/main/java/org/telegram/messenger/SendMessagesHelper.java
index 28ba33868..cd34b18f6 100644
--- a/TMessagesProj/src/main/java/org/telegram/messenger/SendMessagesHelper.java
+++ b/TMessagesProj/src/main/java/org/telegram/messenger/SendMessagesHelper.java
@@ -42,6 +42,7 @@ import android.widget.Toast;
import androidx.annotation.UiThread;
import androidx.core.view.inputmethod.InputContentInfoCompat;
+import org.json.JSONObject;
import org.telegram.messenger.audioinfo.AudioInfo;
import org.telegram.messenger.support.SparseLongArray;
import org.telegram.tgnet.ConnectionsManager;
@@ -1616,7 +1617,7 @@ public class SendMessagesHelper extends BaseController implements NotificationCe
TLRPC.TL_keyboardButtonRow newRow = null;
for (int c = 0, N2 = oldRow.buttons.size(); c < N2; c++) {
TLRPC.KeyboardButton button = oldRow.buttons.get(c);
- if (button instanceof TLRPC.TL_keyboardButtonUrlAuth || button instanceof TLRPC.TL_keyboardButtonUrl || button instanceof TLRPC.TL_keyboardButtonSwitchInline) {
+ if (button instanceof TLRPC.TL_keyboardButtonUrlAuth || button instanceof TLRPC.TL_keyboardButtonUrl || button instanceof TLRPC.TL_keyboardButtonSwitchInline || button instanceof TLRPC.TL_keyboardButtonBuy) {
if (button instanceof TLRPC.TL_keyboardButtonUrlAuth) {
TLRPC.TL_keyboardButtonUrlAuth auth = new TLRPC.TL_keyboardButtonUrlAuth();
auth.flags = button.flags;
@@ -2541,9 +2542,9 @@ public class SendMessagesHelper extends BaseController implements NotificationCe
if (response instanceof TLRPC.TL_payments_paymentForm) {
final TLRPC.TL_payments_paymentForm form = (TLRPC.TL_payments_paymentForm) response;
getMessagesController().putUsers(form.users, false);
- parentFragment.presentFragment(new PaymentFormActivity(form, messageObject));
+ parentFragment.presentFragment(new PaymentFormActivity(form, messageObject, parentFragment));
} else if (response instanceof TLRPC.TL_payments_paymentReceipt) {
- parentFragment.presentFragment(new PaymentFormActivity(messageObject, (TLRPC.TL_payments_paymentReceipt) response));
+ parentFragment.presentFragment(new PaymentFormActivity((TLRPC.TL_payments_paymentReceipt) response));
}
} else {
TLRPC.TL_messages_botCallbackAnswer res = (TLRPC.TL_messages_botCallbackAnswer) response;
@@ -2730,10 +2731,26 @@ public class SendMessagesHelper extends BaseController implements NotificationCe
if ((messageObject.messageOwner.media.flags & 4) == 0) {
TLRPC.TL_payments_getPaymentForm req = new TLRPC.TL_payments_getPaymentForm();
req.msg_id = messageObject.getId();
+ req.peer = getMessagesController().getInputPeer(messageObject.messageOwner.peer_id);
+ try {
+ JSONObject jsonObject = new JSONObject();
+ jsonObject.put("bg_color", Theme.getColor(Theme.key_windowBackgroundWhite));
+ jsonObject.put("text_color", Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
+ jsonObject.put("hint_color", Theme.getColor(Theme.key_windowBackgroundWhiteHintText));
+ jsonObject.put("link_color", Theme.getColor(Theme.key_windowBackgroundWhiteLinkText));
+ jsonObject.put("button_color", Theme.getColor(Theme.key_featuredStickers_addButton));
+ jsonObject.put("button_text_color", Theme.getColor(Theme.key_featuredStickers_buttonText));
+ req.theme_params = new TLRPC.TL_dataJSON();
+ req.theme_params.data = jsonObject.toString();
+ req.flags |= 1;
+ } catch (Exception e) {
+ FileLog.e(e);
+ }
getConnectionsManager().sendRequest(req, requestDelegate, ConnectionsManager.RequestFlagFailOnServerErrors);
} else {
TLRPC.TL_payments_getPaymentReceipt req = new TLRPC.TL_payments_getPaymentReceipt();
req.msg_id = messageObject.messageOwner.media.receipt_msg_id;
+ req.peer = getMessagesController().getInputPeer(messageObject.messageOwner.peer_id);
getConnectionsManager().sendRequest(req, requestDelegate, ConnectionsManager.RequestFlagFailOnServerErrors);
}
} else {
@@ -2815,38 +2832,42 @@ public class SendMessagesHelper extends BaseController implements NotificationCe
}
public void sendMessage(MessageObject retryMessageObject) {
- sendMessage(null, null, null, null, null, null, null, null, null, retryMessageObject.getDialogId(), retryMessageObject.messageOwner.attachPath, null, null, null, true, retryMessageObject, null, retryMessageObject.messageOwner.reply_markup, retryMessageObject.messageOwner.params, !retryMessageObject.messageOwner.silent, retryMessageObject.scheduled ? retryMessageObject.messageOwner.date : 0, 0, null);
+ sendMessage(null, null, null, null, null, null, null, null, null, null, retryMessageObject.getDialogId(), retryMessageObject.messageOwner.attachPath, null, null, null, true, retryMessageObject, null, retryMessageObject.messageOwner.reply_markup, retryMessageObject.messageOwner.params, !retryMessageObject.messageOwner.silent, retryMessageObject.scheduled ? retryMessageObject.messageOwner.date : 0, 0, null);
}
public void sendMessage(TLRPC.User user, long peer, MessageObject replyToMsg, MessageObject replyToTopMsg, TLRPC.ReplyMarkup replyMarkup, HashMap params, boolean notify, int scheduleDate) {
- sendMessage(null, null, null, null, null, user, null, null, null, peer, null, replyToMsg, replyToTopMsg, null, true, null, null, replyMarkup, params, notify, scheduleDate, 0, null);
+ sendMessage(null, null, null, null, null, user, null, null, null, null, peer, null, replyToMsg, replyToTopMsg, null, true, null, null, replyMarkup, params, notify, scheduleDate, 0, null);
+ }
+
+ public void sendMessage(TLRPC.TL_messageMediaInvoice invoice, long peer, MessageObject replyToMsg, MessageObject replyToTopMsg, TLRPC.ReplyMarkup replyMarkup, HashMap params, boolean notify, int scheduleDate) {
+ sendMessage(null, null, null, null, null, null, null, null, null, invoice, peer, null, replyToMsg, replyToTopMsg, null, true, null, null, replyMarkup, params, notify, scheduleDate, 0, null);
}
public void sendMessage(TLRPC.TL_document document, VideoEditedInfo videoEditedInfo, String path, long peer, MessageObject replyToMsg, MessageObject replyToTopMsg, String caption, ArrayList entities, TLRPC.ReplyMarkup replyMarkup, HashMap params, boolean notify, int scheduleDate, int ttl, Object parentObject) {
- sendMessage(null, caption, null, null, videoEditedInfo, null, document, null, null, peer, path, replyToMsg, replyToTopMsg, null, true, null, entities, replyMarkup, params, notify, scheduleDate, ttl, parentObject);
+ sendMessage(null, caption, null, null, videoEditedInfo, null, document, null, null, null, peer, path, replyToMsg, replyToTopMsg, null, true, null, entities, replyMarkup, params, notify, scheduleDate, ttl, parentObject);
}
public void sendMessage(String message, long peer, MessageObject replyToMsg, MessageObject replyToTopMsg, TLRPC.WebPage webPage, boolean searchLinks, ArrayList entities, TLRPC.ReplyMarkup replyMarkup, HashMap params, boolean notify, int scheduleDate) {
- sendMessage(message, null, null, null, null, null, null, null, null, peer, null, replyToMsg, replyToTopMsg, webPage, searchLinks, null, entities, replyMarkup, params, notify, scheduleDate, 0, null);
+ sendMessage(message, null, null, null, null, null, null, null, null, null, peer, null, replyToMsg, replyToTopMsg, webPage, searchLinks, null, entities, replyMarkup, params, notify, scheduleDate, 0, null);
}
public void sendMessage(TLRPC.MessageMedia location, long peer, MessageObject replyToMsg, MessageObject replyToTopMsg, TLRPC.ReplyMarkup replyMarkup, HashMap params, boolean notify, int scheduleDate) {
- sendMessage(null, null, location, null, null, null, null, null, null, peer, null, replyToMsg, replyToTopMsg, null, true, null, null, replyMarkup, params, notify, scheduleDate, 0, null);
+ sendMessage(null, null, location, null, null, null, null, null, null, null, peer, null, replyToMsg, replyToTopMsg, null, true, null, null, replyMarkup, params, notify, scheduleDate, 0, null);
}
public void sendMessage(TLRPC.TL_messageMediaPoll poll, long peer, MessageObject replyToMsg, MessageObject replyToTopMsg, TLRPC.ReplyMarkup replyMarkup, HashMap params, boolean notify, int scheduleDate) {
- sendMessage(null, null, null, null, null, null, null, null, poll, peer, null, replyToMsg, replyToTopMsg, null, true, null, null, replyMarkup, params, notify, scheduleDate, 0, null);
+ sendMessage(null, null, null, null, null, null, null, null, poll, null, peer, null, replyToMsg, replyToTopMsg, null, true, null, null, replyMarkup, params, notify, scheduleDate, 0, null);
}
public void sendMessage(TLRPC.TL_game game, long peer, TLRPC.ReplyMarkup replyMarkup, HashMap params, boolean notify, int scheduleDate) {
- sendMessage(null, null, null, null, null, null, null, game, null, peer, null, null, null, null, true, null, null, replyMarkup, params, notify, scheduleDate, 0, null);
+ sendMessage(null, null, null, null, null, null, null, game, null, null, peer, null, null, null, null, true, null, null, replyMarkup, params, notify, scheduleDate, 0, null);
}
public void sendMessage(TLRPC.TL_photo photo, String path, long peer, MessageObject replyToMsg, MessageObject replyToTopMsg, String caption, ArrayList entities, TLRPC.ReplyMarkup replyMarkup, HashMap params, boolean notify, int scheduleDate, int ttl, Object parentObject) {
- sendMessage(null, caption, null, photo, null, null, null, null, null, peer, path, replyToMsg, replyToTopMsg, null, true, null, entities, replyMarkup, params, notify, scheduleDate, ttl, parentObject);
+ sendMessage(null, caption, null, photo, null, null, null, null, null, null, peer, path, replyToMsg, replyToTopMsg, null, true, null, entities, replyMarkup, params, notify, scheduleDate, ttl, parentObject);
}
- private void sendMessage(String message, String caption, TLRPC.MessageMedia location, TLRPC.TL_photo photo, VideoEditedInfo videoEditedInfo, TLRPC.User user, TLRPC.TL_document document, TLRPC.TL_game game, TLRPC.TL_messageMediaPoll poll, long peer, String path, MessageObject replyToMsg, MessageObject replyToTopMsg, TLRPC.WebPage webPage, boolean searchLinks, MessageObject retryMessageObject, ArrayList entities, TLRPC.ReplyMarkup replyMarkup, HashMap params, boolean notify, int scheduleDate, int ttl, Object parentObject) {
+ private void sendMessage(String message, String caption, TLRPC.MessageMedia location, TLRPC.TL_photo photo, VideoEditedInfo videoEditedInfo, TLRPC.User user, TLRPC.TL_document document, TLRPC.TL_game game, TLRPC.TL_messageMediaPoll poll, TLRPC.TL_messageMediaInvoice invoice, long peer, String path, MessageObject replyToMsg, MessageObject replyToTopMsg, TLRPC.WebPage webPage, boolean searchLinks, MessageObject retryMessageObject, ArrayList entities, TLRPC.ReplyMarkup replyMarkup, HashMap params, boolean notify, int scheduleDate, int ttl, Object parentObject) {
if (user != null && user.phone == null) {
return;
}
@@ -3053,6 +3074,12 @@ public class SendMessagesHelper extends BaseController implements NotificationCe
if (params != null && params.containsKey("query_id")) {
type = 9;
}
+ } else if (invoice != null) {
+ newMsg = new TLRPC.TL_message();
+ newMsg.media = invoice;
+ if (params != null && params.containsKey("query_id")) {
+ type = 9;
+ }
} else if (user != null) {
if (encryptedChat != null) {
newMsg = new TLRPC.TL_message_secret();
@@ -5040,7 +5067,7 @@ public class SendMessagesHelper extends BaseController implements NotificationCe
newMsgObj.flags |= TLRPC.MESSAGE_FLAG_HAS_MEDIA;
ImageLoader.saveMessageThumbs(newMsgObj);
}
- if (res.media instanceof TLRPC.TL_messageMediaGame && !TextUtils.isEmpty(res.message)) {
+ if ((res.media instanceof TLRPC.TL_messageMediaGame || res.media instanceof TLRPC.TL_messageMediaInvoice) && !TextUtils.isEmpty(res.message)) {
newMsgObj.message = res.message;
}
if (!newMsgObj.entities.isEmpty()) {
@@ -5207,7 +5234,6 @@ public class SendMessagesHelper extends BaseController implements NotificationCe
getNotificationCenter().postNotificationName(NotificationCenter.messageReceivedByAck, msg_id);
});
}, ConnectionsManager.RequestFlagCanCompress | ConnectionsManager.RequestFlagInvokeAfter | (req instanceof TLRPC.TL_messages_sendMessage ? ConnectionsManager.RequestFlagNeedQuickAck : 0));
-
if (parentMessage != null) {
parentMessage.sendDelayedRequests();
}
@@ -5435,12 +5461,16 @@ public class SendMessagesHelper extends BaseController implements NotificationCe
} else if (sentMessage.media instanceof TLRPC.TL_messageMediaGeo) {
sentMessage.media.geo.lat = newMsg.media.geo.lat;
sentMessage.media.geo._long = newMsg.media.geo._long;
- } else if (sentMessage.media instanceof TLRPC.TL_messageMediaGame) {
+ } else if (sentMessage.media instanceof TLRPC.TL_messageMediaGame || sentMessage.media instanceof TLRPC.TL_messageMediaInvoice) {
newMsg.media = sentMessage.media;
- if (newMsg.media instanceof TLRPC.TL_messageMediaGame && !TextUtils.isEmpty(sentMessage.message)) {
+ if (!TextUtils.isEmpty(sentMessage.message)) {
newMsg.entities = sentMessage.entities;
newMsg.message = sentMessage.message;
}
+ if (sentMessage.reply_markup != null) {
+ newMsg.reply_markup = sentMessage.reply_markup;
+ newMsg.flags |= TLRPC.MESSAGE_FLAG_HAS_MARKUP;
+ }
} else if (sentMessage.media instanceof TLRPC.TL_messageMediaPoll) {
newMsg.media = sentMessage.media;
}
@@ -6438,6 +6468,24 @@ public class SendMessagesHelper extends BaseController implements NotificationCe
reason.reason = "";
user.restriction_reason.add(reason);
accountInstance.getSendMessagesHelper().sendMessage(user, dialogId, replyToMsg, replyToTopMsg, result.send_message.reply_markup, params, notify, scheduleDate);
+ } else if (result.send_message instanceof TLRPC.TL_botInlineMessageMediaInvoice) {
+ if (DialogObject.isSecretDialogId(dialogId)) {
+ return; //doesn't work in secret chats for now
+ }
+ TLRPC.TL_botInlineMessageMediaInvoice invoice = (TLRPC.TL_botInlineMessageMediaInvoice) result.send_message;
+ TLRPC.TL_messageMediaInvoice messageMediaInvoice = new TLRPC.TL_messageMediaInvoice();
+ messageMediaInvoice.shipping_address_requested = invoice.shipping_address_requested;
+ messageMediaInvoice.test = invoice.test;
+ messageMediaInvoice.title = invoice.title;
+ messageMediaInvoice.description = invoice.description;
+ if (invoice.photo != null) {
+ messageMediaInvoice.photo = invoice.photo;
+ messageMediaInvoice.flags |= 1;
+ }
+ messageMediaInvoice.currency = invoice.currency;
+ messageMediaInvoice.total_amount = invoice.total_amount;
+ messageMediaInvoice.start_param = "";
+ accountInstance.getSendMessagesHelper().sendMessage(messageMediaInvoice, dialogId, replyToMsg, replyToTopMsg, result.send_message.reply_markup, params, notify, scheduleDate);
}
}
@@ -7360,6 +7408,9 @@ public class SendMessagesHelper extends BaseController implements NotificationCe
orientation[0] = fileDrawable.getOrientation();
}
fileDrawable.recycle();
+ if (bitmap == null) {
+ return createVideoThumbnailAtTime(filePath, time, orientation, false);
+ }
} else {
MediaMetadataRetriever retriever = new MediaMetadataRetriever();
try {
diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/SvgHelper.java b/TMessagesProj/src/main/java/org/telegram/messenger/SvgHelper.java
index 87917f7e4..3cf989a84 100644
--- a/TMessagesProj/src/main/java/org/telegram/messenger/SvgHelper.java
+++ b/TMessagesProj/src/main/java/org/telegram/messenger/SvgHelper.java
@@ -260,7 +260,11 @@ public class SvgHelper {
placeholderMatrix = new Matrix();
placeholderGradient.setLocalMatrix(placeholderMatrix);
for (Paint paint : paints.values()) {
- paint.setShader(new ComposeShader(placeholderGradient, backgroundGradient, PorterDuff.Mode.ADD));
+ if (Build.VERSION.SDK_INT <= 22) {
+ paint.setShader(backgroundGradient);
+ } else {
+ paint.setShader(new ComposeShader(placeholderGradient, backgroundGradient, PorterDuff.Mode.ADD));
+ }
}
}
}
diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/WearDataLayerListenerService.java b/TMessagesProj/src/main/java/org/telegram/messenger/WearDataLayerListenerService.java
index 4f7ab88a5..6f9adebb6 100644
--- a/TMessagesProj/src/main/java/org/telegram/messenger/WearDataLayerListenerService.java
+++ b/TMessagesProj/src/main/java/org/telegram/messenger/WearDataLayerListenerService.java
@@ -96,7 +96,7 @@ public class WearDataLayerListenerService extends WearableListenerService {
};
AndroidUtilities.runOnUIThread(() -> {
NotificationCenter.getInstance(currentAccount).addObserver(listener, NotificationCenter.fileDidLoad);
- FileLoader.getInstance(currentAccount).loadFile(ImageLocation.getForUser(user, false), user, null, 1, 1);
+ FileLoader.getInstance(currentAccount).loadFile(ImageLocation.getForUserOrChat(user, ImageLocation.TYPE_SMALL), user, null, 1, 1);
});
try {
barrier.await(10, TimeUnit.SECONDS);
diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/voip/VoIPBaseService.java b/TMessagesProj/src/main/java/org/telegram/messenger/voip/VoIPBaseService.java
index e3d56498e..fc8f5edde 100644
--- a/TMessagesProj/src/main/java/org/telegram/messenger/voip/VoIPBaseService.java
+++ b/TMessagesProj/src/main/java/org/telegram/messenger/voip/VoIPBaseService.java
@@ -195,6 +195,7 @@ public abstract class VoIPBaseService extends Service implements SensorEventList
protected int mySource;
protected String myJson;
protected boolean createGroupCall;
+ protected int scheduleDate;
protected TLRPC.InputPeer groupCallPeer;
public boolean hasFewPeers;
protected String joinHash;
@@ -1281,38 +1282,42 @@ public abstract class VoIPBaseService extends Service implements SensorEventList
protected Bitmap getRoundAvatarBitmap(TLObject userOrChat) {
Bitmap bitmap = null;
- if (userOrChat instanceof TLRPC.User) {
- TLRPC.User user = (TLRPC.User) userOrChat;
- if (user.photo != null && user.photo.photo_small != null) {
- BitmapDrawable img = ImageLoader.getInstance().getImageFromMemory(user.photo.photo_small, null, "50_50");
- if (img != null) {
- bitmap = img.getBitmap().copy(Bitmap.Config.ARGB_8888, true);
- } else {
- try {
- BitmapFactory.Options opts = new BitmapFactory.Options();
- opts.inMutable = true;
- bitmap = BitmapFactory.decodeFile(FileLoader.getPathToAttach(user.photo.photo_small, true).toString(), opts);
- } catch (Throwable e) {
- FileLog.e(e);
- }
- }
- }
- } else {
- TLRPC.Chat chat = (TLRPC.Chat) userOrChat;
- if (chat.photo != null && chat.photo.photo_small != null) {
- BitmapDrawable img = ImageLoader.getInstance().getImageFromMemory(chat.photo.photo_small, null, "50_50");
- if (img != null) {
- bitmap = img.getBitmap().copy(Bitmap.Config.ARGB_8888, true);
- } else {
- try {
- BitmapFactory.Options opts = new BitmapFactory.Options();
- opts.inMutable = true;
- bitmap = BitmapFactory.decodeFile(FileLoader.getPathToAttach(chat.photo.photo_small, true).toString(), opts);
- } catch (Throwable e) {
- FileLog.e(e);
+ try {
+ if (userOrChat instanceof TLRPC.User) {
+ TLRPC.User user = (TLRPC.User) userOrChat;
+ if (user.photo != null && user.photo.photo_small != null) {
+ BitmapDrawable img = ImageLoader.getInstance().getImageFromMemory(user.photo.photo_small, null, "50_50");
+ if (img != null) {
+ bitmap = img.getBitmap().copy(Bitmap.Config.ARGB_8888, true);
+ } else {
+ try {
+ BitmapFactory.Options opts = new BitmapFactory.Options();
+ opts.inMutable = true;
+ bitmap = BitmapFactory.decodeFile(FileLoader.getPathToAttach(user.photo.photo_small, true).toString(), opts);
+ } catch (Throwable e) {
+ FileLog.e(e);
+ }
+ }
+ }
+ } else {
+ TLRPC.Chat chat = (TLRPC.Chat) userOrChat;
+ if (chat.photo != null && chat.photo.photo_small != null) {
+ BitmapDrawable img = ImageLoader.getInstance().getImageFromMemory(chat.photo.photo_small, null, "50_50");
+ if (img != null) {
+ bitmap = img.getBitmap().copy(Bitmap.Config.ARGB_8888, true);
+ } else {
+ try {
+ BitmapFactory.Options opts = new BitmapFactory.Options();
+ opts.inMutable = true;
+ bitmap = BitmapFactory.decodeFile(FileLoader.getPathToAttach(chat.photo.photo_small, true).toString(), opts);
+ } catch (Throwable e) {
+ FileLog.e(e);
+ }
}
}
}
+ } catch (Throwable e) {
+ FileLog.e(e);
}
if (bitmap == null) {
Theme.createDialogsResources(this);
diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/voip/VoIPService.java b/TMessagesProj/src/main/java/org/telegram/messenger/voip/VoIPService.java
index f9b4b203d..bd26486d9 100755
--- a/TMessagesProj/src/main/java/org/telegram/messenger/voip/VoIPService.java
+++ b/TMessagesProj/src/main/java/org/telegram/messenger/voip/VoIPService.java
@@ -237,6 +237,7 @@ public class VoIPService extends VoIPBaseService {
groupCallPeer.user_id = peerUserId;
groupCallPeer.access_hash = intent.getLongExtra("peerAccessHash", 0);
}
+ scheduleDate = intent.getIntExtra("scheduleDate", 0);
isOutgoing = intent.getBooleanExtra("is_outgoing", false);
videoCall = intent.getBooleanExtra("video_call", false);
@@ -1328,6 +1329,10 @@ public class VoIPService extends VoIPBaseService {
TLRPC.TL_phone_createGroupCall req = new TLRPC.TL_phone_createGroupCall();
req.peer = MessagesController.getInputPeer(chat);
req.random_id = Utilities.random.nextInt();
+ if (scheduleDate != 0) {
+ req.schedule_date = scheduleDate;
+ req.flags |= 2;
+ }
ConnectionsManager.getInstance(currentAccount).sendRequest(req, (response, error) -> {
if (response != null) {
TLRPC.Updates updates = (TLRPC.Updates) response;
@@ -1673,8 +1678,7 @@ public class VoIPService extends VoIPBaseService {
connectingSoundRunnable = null;
}
} else {
- Utilities.globalQueue.postRunnable(() -> soundPool.play(spVoiceChatStartId, 1.0f, 1.0f, 0, 0, 1));
- playedConnectedSound = true;
+ playConnectedSound();
}
if (!wasConnected) {
wasConnected = true;
@@ -1866,6 +1870,11 @@ public class VoIPService extends VoIPBaseService {
}
}
+ public void playConnectedSound() {
+ Utilities.globalQueue.postRunnable(() -> soundPool.play(spVoiceChatStartId, 1.0f, 1.0f, 0, 0, 1));
+ playedConnectedSound = true;
+ }
+
private void startConnectingSound() {
Utilities.globalQueue.postRunnable(() -> {
if (spPlayId != 0) {
diff --git a/TMessagesProj/src/main/java/org/telegram/tgnet/ConnectionsManager.java b/TMessagesProj/src/main/java/org/telegram/tgnet/ConnectionsManager.java
index 2893c40b0..1d3c0a9a6 100644
--- a/TMessagesProj/src/main/java/org/telegram/tgnet/ConnectionsManager.java
+++ b/TMessagesProj/src/main/java/org/telegram/tgnet/ConnectionsManager.java
@@ -376,8 +376,17 @@ public class ConnectionsManager extends BaseController {
if (installer == null) {
installer = "";
}
+ String packageId = "";
+ try {
+ packageId = ApplicationLoader.applicationContext.getPackageName();
+ } catch (Throwable ignore) {
- native_init(currentAccount, version, layer, apiId, deviceModel, systemVersion, appVersion, langCode, systemLangCode, configPath, logPath, regId, cFingerprint, installer, timezoneOffset, userId, enablePushConnection, ApplicationLoader.isNetworkOnline(), ApplicationLoader.getCurrentNetworkType());
+ }
+ if (packageId == null) {
+ packageId = "";
+ }
+
+ native_init(currentAccount, version, layer, apiId, deviceModel, systemVersion, appVersion, langCode, systemLangCode, configPath, logPath, regId, cFingerprint, installer, packageId, timezoneOffset, userId, enablePushConnection, ApplicationLoader.isNetworkOnline(), ApplicationLoader.getCurrentNetworkType());
checkConnection();
}
@@ -688,7 +697,7 @@ public class ConnectionsManager extends BaseController {
public static native void native_applyDatacenterAddress(int currentAccount, int datacenterId, String ipAddress, int port);
public static native int native_getConnectionState(int currentAccount);
public static native void native_setUserId(int currentAccount, int id);
- public static native void native_init(int currentAccount, int version, int layer, int apiId, String deviceModel, String systemVersion, String appVersion, String langCode, String systemLangCode, String configPath, String logPath, String regId, String cFingerprint, String installer, int timezoneOffset, int userId, boolean enablePushConnection, boolean hasNetwork, int networkType);
+ public static native void native_init(int currentAccount, int version, int layer, int apiId, String deviceModel, String systemVersion, String appVersion, String langCode, String systemLangCode, String configPath, String logPath, String regId, String cFingerprint, String installer, String packageId, int timezoneOffset, int userId, boolean enablePushConnection, boolean hasNetwork, int networkType);
public static native void native_setProxySettings(int currentAccount, String address, int port, String username, String password, String secret);
public static native void native_setLangCode(int currentAccount, String langCode);
public static native void native_setRegId(int currentAccount, String regId);
diff --git a/TMessagesProj/src/main/java/org/telegram/tgnet/TLRPC.java b/TMessagesProj/src/main/java/org/telegram/tgnet/TLRPC.java
index 82cad21d8..7a20689c2 100644
--- a/TMessagesProj/src/main/java/org/telegram/tgnet/TLRPC.java
+++ b/TMessagesProj/src/main/java/org/telegram/tgnet/TLRPC.java
@@ -62,7 +62,7 @@ public class TLRPC {
public static final int MESSAGE_FLAG_HAS_BOT_ID = 0x00000800;
public static final int MESSAGE_FLAG_EDITED = 0x00008000;
- public static final int LAYER = 126;
+ public static final int LAYER = 127;
public static class TL_stats_megagroupStats extends TLObject {
public static int constructor = 0xef7ff916;
@@ -400,6 +400,7 @@ public class TLRPC {
public boolean has_video;
public FileLocation photo_small;
public FileLocation photo_big;
+ public byte[] stripped_thumb;
public int dc_id;
public static ChatPhoto TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) {
@@ -415,6 +416,9 @@ public class TLRPC {
result = new TL_chatPhoto_layer97();
break;
case 0xd20b9f3c:
+ result = new TL_chatPhoto_layer126();
+ break;
+ case 0x4790ee05:
result = new TL_chatPhoto();
break;
}
@@ -471,7 +475,7 @@ public class TLRPC {
}
}
- public static class TL_chatPhoto extends ChatPhoto {
+ public static class TL_chatPhoto_layer126 extends TL_chatPhoto {
public static int constructor = 0xd20b9f3c;
@@ -493,6 +497,34 @@ public class TLRPC {
}
}
+ public static class TL_chatPhoto extends ChatPhoto {
+ public static int constructor = 0x4790ee05;
+
+
+ public void readParams(AbstractSerializedData stream, boolean exception) {
+ flags = stream.readInt32(exception);
+ has_video = (flags & 1) != 0;
+ photo_small = FileLocation.TLdeserialize(stream, stream.readInt32(exception), exception);
+ photo_big = FileLocation.TLdeserialize(stream, stream.readInt32(exception), exception);
+ if ((flags & 2) != 0) {
+ stripped_thumb = stream.readByteArray(exception);
+ }
+ dc_id = stream.readInt32(exception);
+ }
+
+ public void serializeToStream(AbstractSerializedData stream) {
+ stream.writeInt32(constructor);
+ flags = has_video ? (flags | 1) : (flags &~ 1);
+ stream.writeInt32(flags);
+ photo_small.serializeToStream(stream);
+ photo_big.serializeToStream(stream);
+ if ((flags & 2) != 0) {
+ stream.writeByteArray(stripped_thumb);
+ }
+ stream.writeInt32(dc_id);
+ }
+ }
+
public static class TL_help_termsOfService extends TLObject {
public static int constructor = 0x780a0310;
@@ -559,90 +591,110 @@ public class TLRPC {
}
}
- public static class TL_payments_paymentReceipt extends TLObject {
- public static int constructor = 0x500911e1;
+ public static class TL_payments_paymentReceipt extends TLObject {
+ public static int constructor = 0x10b555d0;
- public int flags;
- public int date;
- public int bot_id;
- public TL_invoice invoice;
- public int provider_id;
- public TL_paymentRequestedInfo info;
- public TL_shippingOption shipping;
- public String currency;
- public long total_amount;
- public String credentials_title;
- public ArrayList users = new ArrayList<>();
+ public int flags;
+ public int date;
+ public int bot_id;
+ public int provider_id;
+ public String title;
+ public String description;
+ public WebDocument photo;
+ public TL_invoice invoice;
+ public TL_paymentRequestedInfo info;
+ public TL_shippingOption shipping;
+ public long tip_amount;
+ public String currency;
+ public long total_amount;
+ public String credentials_title;
+ public ArrayList users = new ArrayList<>();
- public static TL_payments_paymentReceipt TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) {
- if (TL_payments_paymentReceipt.constructor != constructor) {
- if (exception) {
- throw new RuntimeException(String.format("can't parse magic %x in TL_payments_paymentReceipt", constructor));
- } else {
- return null;
- }
- }
- TL_payments_paymentReceipt result = new TL_payments_paymentReceipt();
- result.readParams(stream, exception);
- return result;
- }
+ public static TL_payments_paymentReceipt TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) {
+ if (TL_payments_paymentReceipt.constructor != constructor) {
+ if (exception) {
+ throw new RuntimeException(String.format("can't parse magic %x in TL_payments_paymentReceipt", constructor));
+ } else {
+ return null;
+ }
+ }
+ TL_payments_paymentReceipt result = new TL_payments_paymentReceipt();
+ result.readParams(stream, exception);
+ return result;
+ }
- public void readParams(AbstractSerializedData stream, boolean exception) {
- flags = stream.readInt32(exception);
- date = stream.readInt32(exception);
- bot_id = stream.readInt32(exception);
- invoice = TL_invoice.TLdeserialize(stream, stream.readInt32(exception), exception);
- provider_id = stream.readInt32(exception);
- if ((flags & 1) != 0) {
- info = TL_paymentRequestedInfo.TLdeserialize(stream, stream.readInt32(exception), exception);
- }
- if ((flags & 2) != 0) {
- shipping = TL_shippingOption.TLdeserialize(stream, stream.readInt32(exception), exception);
- }
- currency = stream.readString(exception);
- total_amount = stream.readInt64(exception);
- credentials_title = stream.readString(exception);
- int magic = stream.readInt32(exception);
- if (magic != 0x1cb5c415) {
- if (exception) {
- throw new RuntimeException(String.format("wrong Vector magic, got %x", magic));
- }
- return;
- }
- int count = stream.readInt32(exception);
- for (int a = 0; a < count; a++) {
- User object = User.TLdeserialize(stream, stream.readInt32(exception), exception);
- if (object == null) {
- return;
- }
- users.add(object);
- }
- }
+ public void readParams(AbstractSerializedData stream, boolean exception) {
+ flags = stream.readInt32(exception);
+ date = stream.readInt32(exception);
+ bot_id = stream.readInt32(exception);
+ provider_id = stream.readInt32(exception);
+ title = stream.readString(exception);
+ description = stream.readString(exception);
+ if ((flags & 4) != 0) {
+ photo = WebDocument.TLdeserialize(stream, stream.readInt32(exception), exception);
+ }
+ invoice = TL_invoice.TLdeserialize(stream, stream.readInt32(exception), exception);
+ if ((flags & 1) != 0) {
+ info = TL_paymentRequestedInfo.TLdeserialize(stream, stream.readInt32(exception), exception);
+ }
+ if ((flags & 2) != 0) {
+ shipping = TL_shippingOption.TLdeserialize(stream, stream.readInt32(exception), exception);
+ }
+ if ((flags & 8) != 0) {
+ tip_amount = stream.readInt64(exception);
+ }
+ currency = stream.readString(exception);
+ total_amount = stream.readInt64(exception);
+ credentials_title = stream.readString(exception);
+ int magic = stream.readInt32(exception);
+ if (magic != 0x1cb5c415) {
+ if (exception) {
+ throw new RuntimeException(String.format("wrong Vector magic, got %x", magic));
+ }
+ return;
+ }
+ int count = stream.readInt32(exception);
+ for (int a = 0; a < count; a++) {
+ User object = User.TLdeserialize(stream, stream.readInt32(exception), exception);
+ if (object == null) {
+ return;
+ }
+ users.add(object);
+ }
+ }
- public void serializeToStream(AbstractSerializedData stream) {
- stream.writeInt32(constructor);
- stream.writeInt32(flags);
- stream.writeInt32(date);
- stream.writeInt32(bot_id);
- invoice.serializeToStream(stream);
- stream.writeInt32(provider_id);
- if ((flags & 1) != 0) {
- info.serializeToStream(stream);
- }
- if ((flags & 2) != 0) {
- shipping.serializeToStream(stream);
- }
- stream.writeString(currency);
- stream.writeInt64(total_amount);
- stream.writeString(credentials_title);
- stream.writeInt32(0x1cb5c415);
- int count = users.size();
- stream.writeInt32(count);
- for (int a = 0; a < count; a++) {
- users.get(a).serializeToStream(stream);
- }
- }
- }
+ public void serializeToStream(AbstractSerializedData stream) {
+ stream.writeInt32(constructor);
+ stream.writeInt32(flags);
+ stream.writeInt32(date);
+ stream.writeInt32(bot_id);
+ stream.writeInt32(provider_id);
+ stream.writeString(title);
+ stream.writeString(description);
+ if ((flags & 4) != 0) {
+ photo.serializeToStream(stream);
+ }
+ invoice.serializeToStream(stream);
+ if ((flags & 1) != 0) {
+ info.serializeToStream(stream);
+ }
+ if ((flags & 2) != 0) {
+ shipping.serializeToStream(stream);
+ }
+ if ((flags & 8) != 0) {
+ stream.writeInt64(tip_amount);
+ }
+ stream.writeString(currency);
+ stream.writeInt64(total_amount);
+ stream.writeString(credentials_title);
+ stream.writeInt32(0x1cb5c415);
+ int count = users.size();
+ stream.writeInt32(count);
+ for (int a = 0; a < count; a++) {
+ users.get(a).serializeToStream(stream);
+ }
+ }
+ }
public static abstract class NotifyPeer extends TLObject {
@@ -1876,15 +1928,17 @@ public class TLRPC {
public boolean join_muted;
public boolean can_change_join_muted;
public boolean join_date_asc;
+ public boolean schedule_start_subscribed;
public long id;
public long access_hash;
- public int duration;
public int participants_count;
public TL_dataJSON params;
public String title;
public int stream_dc_id;
public int record_start_date;
+ public int schedule_date;
public int version;
+ public int duration;
public static GroupCall TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) {
GroupCall result = null;
@@ -1892,7 +1946,7 @@ public class TLRPC {
case 0x7780bcb4:
result = new TL_groupCallDiscarded();
break;
- case 0xc0c2052e:
+ case 0xc95c6654:
result = new TL_groupCall();
break;
}
@@ -1925,7 +1979,7 @@ public class TLRPC {
}
public static class TL_groupCall extends GroupCall {
- public static int constructor = 0xc0c2052e;
+ public static int constructor = 0xc95c6654;
public void readParams(AbstractSerializedData stream, boolean exception) {
@@ -1933,6 +1987,7 @@ public class TLRPC {
join_muted = (flags & 2) != 0;
can_change_join_muted = (flags & 4) != 0;
join_date_asc = (flags & 64) != 0;
+ schedule_start_subscribed = (flags & 256) != 0;
id = stream.readInt64(exception);
access_hash = stream.readInt64(exception);
participants_count = stream.readInt32(exception);
@@ -1948,6 +2003,9 @@ public class TLRPC {
if ((flags & 32) != 0) {
record_start_date = stream.readInt32(exception);
}
+ if ((flags & 128) != 0) {
+ schedule_date = stream.readInt32(exception);
+ }
version = stream.readInt32(exception);
}
@@ -1956,6 +2014,7 @@ public class TLRPC {
flags = join_muted ? (flags | 2) : (flags &~ 2);
flags = can_change_join_muted ? (flags | 4) : (flags &~ 4);
flags = join_date_asc ? (flags | 64) : (flags &~ 64);
+ flags = schedule_start_subscribed ? (flags | 256) : (flags &~ 256);
stream.writeInt32(flags);
stream.writeInt64(id);
stream.writeInt64(access_hash);
@@ -1972,6 +2031,9 @@ public class TLRPC {
if ((flags & 32) != 0) {
stream.writeInt32(record_start_date);
}
+ if ((flags & 128) != 0) {
+ stream.writeInt32(schedule_date);
+ }
stream.writeInt32(version);
}
}
@@ -2873,101 +2935,104 @@ public class TLRPC {
}
}
- public static class TL_payments_paymentForm extends TLObject {
- public static int constructor = 0x3f56aea3;
+ public static class TL_payments_paymentForm extends TLObject {
+ public static int constructor = 0x8d0b2415;
- public int flags;
- public boolean can_save_credentials;
- public boolean password_missing;
- public int bot_id;
- public TL_invoice invoice;
- public int provider_id;
- public String url;
- public String native_provider;
- public TL_dataJSON native_params;
- public TL_paymentRequestedInfo saved_info;
- public TL_paymentSavedCredentialsCard saved_credentials;
- public ArrayList users = new ArrayList<>();
+ public int flags;
+ public boolean can_save_credentials;
+ public boolean password_missing;
+ public long form_id;
+ public int bot_id;
+ public TL_invoice invoice;
+ public int provider_id;
+ public String url;
+ public String native_provider;
+ public TL_dataJSON native_params;
+ public TL_paymentRequestedInfo saved_info;
+ public TL_paymentSavedCredentialsCard saved_credentials;
+ public ArrayList users = new ArrayList<>();
- public static TL_payments_paymentForm TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) {
- if (TL_payments_paymentForm.constructor != constructor) {
- if (exception) {
- throw new RuntimeException(String.format("can't parse magic %x in TL_payments_paymentForm", constructor));
- } else {
- return null;
- }
- }
- TL_payments_paymentForm result = new TL_payments_paymentForm();
- result.readParams(stream, exception);
- return result;
- }
+ public static TL_payments_paymentForm TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) {
+ if (TL_payments_paymentForm.constructor != constructor) {
+ if (exception) {
+ throw new RuntimeException(String.format("can't parse magic %x in TL_payments_paymentForm", constructor));
+ } else {
+ return null;
+ }
+ }
+ TL_payments_paymentForm result = new TL_payments_paymentForm();
+ result.readParams(stream, exception);
+ return result;
+ }
- public void readParams(AbstractSerializedData stream, boolean exception) {
- flags = stream.readInt32(exception);
- can_save_credentials = (flags & 4) != 0;
- password_missing = (flags & 8) != 0;
- bot_id = stream.readInt32(exception);
- invoice = TL_invoice.TLdeserialize(stream, stream.readInt32(exception), exception);
- provider_id = stream.readInt32(exception);
- url = stream.readString(exception);
- if ((flags & 16) != 0) {
- native_provider = stream.readString(exception);
- }
- if ((flags & 16) != 0) {
- native_params = TL_dataJSON.TLdeserialize(stream, stream.readInt32(exception), exception);
- }
- if ((flags & 1) != 0) {
- saved_info = TL_paymentRequestedInfo.TLdeserialize(stream, stream.readInt32(exception), exception);
- }
- if ((flags & 2) != 0) {
- saved_credentials = TL_paymentSavedCredentialsCard.TLdeserialize(stream, stream.readInt32(exception), exception);
- }
- int magic = stream.readInt32(exception);
- if (magic != 0x1cb5c415) {
- if (exception) {
- throw new RuntimeException(String.format("wrong Vector magic, got %x", magic));
- }
- return;
- }
- int count = stream.readInt32(exception);
- for (int a = 0; a < count; a++) {
- User object = User.TLdeserialize(stream, stream.readInt32(exception), exception);
- if (object == null) {
- return;
- }
- users.add(object);
- }
- }
+ public void readParams(AbstractSerializedData stream, boolean exception) {
+ flags = stream.readInt32(exception);
+ can_save_credentials = (flags & 4) != 0;
+ password_missing = (flags & 8) != 0;
+ form_id = stream.readInt64(exception);
+ bot_id = stream.readInt32(exception);
+ invoice = TL_invoice.TLdeserialize(stream, stream.readInt32(exception), exception);
+ provider_id = stream.readInt32(exception);
+ url = stream.readString(exception);
+ if ((flags & 16) != 0) {
+ native_provider = stream.readString(exception);
+ }
+ if ((flags & 16) != 0) {
+ native_params = TL_dataJSON.TLdeserialize(stream, stream.readInt32(exception), exception);
+ }
+ if ((flags & 1) != 0) {
+ saved_info = TL_paymentRequestedInfo.TLdeserialize(stream, stream.readInt32(exception), exception);
+ }
+ if ((flags & 2) != 0) {
+ saved_credentials = TL_paymentSavedCredentialsCard.TLdeserialize(stream, stream.readInt32(exception), exception);
+ }
+ int magic = stream.readInt32(exception);
+ if (magic != 0x1cb5c415) {
+ if (exception) {
+ throw new RuntimeException(String.format("wrong Vector magic, got %x", magic));
+ }
+ return;
+ }
+ int count = stream.readInt32(exception);
+ for (int a = 0; a < count; a++) {
+ User object = User.TLdeserialize(stream, stream.readInt32(exception), exception);
+ if (object == null) {
+ return;
+ }
+ users.add(object);
+ }
+ }
- public void serializeToStream(AbstractSerializedData stream) {
- stream.writeInt32(constructor);
- flags = can_save_credentials ? (flags | 4) : (flags &~ 4);
- flags = password_missing ? (flags | 8) : (flags &~ 8);
- stream.writeInt32(flags);
- stream.writeInt32(bot_id);
- invoice.serializeToStream(stream);
- stream.writeInt32(provider_id);
- stream.writeString(url);
- if ((flags & 16) != 0) {
- stream.writeString(native_provider);
- }
- if ((flags & 16) != 0) {
- native_params.serializeToStream(stream);
- }
- if ((flags & 1) != 0) {
- saved_info.serializeToStream(stream);
- }
- if ((flags & 2) != 0) {
- saved_credentials.serializeToStream(stream);
- }
- stream.writeInt32(0x1cb5c415);
- int count = users.size();
- stream.writeInt32(count);
- for (int a = 0; a < count; a++) {
- users.get(a).serializeToStream(stream);
- }
- }
- }
+ public void serializeToStream(AbstractSerializedData stream) {
+ stream.writeInt32(constructor);
+ flags = can_save_credentials ? (flags | 4) : (flags &~ 4);
+ flags = password_missing ? (flags | 8) : (flags &~ 8);
+ stream.writeInt32(flags);
+ stream.writeInt64(form_id);
+ stream.writeInt32(bot_id);
+ invoice.serializeToStream(stream);
+ stream.writeInt32(provider_id);
+ stream.writeString(url);
+ if ((flags & 16) != 0) {
+ stream.writeString(native_provider);
+ }
+ if ((flags & 16) != 0) {
+ native_params.serializeToStream(stream);
+ }
+ if ((flags & 1) != 0) {
+ saved_info.serializeToStream(stream);
+ }
+ if ((flags & 2) != 0) {
+ saved_credentials.serializeToStream(stream);
+ }
+ stream.writeInt32(0x1cb5c415);
+ int count = users.size();
+ stream.writeInt32(count);
+ for (int a = 0; a < count; a++) {
+ users.get(a).serializeToStream(stream);
+ }
+ }
+ }
public static abstract class ContactLink_layer101 extends TLObject {
@@ -13981,323 +14046,326 @@ public class TLRPC {
}
}
- public static abstract class BotInlineMessage extends TLObject {
- public int flags;
- public GeoPoint geo;
- public String title;
- public String address;
- public String provider;
- public String venue_id;
- public String venue_type;
- public ReplyMarkup reply_markup;
- public String message;
- public ArrayList entities = new ArrayList<>();
- public String phone_number;
- public String first_name;
- public String last_name;
- public String vcard;
- public boolean no_webpage;
- public int period;
+ public static abstract class BotInlineMessage extends TLObject {
+ public int flags;
+ public GeoPoint geo;
+ public String title;
+ public String address;
+ public String provider;
+ public String venue_id;
+ public String venue_type;
+ public ReplyMarkup reply_markup;
+ public String message;
+ public ArrayList entities = new ArrayList<>();
+ public String phone_number;
+ public String first_name;
+ public String last_name;
+ public String vcard;
+ public boolean no_webpage;
+ public int period;
public int heading;
public int proximity_notification_radius;
- public static BotInlineMessage TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) {
- BotInlineMessage result = null;
- switch (constructor) {
- case 0x4366232e:
- result = new TL_botInlineMessageMediaVenue_layer77();
- break;
- case 0x8a86659c:
- result = new TL_botInlineMessageMediaVenue();
- break;
- case 0x3a8fd8b8:
- result = new TL_botInlineMessageMediaGeo_layer71();
- break;
- case 0x764cf810:
- result = new TL_botInlineMessageMediaAuto();
- break;
- case 0xa74b15b:
- result = new TL_botInlineMessageMediaAuto_layer74();
- break;
- case 0x35edb4d4:
- result = new TL_botInlineMessageMediaContact_layer81();
- break;
- case 0x18d1cdc2:
- result = new TL_botInlineMessageMediaContact();
- break;
- case 0x8c7f65e2:
- result = new TL_botInlineMessageText();
- break;
- case 0xb722de65:
- result = new TL_botInlineMessageMediaGeo_layer119();
- break;
+ public static BotInlineMessage TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) {
+ BotInlineMessage result = null;
+ switch (constructor) {
+ case 0x4366232e:
+ result = new TL_botInlineMessageMediaVenue_layer77();
+ break;
+ case 0x8a86659c:
+ result = new TL_botInlineMessageMediaVenue();
+ break;
+ case 0x3a8fd8b8:
+ result = new TL_botInlineMessageMediaGeo_layer71();
+ break;
+ case 0x764cf810:
+ result = new TL_botInlineMessageMediaAuto();
+ break;
+ case 0xa74b15b:
+ result = new TL_botInlineMessageMediaAuto_layer74();
+ break;
+ case 0x35edb4d4:
+ result = new TL_botInlineMessageMediaContact_layer81();
+ break;
+ case 0x18d1cdc2:
+ result = new TL_botInlineMessageMediaContact();
+ break;
+ case 0x8c7f65e2:
+ result = new TL_botInlineMessageText();
+ break;
+ case 0xb722de65:
+ result = new TL_botInlineMessageMediaGeo_layer119();
+ break;
case 0x51846fd:
result = new TL_botInlineMessageMediaGeo();
break;
- }
- if (result == null && exception) {
- throw new RuntimeException(String.format("can't parse magic %x in BotInlineMessage", constructor));
- }
- if (result != null) {
- result.readParams(stream, exception);
- }
- return result;
- }
- }
+ case 0x354a9b09:
+ result = new TL_botInlineMessageMediaInvoice();
+ break;
+ }
+ if (result == null && exception) {
+ throw new RuntimeException(String.format("can't parse magic %x in BotInlineMessage", constructor));
+ }
+ if (result != null) {
+ result.readParams(stream, exception);
+ }
+ return result;
+ }
+ }
- public static class TL_botInlineMessageMediaVenue_layer77 extends TL_botInlineMessageMediaVenue {
- public static int constructor = 0x4366232e;
+ public static class TL_botInlineMessageMediaVenue_layer77 extends TL_botInlineMessageMediaVenue {
+ public static int constructor = 0x4366232e;
- public void readParams(AbstractSerializedData stream, boolean exception) {
- flags = stream.readInt32(exception);
- geo = GeoPoint.TLdeserialize(stream, stream.readInt32(exception), exception);
- title = stream.readString(exception);
- address = stream.readString(exception);
- provider = stream.readString(exception);
- venue_id = stream.readString(exception);
- if ((flags & 4) != 0) {
- reply_markup = ReplyMarkup.TLdeserialize(stream, stream.readInt32(exception), exception);
- }
- }
+ public void readParams(AbstractSerializedData stream, boolean exception) {
+ flags = stream.readInt32(exception);
+ geo = GeoPoint.TLdeserialize(stream, stream.readInt32(exception), exception);
+ title = stream.readString(exception);
+ address = stream.readString(exception);
+ provider = stream.readString(exception);
+ venue_id = stream.readString(exception);
+ if ((flags & 4) != 0) {
+ reply_markup = ReplyMarkup.TLdeserialize(stream, stream.readInt32(exception), exception);
+ }
+ }
- public void serializeToStream(AbstractSerializedData stream) {
- stream.writeInt32(constructor);
- stream.writeInt32(flags);
- geo.serializeToStream(stream);
- stream.writeString(title);
- stream.writeString(address);
- stream.writeString(provider);
- stream.writeString(venue_id);
- if ((flags & 4) != 0) {
- reply_markup.serializeToStream(stream);
- }
- }
- }
+ public void serializeToStream(AbstractSerializedData stream) {
+ stream.writeInt32(constructor);
+ stream.writeInt32(flags);
+ geo.serializeToStream(stream);
+ stream.writeString(title);
+ stream.writeString(address);
+ stream.writeString(provider);
+ stream.writeString(venue_id);
+ if ((flags & 4) != 0) {
+ reply_markup.serializeToStream(stream);
+ }
+ }
+ }
- public static class TL_botInlineMessageMediaVenue extends BotInlineMessage {
- public static int constructor = 0x8a86659c;
+ public static class TL_botInlineMessageMediaVenue extends BotInlineMessage {
+ public static int constructor = 0x8a86659c;
- public void readParams(AbstractSerializedData stream, boolean exception) {
- flags = stream.readInt32(exception);
- geo = GeoPoint.TLdeserialize(stream, stream.readInt32(exception), exception);
- title = stream.readString(exception);
- address = stream.readString(exception);
- provider = stream.readString(exception);
- venue_id = stream.readString(exception);
- venue_type = stream.readString(exception);
- if ((flags & 4) != 0) {
- reply_markup = ReplyMarkup.TLdeserialize(stream, stream.readInt32(exception), exception);
- }
- }
+ public void readParams(AbstractSerializedData stream, boolean exception) {
+ flags = stream.readInt32(exception);
+ geo = GeoPoint.TLdeserialize(stream, stream.readInt32(exception), exception);
+ title = stream.readString(exception);
+ address = stream.readString(exception);
+ provider = stream.readString(exception);
+ venue_id = stream.readString(exception);
+ venue_type = stream.readString(exception);
+ if ((flags & 4) != 0) {
+ reply_markup = ReplyMarkup.TLdeserialize(stream, stream.readInt32(exception), exception);
+ }
+ }
- public void serializeToStream(AbstractSerializedData stream) {
- stream.writeInt32(constructor);
- stream.writeInt32(flags);
- geo.serializeToStream(stream);
- stream.writeString(title);
- stream.writeString(address);
- stream.writeString(provider);
- stream.writeString(venue_id);
- stream.writeString(venue_type);
- if ((flags & 4) != 0) {
- reply_markup.serializeToStream(stream);
- }
- }
- }
+ public void serializeToStream(AbstractSerializedData stream) {
+ stream.writeInt32(constructor);
+ stream.writeInt32(flags);
+ geo.serializeToStream(stream);
+ stream.writeString(title);
+ stream.writeString(address);
+ stream.writeString(provider);
+ stream.writeString(venue_id);
+ stream.writeString(venue_type);
+ if ((flags & 4) != 0) {
+ reply_markup.serializeToStream(stream);
+ }
+ }
+ }
- public static class TL_botInlineMessageMediaGeo_layer71 extends TL_botInlineMessageMediaGeo {
- public static int constructor = 0x3a8fd8b8;
+ public static class TL_botInlineMessageMediaGeo_layer71 extends TL_botInlineMessageMediaGeo {
+ public static int constructor = 0x3a8fd8b8;
- public void readParams(AbstractSerializedData stream, boolean exception) {
- flags = stream.readInt32(exception);
- geo = GeoPoint.TLdeserialize(stream, stream.readInt32(exception), exception);
- if ((flags & 4) != 0) {
- reply_markup = ReplyMarkup.TLdeserialize(stream, stream.readInt32(exception), exception);
- }
- }
+ public void readParams(AbstractSerializedData stream, boolean exception) {
+ flags = stream.readInt32(exception);
+ geo = GeoPoint.TLdeserialize(stream, stream.readInt32(exception), exception);
+ if ((flags & 4) != 0) {
+ reply_markup = ReplyMarkup.TLdeserialize(stream, stream.readInt32(exception), exception);
+ }
+ }
- public void serializeToStream(AbstractSerializedData stream) {
- stream.writeInt32(constructor);
- stream.writeInt32(flags);
- geo.serializeToStream(stream);
- if ((flags & 4) != 0) {
- reply_markup.serializeToStream(stream);
- }
- }
- }
+ public void serializeToStream(AbstractSerializedData stream) {
+ stream.writeInt32(constructor);
+ stream.writeInt32(flags);
+ geo.serializeToStream(stream);
+ if ((flags & 4) != 0) {
+ reply_markup.serializeToStream(stream);
+ }
+ }
+ }
- public static class TL_botInlineMessageMediaAuto extends BotInlineMessage {
- public static int constructor = 0x764cf810;
+ public static class TL_botInlineMessageMediaAuto extends BotInlineMessage {
+ public static int constructor = 0x764cf810;
- public void readParams(AbstractSerializedData stream, boolean exception) {
- flags = stream.readInt32(exception);
- message = stream.readString(exception);
- if ((flags & 2) != 0) {
- int magic = stream.readInt32(exception);
- if (magic != 0x1cb5c415) {
- if (exception) {
- throw new RuntimeException(String.format("wrong Vector magic, got %x", magic));
- }
- return;
- }
- int count = stream.readInt32(exception);
- for (int a = 0; a < count; a++) {
- MessageEntity object = MessageEntity.TLdeserialize(stream, stream.readInt32(exception), exception);
- if (object == null) {
- return;
- }
- entities.add(object);
- }
- }
- if ((flags & 4) != 0) {
- reply_markup = ReplyMarkup.TLdeserialize(stream, stream.readInt32(exception), exception);
- }
- }
+ public void readParams(AbstractSerializedData stream, boolean exception) {
+ flags = stream.readInt32(exception);
+ message = stream.readString(exception);
+ if ((flags & 2) != 0) {
+ int magic = stream.readInt32(exception);
+ if (magic != 0x1cb5c415) {
+ if (exception) {
+ throw new RuntimeException(String.format("wrong Vector magic, got %x", magic));
+ }
+ return;
+ }
+ int count = stream.readInt32(exception);
+ for (int a = 0; a < count; a++) {
+ MessageEntity object = MessageEntity.TLdeserialize(stream, stream.readInt32(exception), exception);
+ if (object == null) {
+ return;
+ }
+ entities.add(object);
+ }
+ }
+ if ((flags & 4) != 0) {
+ reply_markup = ReplyMarkup.TLdeserialize(stream, stream.readInt32(exception), exception);
+ }
+ }
- public void serializeToStream(AbstractSerializedData stream) {
- stream.writeInt32(constructor);
- stream.writeInt32(flags);
- stream.writeString(message);
- if ((flags & 2) != 0) {
- stream.writeInt32(0x1cb5c415);
- int count = entities.size();
- stream.writeInt32(count);
- for (int a = 0; a < count; a++) {
- entities.get(a).serializeToStream(stream);
- }
- }
- if ((flags & 4) != 0) {
- reply_markup.serializeToStream(stream);
- }
- }
- }
+ public void serializeToStream(AbstractSerializedData stream) {
+ stream.writeInt32(constructor);
+ stream.writeInt32(flags);
+ stream.writeString(message);
+ if ((flags & 2) != 0) {
+ stream.writeInt32(0x1cb5c415);
+ int count = entities.size();
+ stream.writeInt32(count);
+ for (int a = 0; a < count; a++) {
+ entities.get(a).serializeToStream(stream);
+ }
+ }
+ if ((flags & 4) != 0) {
+ reply_markup.serializeToStream(stream);
+ }
+ }
+ }
- public static class TL_botInlineMessageMediaAuto_layer74 extends TL_botInlineMessageMediaAuto {
- public static int constructor = 0xa74b15b;
+ public static class TL_botInlineMessageMediaAuto_layer74 extends TL_botInlineMessageMediaAuto {
+ public static int constructor = 0xa74b15b;
- public void readParams(AbstractSerializedData stream, boolean exception) {
- flags = stream.readInt32(exception);
- message = stream.readString(exception);
- if ((flags & 4) != 0) {
- reply_markup = ReplyMarkup.TLdeserialize(stream, stream.readInt32(exception), exception);
- }
- }
+ public void readParams(AbstractSerializedData stream, boolean exception) {
+ flags = stream.readInt32(exception);
+ message = stream.readString(exception);
+ if ((flags & 4) != 0) {
+ reply_markup = ReplyMarkup.TLdeserialize(stream, stream.readInt32(exception), exception);
+ }
+ }
- public void serializeToStream(AbstractSerializedData stream) {
- stream.writeInt32(constructor);
- stream.writeInt32(flags);
- stream.writeString(message);
- if ((flags & 4) != 0) {
- reply_markup.serializeToStream(stream);
- }
- }
- }
+ public void serializeToStream(AbstractSerializedData stream) {
+ stream.writeInt32(constructor);
+ stream.writeInt32(flags);
+ stream.writeString(message);
+ if ((flags & 4) != 0) {
+ reply_markup.serializeToStream(stream);
+ }
+ }
+ }
- public static class TL_botInlineMessageMediaContact_layer81 extends TL_botInlineMessageMediaContact {
- public static int constructor = 0x35edb4d4;
+ public static class TL_botInlineMessageMediaContact_layer81 extends TL_botInlineMessageMediaContact {
+ public static int constructor = 0x35edb4d4;
- public void readParams(AbstractSerializedData stream, boolean exception) {
- flags = stream.readInt32(exception);
- phone_number = stream.readString(exception);
- first_name = stream.readString(exception);
- last_name = stream.readString(exception);
- if ((flags & 4) != 0) {
- reply_markup = ReplyMarkup.TLdeserialize(stream, stream.readInt32(exception), exception);
- }
- }
+ public void readParams(AbstractSerializedData stream, boolean exception) {
+ flags = stream.readInt32(exception);
+ phone_number = stream.readString(exception);
+ first_name = stream.readString(exception);
+ last_name = stream.readString(exception);
+ if ((flags & 4) != 0) {
+ reply_markup = ReplyMarkup.TLdeserialize(stream, stream.readInt32(exception), exception);
+ }
+ }
- public void serializeToStream(AbstractSerializedData stream) {
- stream.writeInt32(constructor);
- stream.writeInt32(flags);
- stream.writeString(phone_number);
- stream.writeString(first_name);
- stream.writeString(last_name);
- if ((flags & 4) != 0) {
- reply_markup.serializeToStream(stream);
- }
- }
- }
+ public void serializeToStream(AbstractSerializedData stream) {
+ stream.writeInt32(constructor);
+ stream.writeInt32(flags);
+ stream.writeString(phone_number);
+ stream.writeString(first_name);
+ stream.writeString(last_name);
+ if ((flags & 4) != 0) {
+ reply_markup.serializeToStream(stream);
+ }
+ }
+ }
- public static class TL_botInlineMessageMediaContact extends BotInlineMessage {
- public static int constructor = 0x18d1cdc2;
+ public static class TL_botInlineMessageMediaContact extends BotInlineMessage {
+ public static int constructor = 0x18d1cdc2;
- public void readParams(AbstractSerializedData stream, boolean exception) {
- flags = stream.readInt32(exception);
- phone_number = stream.readString(exception);
- first_name = stream.readString(exception);
- last_name = stream.readString(exception);
- vcard = stream.readString(exception);
- if ((flags & 4) != 0) {
- reply_markup = ReplyMarkup.TLdeserialize(stream, stream.readInt32(exception), exception);
- }
- }
+ public void readParams(AbstractSerializedData stream, boolean exception) {
+ flags = stream.readInt32(exception);
+ phone_number = stream.readString(exception);
+ first_name = stream.readString(exception);
+ last_name = stream.readString(exception);
+ vcard = stream.readString(exception);
+ if ((flags & 4) != 0) {
+ reply_markup = ReplyMarkup.TLdeserialize(stream, stream.readInt32(exception), exception);
+ }
+ }
- public void serializeToStream(AbstractSerializedData stream) {
- stream.writeInt32(constructor);
- stream.writeInt32(flags);
- stream.writeString(phone_number);
- stream.writeString(first_name);
- stream.writeString(last_name);
- stream.writeString(vcard);
- if ((flags & 4) != 0) {
- reply_markup.serializeToStream(stream);
- }
- }
- }
+ public void serializeToStream(AbstractSerializedData stream) {
+ stream.writeInt32(constructor);
+ stream.writeInt32(flags);
+ stream.writeString(phone_number);
+ stream.writeString(first_name);
+ stream.writeString(last_name);
+ stream.writeString(vcard);
+ if ((flags & 4) != 0) {
+ reply_markup.serializeToStream(stream);
+ }
+ }
+ }
- public static class TL_botInlineMessageText extends BotInlineMessage {
- public static int constructor = 0x8c7f65e2;
+ public static class TL_botInlineMessageText extends BotInlineMessage {
+ public static int constructor = 0x8c7f65e2;
- public void readParams(AbstractSerializedData stream, boolean exception) {
- flags = stream.readInt32(exception);
- no_webpage = (flags & 1) != 0;
- message = stream.readString(exception);
- if ((flags & 2) != 0) {
- int magic = stream.readInt32(exception);
- if (magic != 0x1cb5c415) {
- if (exception) {
- throw new RuntimeException(String.format("wrong Vector magic, got %x", magic));
- }
- return;
- }
- int count = stream.readInt32(exception);
- for (int a = 0; a < count; a++) {
- MessageEntity object = MessageEntity.TLdeserialize(stream, stream.readInt32(exception), exception);
- if (object == null) {
- return;
- }
- entities.add(object);
- }
- }
- if ((flags & 4) != 0) {
- reply_markup = ReplyMarkup.TLdeserialize(stream, stream.readInt32(exception), exception);
- }
- }
+ public void readParams(AbstractSerializedData stream, boolean exception) {
+ flags = stream.readInt32(exception);
+ no_webpage = (flags & 1) != 0;
+ message = stream.readString(exception);
+ if ((flags & 2) != 0) {
+ int magic = stream.readInt32(exception);
+ if (magic != 0x1cb5c415) {
+ if (exception) {
+ throw new RuntimeException(String.format("wrong Vector magic, got %x", magic));
+ }
+ return;
+ }
+ int count = stream.readInt32(exception);
+ for (int a = 0; a < count; a++) {
+ MessageEntity object = MessageEntity.TLdeserialize(stream, stream.readInt32(exception), exception);
+ if (object == null) {
+ return;
+ }
+ entities.add(object);
+ }
+ }
+ if ((flags & 4) != 0) {
+ reply_markup = ReplyMarkup.TLdeserialize(stream, stream.readInt32(exception), exception);
+ }
+ }
- public void serializeToStream(AbstractSerializedData stream) {
- stream.writeInt32(constructor);
- flags = no_webpage ? (flags | 1) : (flags &~ 1);
- stream.writeInt32(flags);
- stream.writeString(message);
- if ((flags & 2) != 0) {
- stream.writeInt32(0x1cb5c415);
- int count = entities.size();
- stream.writeInt32(count);
- for (int a = 0; a < count; a++) {
- entities.get(a).serializeToStream(stream);
- }
- }
- if ((flags & 4) != 0) {
- reply_markup.serializeToStream(stream);
- }
- }
- }
+ public void serializeToStream(AbstractSerializedData stream) {
+ stream.writeInt32(constructor);
+ flags = no_webpage ? (flags | 1) : (flags &~ 1);
+ stream.writeInt32(flags);
+ stream.writeString(message);
+ if ((flags & 2) != 0) {
+ stream.writeInt32(0x1cb5c415);
+ int count = entities.size();
+ stream.writeInt32(count);
+ for (int a = 0; a < count; a++) {
+ entities.get(a).serializeToStream(stream);
+ }
+ }
+ if ((flags & 4) != 0) {
+ reply_markup.serializeToStream(stream);
+ }
+ }
+ }
public static class TL_botInlineMessageMediaGeo extends BotInlineMessage {
public static int constructor = 0x51846fd;
@@ -14339,29 +14407,73 @@ public class TLRPC {
}
}
- public static class TL_botInlineMessageMediaGeo_layer119 extends TL_botInlineMessageMediaGeo {
- public static int constructor = 0xb722de65;
+ public static class TL_botInlineMessageMediaGeo_layer119 extends TL_botInlineMessageMediaGeo {
+ public static int constructor = 0xb722de65;
- public void readParams(AbstractSerializedData stream, boolean exception) {
- flags = stream.readInt32(exception);
- geo = GeoPoint.TLdeserialize(stream, stream.readInt32(exception), exception);
- period = stream.readInt32(exception);
- if ((flags & 4) != 0) {
- reply_markup = ReplyMarkup.TLdeserialize(stream, stream.readInt32(exception), exception);
- }
- }
+ public void readParams(AbstractSerializedData stream, boolean exception) {
+ flags = stream.readInt32(exception);
+ geo = GeoPoint.TLdeserialize(stream, stream.readInt32(exception), exception);
+ period = stream.readInt32(exception);
+ if ((flags & 4) != 0) {
+ reply_markup = ReplyMarkup.TLdeserialize(stream, stream.readInt32(exception), exception);
+ }
+ }
- public void serializeToStream(AbstractSerializedData stream) {
- stream.writeInt32(constructor);
- stream.writeInt32(flags);
- geo.serializeToStream(stream);
- stream.writeInt32(period);
- if ((flags & 4) != 0) {
- reply_markup.serializeToStream(stream);
- }
- }
- }
+ public void serializeToStream(AbstractSerializedData stream) {
+ stream.writeInt32(constructor);
+ stream.writeInt32(flags);
+ geo.serializeToStream(stream);
+ stream.writeInt32(period);
+ if ((flags & 4) != 0) {
+ reply_markup.serializeToStream(stream);
+ }
+ }
+ }
+
+ public static class TL_botInlineMessageMediaInvoice extends BotInlineMessage {
+ public static int constructor = 0x354a9b09;
+
+ public boolean shipping_address_requested;
+ public boolean test;
+ public String description;
+ public WebDocument photo;
+ public String currency;
+ public long total_amount;
+
+ public void readParams(AbstractSerializedData stream, boolean exception) {
+ flags = stream.readInt32(exception);
+ shipping_address_requested = (flags & 2) != 0;
+ test = (flags & 8) != 0;
+ title = stream.readString(exception);
+ description = stream.readString(exception);
+ if ((flags & 1) != 0) {
+ photo = WebDocument.TLdeserialize(stream, stream.readInt32(exception), exception);
+ }
+ currency = stream.readString(exception);
+ total_amount = stream.readInt64(exception);
+ if ((flags & 4) != 0) {
+ reply_markup = ReplyMarkup.TLdeserialize(stream, stream.readInt32(exception), exception);
+ }
+ }
+
+ public void serializeToStream(AbstractSerializedData stream) {
+ stream.writeInt32(constructor);
+ flags = shipping_address_requested ? (flags | 2) : (flags &~ 2);
+ flags = test ? (flags | 8) : (flags &~ 8);
+ stream.writeInt32(flags);
+ stream.writeString(title);
+ stream.writeString(description);
+ if ((flags & 1) != 0) {
+ photo.serializeToStream(stream);
+ }
+ stream.writeString(currency);
+ stream.writeInt64(total_amount);
+ if ((flags & 4) != 0) {
+ reply_markup.serializeToStream(stream);
+ }
+ }
+ }
public static class TL_keyboardButtonRow extends TLObject {
public static int constructor = 0x77608b83;
@@ -18367,6 +18479,9 @@ public class TLRPC {
case 0x92a72876:
result = new TL_messageActionGameScore();
break;
+ case 0xb3a07661:
+ result = new TL_messageActionGroupCallScheduled();
+ break;
}
if (result == null && exception) {
throw new RuntimeException(String.format("can't parse magic %x in MessageAction", constructor));
@@ -18896,6 +19011,23 @@ public class TLRPC {
}
}
+ public static class TL_messageActionGroupCallScheduled extends MessageAction {
+ public static int constructor = 0xb3a07661;
+
+ public int schedule_date;
+
+ public void readParams(AbstractSerializedData stream, boolean exception) {
+ call = TL_inputGroupCall.TLdeserialize(stream, stream.readInt32(exception), exception);
+ schedule_date = stream.readInt32(exception);
+ }
+
+ public void serializeToStream(AbstractSerializedData stream) {
+ stream.writeInt32(constructor);
+ call.serializeToStream(stream);
+ stream.writeInt32(schedule_date);
+ }
+ }
+
public static abstract class ReportReason extends TLObject {
public static ReportReason TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) {
@@ -19411,82 +19543,111 @@ public class TLRPC {
}
}
- public static class TL_invoice extends TLObject {
- public static int constructor = 0xc30aa358;
+ public static class TL_invoice extends TLObject {
+ public static int constructor = 0xcd886e0;
- public int flags;
- public boolean test;
- public boolean name_requested;
- public boolean phone_requested;
- public boolean email_requested;
- public boolean shipping_address_requested;
- public boolean flexible;
- public boolean phone_to_provider;
- public boolean email_to_provider;
- public String currency;
- public ArrayList prices = new ArrayList<>();
+ public int flags;
+ public boolean test;
+ public boolean name_requested;
+ public boolean phone_requested;
+ public boolean email_requested;
+ public boolean shipping_address_requested;
+ public boolean flexible;
+ public boolean phone_to_provider;
+ public boolean email_to_provider;
+ public String currency;
+ public ArrayList prices = new ArrayList<>();
+ public long max_tip_amount;
+ public ArrayList suggested_tip_amounts = new ArrayList<>();
- public static TL_invoice TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) {
- if (TL_invoice.constructor != constructor) {
- if (exception) {
- throw new RuntimeException(String.format("can't parse magic %x in TL_invoice", constructor));
- } else {
- return null;
- }
- }
- TL_invoice result = new TL_invoice();
- result.readParams(stream, exception);
- return result;
- }
+ public static TL_invoice TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) {
+ if (TL_invoice.constructor != constructor) {
+ if (exception) {
+ throw new RuntimeException(String.format("can't parse magic %x in TL_invoice", constructor));
+ } else {
+ return null;
+ }
+ }
+ TL_invoice result = new TL_invoice();
+ result.readParams(stream, exception);
+ return result;
+ }
- public void readParams(AbstractSerializedData stream, boolean exception) {
- flags = stream.readInt32(exception);
- test = (flags & 1) != 0;
- name_requested = (flags & 2) != 0;
- phone_requested = (flags & 4) != 0;
- email_requested = (flags & 8) != 0;
- shipping_address_requested = (flags & 16) != 0;
- flexible = (flags & 32) != 0;
- phone_to_provider = (flags & 64) != 0;
- email_to_provider = (flags & 128) != 0;
- currency = stream.readString(exception);
- int magic = stream.readInt32(exception);
- if (magic != 0x1cb5c415) {
- if (exception) {
- throw new RuntimeException(String.format("wrong Vector magic, got %x", magic));
- }
- return;
- }
- int count = stream.readInt32(exception);
- for (int a = 0; a < count; a++) {
- TL_labeledPrice object = TL_labeledPrice.TLdeserialize(stream, stream.readInt32(exception), exception);
- if (object == null) {
- return;
- }
- prices.add(object);
- }
- }
+ public void readParams(AbstractSerializedData stream, boolean exception) {
+ flags = stream.readInt32(exception);
+ test = (flags & 1) != 0;
+ name_requested = (flags & 2) != 0;
+ phone_requested = (flags & 4) != 0;
+ email_requested = (flags & 8) != 0;
+ shipping_address_requested = (flags & 16) != 0;
+ flexible = (flags & 32) != 0;
+ phone_to_provider = (flags & 64) != 0;
+ email_to_provider = (flags & 128) != 0;
+ currency = stream.readString(exception);
+ int magic = stream.readInt32(exception);
+ if (magic != 0x1cb5c415) {
+ if (exception) {
+ throw new RuntimeException(String.format("wrong Vector magic, got %x", magic));
+ }
+ return;
+ }
+ int count = stream.readInt32(exception);
+ for (int a = 0; a < count; a++) {
+ TL_labeledPrice object = TL_labeledPrice.TLdeserialize(stream, stream.readInt32(exception), exception);
+ if (object == null) {
+ return;
+ }
+ prices.add(object);
+ }
+ if ((flags & 256) != 0) {
+ max_tip_amount = stream.readInt64(exception);
+ }
+ if ((flags & 256) != 0) {
+ magic = stream.readInt32(exception);
+ if (magic != 0x1cb5c415) {
+ if (exception) {
+ throw new RuntimeException(String.format("wrong Vector magic, got %x", magic));
+ }
+ return;
+ }
+ count = stream.readInt32(exception);
+ for (int a = 0; a < count; a++) {
+ suggested_tip_amounts.add(stream.readInt64(exception));
+ }
+ }
+ }
- public void serializeToStream(AbstractSerializedData stream) {
- stream.writeInt32(constructor);
- flags = test ? (flags | 1) : (flags &~ 1);
- flags = name_requested ? (flags | 2) : (flags &~ 2);
- flags = phone_requested ? (flags | 4) : (flags &~ 4);
- flags = email_requested ? (flags | 8) : (flags &~ 8);
- flags = shipping_address_requested ? (flags | 16) : (flags &~ 16);
- flags = flexible ? (flags | 32) : (flags &~ 32);
- flags = phone_to_provider ? (flags | 64) : (flags &~ 64);
- flags = email_to_provider ? (flags | 128) : (flags &~ 128);
- stream.writeInt32(flags);
- stream.writeString(currency);
- stream.writeInt32(0x1cb5c415);
- int count = prices.size();
- stream.writeInt32(count);
- for (int a = 0; a < count; a++) {
- prices.get(a).serializeToStream(stream);
- }
- }
- }
+ public void serializeToStream(AbstractSerializedData stream) {
+ stream.writeInt32(constructor);
+ flags = test ? (flags | 1) : (flags &~ 1);
+ flags = name_requested ? (flags | 2) : (flags &~ 2);
+ flags = phone_requested ? (flags | 4) : (flags &~ 4);
+ flags = email_requested ? (flags | 8) : (flags &~ 8);
+ flags = shipping_address_requested ? (flags | 16) : (flags &~ 16);
+ flags = flexible ? (flags | 32) : (flags &~ 32);
+ flags = phone_to_provider ? (flags | 64) : (flags &~ 64);
+ flags = email_to_provider ? (flags | 128) : (flags &~ 128);
+ stream.writeInt32(flags);
+ stream.writeString(currency);
+ stream.writeInt32(0x1cb5c415);
+ int count = prices.size();
+ stream.writeInt32(count);
+ for (int a = 0; a < count; a++) {
+ prices.get(a).serializeToStream(stream);
+ }
+ if ((flags & 256) != 0) {
+ stream.writeInt64(max_tip_amount);
+ }
+ if ((flags & 256) != 0) {
+ stream.writeInt32(0x1cb5c415);
+ count = suggested_tip_amounts.size();
+ stream.writeInt32(count);
+ for (int a = 0; a < count; a++) {
+ stream.writeInt64(suggested_tip_amounts.get(a));
+ }
+ }
+ }
+ }
public static abstract class account_WallPapers extends TLObject {
@@ -26695,13 +26856,14 @@ public class TLRPC {
public long photo_id;
public FileLocation photo_small;
public FileLocation photo_big;
+ public byte[] stripped_thumb;
public int dc_id;
public static UserProfilePhoto TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) {
UserProfilePhoto result = null;
switch (constructor) {
case 0x69d3ab26:
- result = new TL_userProfilePhoto();
+ result = new TL_userProfilePhoto_layer126();
break;
case 0xecd75d8c:
result = new TL_userProfilePhoto_layer115();
@@ -26715,6 +26877,9 @@ public class TLRPC {
case 0x990d1493:
result = new TL_userProfilePhoto_old();
break;
+ case 0xcc656077:
+ result = new TL_userProfilePhoto();
+ break;
}
if (result == null && exception) {
throw new RuntimeException(String.format("can't parse magic %x in UserProfilePhoto", constructor));
@@ -26726,7 +26891,7 @@ public class TLRPC {
}
}
- public static class TL_userProfilePhoto extends UserProfilePhoto {
+ public static class TL_userProfilePhoto_layer126 extends TL_userProfilePhoto {
public static int constructor = 0x69d3ab26;
@@ -26750,6 +26915,36 @@ public class TLRPC {
}
}
+ public static class TL_userProfilePhoto extends UserProfilePhoto {
+ public static int constructor = 0xcc656077;
+
+
+ public void readParams(AbstractSerializedData stream, boolean exception) {
+ flags = stream.readInt32(exception);
+ has_video = (flags & 1) != 0;
+ photo_id = stream.readInt64(exception);
+ photo_small = FileLocation.TLdeserialize(stream, stream.readInt32(exception), exception);
+ photo_big = FileLocation.TLdeserialize(stream, stream.readInt32(exception), exception);
+ if ((flags & 2) != 0) {
+ stripped_thumb = stream.readByteArray(exception);
+ }
+ dc_id = stream.readInt32(exception);
+ }
+
+ public void serializeToStream(AbstractSerializedData stream) {
+ stream.writeInt32(constructor);
+ flags = has_video ? (flags | 1) : (flags &~ 1);
+ stream.writeInt32(flags);
+ stream.writeInt64(photo_id);
+ photo_small.serializeToStream(stream);
+ photo_big.serializeToStream(stream);
+ if ((flags & 2) != 0) {
+ stream.writeByteArray(stripped_thumb);
+ }
+ stream.writeInt32(dc_id);
+ }
+ }
+
public static class TL_userProfilePhoto_layer115 extends TL_userProfilePhoto {
public static int constructor = 0xecd75d8c;
@@ -34359,6 +34554,7 @@ public class TLRPC {
public int installed_date;
public ArrayList thumbs = new ArrayList<>();
public int thumb_dc_id;
+ public int thumb_version;
public static StickerSet TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) {
StickerSet result = null;
@@ -34376,11 +34572,14 @@ public class TLRPC {
result = new TL_stickerSet_layer121();
break;
case 0x40e237a8:
- result = new TL_stickerSet();
+ result = new TL_stickerSet_layer126();
break;
case 0xcd303b41:
result = new TL_stickerSet_layer75();
break;
+ case 0xd7df217a:
+ result = new TL_stickerSet();
+ break;
}
if (result == null && exception) {
throw new RuntimeException(String.format("can't parse magic %x in StickerSet", constructor));
@@ -34412,6 +34611,83 @@ public class TLRPC {
}
}
+ public static class TL_stickerSet extends StickerSet {
+ public static int constructor = 0xd7df217a;
+
+
+ public void readParams(AbstractSerializedData stream, boolean exception) {
+ flags = stream.readInt32(exception);
+ archived = (flags & 2) != 0;
+ official = (flags & 4) != 0;
+ masks = (flags & 8) != 0;
+ animated = (flags & 32) != 0;
+ if ((flags & 1) != 0) {
+ installed_date = stream.readInt32(exception);
+ }
+ id = stream.readInt64(exception);
+ access_hash = stream.readInt64(exception);
+ title = stream.readString(exception);
+ short_name = stream.readString(exception);
+ if ((flags & 16) != 0) {
+ int magic = stream.readInt32(exception);
+ if (magic != 0x1cb5c415) {
+ if (exception) {
+ throw new RuntimeException(String.format("wrong Vector magic, got %x", magic));
+ }
+ return;
+ }
+ int count = stream.readInt32(exception);
+ for (int a = 0; a < count; a++) {
+ PhotoSize object = PhotoSize.TLdeserialize(stream, stream.readInt32(exception), exception);
+ if (object == null) {
+ return;
+ }
+ thumbs.add(object);
+ }
+ }
+ if ((flags & 16) != 0) {
+ thumb_dc_id = stream.readInt32(exception);
+ }
+ if ((flags & 16) != 0) {
+ thumb_version = stream.readInt32(exception);
+ }
+ count = stream.readInt32(exception);
+ hash = stream.readInt32(exception);
+ }
+
+ public void serializeToStream(AbstractSerializedData stream) {
+ stream.writeInt32(constructor);
+ flags = archived ? (flags | 2) : (flags &~ 2);
+ flags = official ? (flags | 4) : (flags &~ 4);
+ flags = masks ? (flags | 8) : (flags &~ 8);
+ flags = animated ? (flags | 32) : (flags &~ 32);
+ stream.writeInt32(flags);
+ if ((flags & 1) != 0) {
+ stream.writeInt32(installed_date);
+ }
+ stream.writeInt64(id);
+ stream.writeInt64(access_hash);
+ stream.writeString(title);
+ stream.writeString(short_name);
+ if ((flags & 16) != 0) {
+ stream.writeInt32(0x1cb5c415);
+ int count = thumbs.size();
+ stream.writeInt32(count);
+ for (int a = 0; a < count; a++) {
+ thumbs.get(a).serializeToStream(stream);
+ }
+ }
+ if ((flags & 16) != 0) {
+ stream.writeInt32(thumb_dc_id);
+ }
+ if ((flags & 16) != 0) {
+ stream.writeInt32(thumb_version);
+ }
+ stream.writeInt32(count);
+ stream.writeInt32(hash);
+ }
+ }
+
public static class TL_stickerSet_layer96 extends TL_stickerSet {
public static int constructor = 0x5585a139;
@@ -34497,7 +34773,7 @@ public class TLRPC {
}
}
- public static class TL_stickerSet extends StickerSet {
+ public static class TL_stickerSet_layer126 extends TL_stickerSet {
public static int constructor = 0x40e237a8;
@@ -38310,7 +38586,7 @@ public class TLRPC {
}
public static class TL_groupCallParticipant extends TLObject {
- public static int constructor = 0x19adba89;
+ public static int constructor = 0xb96b25ee;
public int flags;
public boolean muted;
@@ -38329,6 +38605,7 @@ public class TLRPC {
public int volume;
public String about;
public long raise_hand_rating;
+ public TL_dataJSON params;
public long lastSpeakTime; //custom;
public float amplitude; //custom;
public boolean hasVoice; //custom;
@@ -38378,6 +38655,9 @@ public class TLRPC {
if ((flags & 8192) != 0) {
raise_hand_rating = stream.readInt64(exception);
}
+ if ((flags & 64) != 0) {
+ params = TL_dataJSON.TLdeserialize(stream, stream.readInt32(exception), exception);
+ }
}
public void serializeToStream(AbstractSerializedData stream) {
@@ -38407,6 +38687,9 @@ public class TLRPC {
if ((flags & 8192) != 0) {
stream.writeInt64(raise_hand_rating);
}
+ if ((flags & 64) != 0) {
+ params.serializeToStream(stream);
+ }
}
}
@@ -45165,10 +45448,13 @@ public class TLRPC {
}
public static class TL_phone_createGroupCall extends TLObject {
- public static int constructor = 0xbd3dabe0;
+ public static int constructor = 0x48cdc6d8;
+ public int flags;
public InputPeer peer;
public int random_id;
+ public String title;
+ public int schedule_date;
public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) {
return Updates.TLdeserialize(stream, constructor, exception);
@@ -45176,8 +45462,15 @@ public class TLRPC {
public void serializeToStream(AbstractSerializedData stream) {
stream.writeInt32(constructor);
+ stream.writeInt32(flags);
peer.serializeToStream(stream);
stream.writeInt32(random_id);
+ if ((flags & 1) != 0) {
+ stream.writeString(title);
+ }
+ if ((flags & 2) != 0) {
+ stream.writeInt32(schedule_date);
+ }
}
}
@@ -45453,35 +45746,152 @@ public class TLRPC {
}
}
- public static class TL_payments_getPaymentForm extends TLObject {
- public static int constructor = 0x99f09745;
+ public static class TL_phone_toggleGroupCallStartSubscription extends TLObject {
+ public static int constructor = 0x219c34e6;
- public int msg_id;
+ public TL_inputGroupCall call;
+ public boolean subscribed;
- public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) {
- return TL_payments_paymentForm.TLdeserialize(stream, constructor, exception);
- }
+ public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) {
+ return Updates.TLdeserialize(stream, constructor, exception);
+ }
- public void serializeToStream(AbstractSerializedData stream) {
- stream.writeInt32(constructor);
- stream.writeInt32(msg_id);
- }
- }
+ public void serializeToStream(AbstractSerializedData stream) {
+ stream.writeInt32(constructor);
+ call.serializeToStream(stream);
+ stream.writeBool(subscribed);
+ }
+ }
- public static class TL_payments_getPaymentReceipt extends TLObject {
- public static int constructor = 0xa092a980;
+ public static class TL_phone_startScheduledGroupCall extends TLObject {
+ public static int constructor = 0x5680e342;
- public int msg_id;
+ public TL_inputGroupCall call;
- public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) {
- return TL_payments_paymentReceipt.TLdeserialize(stream, constructor, exception);
- }
+ public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) {
+ return Updates.TLdeserialize(stream, constructor, exception);
+ }
- public void serializeToStream(AbstractSerializedData stream) {
- stream.writeInt32(constructor);
- stream.writeInt32(msg_id);
- }
- }
+ public void serializeToStream(AbstractSerializedData stream) {
+ stream.writeInt32(constructor);
+ call.serializeToStream(stream);
+ }
+ }
+
+ public static class TL_phone_saveDefaultGroupCallJoinAs extends TLObject {
+ public static int constructor = 0x575e1f8c;
+
+ public InputPeer peer;
+ public InputPeer join_as;
+
+ public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) {
+ return Bool.TLdeserialize(stream, constructor, exception);
+ }
+
+ public void serializeToStream(AbstractSerializedData stream) {
+ stream.writeInt32(constructor);
+ peer.serializeToStream(stream);
+ join_as.serializeToStream(stream);
+ }
+ }
+
+ public static class TL_payments_getPaymentForm extends TLObject {
+ public static int constructor = 0x8a333c8d;
+
+ public int flags;
+ public InputPeer peer;
+ public int msg_id;
+ public TL_dataJSON theme_params;
+
+ public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) {
+ return TL_payments_paymentForm.TLdeserialize(stream, constructor, exception);
+ }
+
+ public void serializeToStream(AbstractSerializedData stream) {
+ stream.writeInt32(constructor);
+ stream.writeInt32(flags);
+ peer.serializeToStream(stream);
+ stream.writeInt32(msg_id);
+ if ((flags & 1) != 0) {
+ theme_params.serializeToStream(stream);
+ }
+ }
+ }
+
+ public static class TL_payments_getPaymentReceipt extends TLObject {
+ public static int constructor = 0x2478d1cc;
+
+ public InputPeer peer;
+ public int msg_id;
+
+ public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) {
+ return TL_payments_paymentReceipt.TLdeserialize(stream, constructor, exception);
+ }
+
+ public void serializeToStream(AbstractSerializedData stream) {
+ stream.writeInt32(constructor);
+ peer.serializeToStream(stream);
+ stream.writeInt32(msg_id);
+ }
+ }
+
+ public static class TL_payments_validateRequestedInfo extends TLObject {
+ public static int constructor = 0xdb103170;
+
+ public int flags;
+ public boolean save;
+ public InputPeer peer;
+ public int msg_id;
+ public TL_paymentRequestedInfo info;
+
+ public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) {
+ return TL_payments_validatedRequestedInfo.TLdeserialize(stream, constructor, exception);
+ }
+
+ public void serializeToStream(AbstractSerializedData stream) {
+ stream.writeInt32(constructor);
+ flags = save ? (flags | 1) : (flags &~ 1);
+ stream.writeInt32(flags);
+ peer.serializeToStream(stream);
+ stream.writeInt32(msg_id);
+ info.serializeToStream(stream);
+ }
+ }
+
+ public static class TL_payments_sendPaymentForm extends TLObject {
+ public static int constructor = 0x30c3bc9d;
+
+ public int flags;
+ public long form_id;
+ public InputPeer peer;
+ public int msg_id;
+ public String requested_info_id;
+ public String shipping_option_id;
+ public InputPaymentCredentials credentials;
+ public long tip_amount;
+
+ public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) {
+ return payments_PaymentResult.TLdeserialize(stream, constructor, exception);
+ }
+
+ public void serializeToStream(AbstractSerializedData stream) {
+ stream.writeInt32(constructor);
+ stream.writeInt32(flags);
+ stream.writeInt64(form_id);
+ peer.serializeToStream(stream);
+ stream.writeInt32(msg_id);
+ if ((flags & 1) != 0) {
+ stream.writeString(requested_info_id);
+ }
+ if ((flags & 2) != 0) {
+ stream.writeString(shipping_option_id);
+ }
+ credentials.serializeToStream(stream);
+ if ((flags & 4) != 0) {
+ stream.writeInt64(tip_amount);
+ }
+ }
+ }
public static class TL_help_supportName extends TLObject {
public static int constructor = 0x8c05f1c9;
@@ -45573,54 +45983,6 @@ public class TLRPC {
}
}
- public static class TL_payments_validateRequestedInfo extends TLObject {
- public static int constructor = 0x770a8e74;
-
- public int flags;
- public boolean save;
- public int msg_id;
- public TL_paymentRequestedInfo info;
-
- public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) {
- return TL_payments_validatedRequestedInfo.TLdeserialize(stream, constructor, exception);
- }
-
- public void serializeToStream(AbstractSerializedData stream) {
- stream.writeInt32(constructor);
- flags = save ? (flags | 1) : (flags &~ 1);
- stream.writeInt32(flags);
- stream.writeInt32(msg_id);
- info.serializeToStream(stream);
- }
- }
-
- public static class TL_payments_sendPaymentForm extends TLObject {
- public static int constructor = 0x2b8879b3;
-
- public int flags;
- public int msg_id;
- public String requested_info_id;
- public String shipping_option_id;
- public InputPaymentCredentials credentials;
-
- public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) {
- return payments_PaymentResult.TLdeserialize(stream, constructor, exception);
- }
-
- public void serializeToStream(AbstractSerializedData stream) {
- stream.writeInt32(constructor);
- stream.writeInt32(flags);
- stream.writeInt32(msg_id);
- if ((flags & 1) != 0) {
- stream.writeString(requested_info_id);
- }
- if ((flags & 2) != 0) {
- stream.writeString(shipping_option_id);
- }
- credentials.serializeToStream(stream);
- }
- }
-
public static class TL_payments_getSavedInfo extends TLObject {
public static int constructor = 0x227d824b;
diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/ActionBarLayout.java b/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/ActionBarLayout.java
index 463588649..d8c9627de 100644
--- a/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/ActionBarLayout.java
+++ b/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/ActionBarLayout.java
@@ -353,6 +353,11 @@ public class ActionBarLayout extends FrameLayout {
public void setInnerTranslationX(float value) {
innerTranslationX = value;
invalidate();
+
+ if (fragmentsStack.size() >= 2) {
+ BaseFragment prevFragment = fragmentsStack.get(fragmentsStack.size() - 2);
+ prevFragment.onSlideProgress(false, value / containerView.getMeasuredWidth());
+ }
}
@Keep
@@ -528,9 +533,11 @@ public class ActionBarLayout extends FrameLayout {
return;
}
BaseFragment lastFragment = fragmentsStack.get(fragmentsStack.size() - 1);
+ lastFragment.prepareFragmentToSlide(true, false);
lastFragment.onPause();
lastFragment.onFragmentDestroy();
lastFragment.setParentLayout(null);
+
fragmentsStack.remove(fragmentsStack.size() - 1);
LayoutContainer temp = containerView;
@@ -542,11 +549,16 @@ public class ActionBarLayout extends FrameLayout {
currentActionBar = lastFragment.actionBar;
lastFragment.onResume();
lastFragment.onBecomeFullyVisible();
+ lastFragment.prepareFragmentToSlide(false, false);
layoutToIgnore = containerView;
} else {
if (fragmentsStack.size() >= 2) {
- BaseFragment lastFragment = fragmentsStack.get(fragmentsStack.size() - 2);
+ BaseFragment lastFragment = fragmentsStack.get(fragmentsStack.size() - 1);
+ lastFragment.prepareFragmentToSlide(true, false);
+
+ lastFragment = fragmentsStack.get(fragmentsStack.size() - 2);
+ lastFragment.prepareFragmentToSlide(false, false);
lastFragment.onPause();
if (lastFragment.fragmentView != null) {
ViewGroup parent = (ViewGroup) lastFragment.fragmentView.getParent();
@@ -614,6 +626,10 @@ public class ActionBarLayout extends FrameLayout {
if (themeAnimatorSet != null) {
presentingFragmentDescriptions = lastFragment.getThemeDescriptions();
}
+
+ BaseFragment currentFragment = fragmentsStack.get(fragmentsStack.size() - 1);
+ currentFragment.prepareFragmentToSlide(true, true);
+ lastFragment.prepareFragmentToSlide(false, true);
}
public boolean onTouchEvent(MotionEvent ev) {
@@ -685,19 +701,33 @@ public class ActionBarLayout extends FrameLayout {
float distToMove;
if (!backAnimation) {
distToMove = containerView.getMeasuredWidth() - x;
+ int duration = Math.max((int) (200.0f / containerView.getMeasuredWidth() * distToMove), 50);
animatorSet.playTogether(
- ObjectAnimator.ofFloat(containerView, View.TRANSLATION_X, containerView.getMeasuredWidth()),
- ObjectAnimator.ofFloat(this, "innerTranslationX", (float) containerView.getMeasuredWidth())
+ ObjectAnimator.ofFloat(containerView, View.TRANSLATION_X, containerView.getMeasuredWidth()).setDuration(duration),
+ ObjectAnimator.ofFloat(this, "innerTranslationX", (float) containerView.getMeasuredWidth()).setDuration(duration)
);
} else {
distToMove = x;
+ int duration = Math.max((int) (200.0f / containerView.getMeasuredWidth() * distToMove), 50);
animatorSet.playTogether(
- ObjectAnimator.ofFloat(containerView, View.TRANSLATION_X, 0),
- ObjectAnimator.ofFloat(this, "innerTranslationX", 0.0f)
+ ObjectAnimator.ofFloat(containerView, View.TRANSLATION_X, 0).setDuration(duration),
+ ObjectAnimator.ofFloat(this, "innerTranslationX", 0.0f).setDuration(duration)
);
}
- animatorSet.setDuration(Math.max((int) (200.0f / containerView.getMeasuredWidth() * distToMove), 50));
+ Animator customTransition = currentFragment.getCustomSlideTransition(false, backAnimation, distToMove);
+ if (customTransition != null) {
+ animatorSet.playTogether(customTransition);
+ }
+
+ BaseFragment lastFragment = fragmentsStack.get(fragmentsStack.size() - 2);
+ if (lastFragment != null) {
+ customTransition = lastFragment.getCustomSlideTransition(false, backAnimation, distToMove);
+ if (customTransition != null) {
+ animatorSet.playTogether(customTransition);
+ }
+ }
+
animatorSet.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animator) {
diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/ActionBarMenu.java b/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/ActionBarMenu.java
index 90da7b0fc..d3b548c6e 100644
--- a/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/ActionBarMenu.java
+++ b/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/ActionBarMenu.java
@@ -17,7 +17,6 @@ import android.widget.LinearLayout;
import org.telegram.messenger.AndroidUtilities;
import org.telegram.ui.Adapters.FiltersView;
import org.telegram.ui.Components.RLottieDrawable;
-import org.telegram.ui.Components.RLottieImageView;
public class ActionBarMenu extends LinearLayout {
diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/ActionBarMenuItem.java b/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/ActionBarMenuItem.java
index 7798d4de2..15018c518 100644
--- a/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/ActionBarMenuItem.java
+++ b/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/ActionBarMenuItem.java
@@ -1685,12 +1685,12 @@ public class ActionBarMenuItem extends FrameLayout {
avatarImageView.setImageDrawable(combinedDrawable);
} else {
avatarImageView.getImageReceiver().setRoundRadius(AndroidUtilities.dp(16));
- avatarImageView.getImageReceiver().setImage(ImageLocation.getForUser(user, false), "50_50", thumbDrawable, null, user, 0);
+ avatarImageView.getImageReceiver().setImage(ImageLocation.getForUserOrChat(user, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(user, ImageLocation.TYPE_STRIPPED), "50_50", thumbDrawable, user, 0);
}
} else if (data.chat instanceof TLRPC.Chat) {
TLRPC.Chat chat = (TLRPC.Chat) data.chat;
avatarImageView.getImageReceiver().setRoundRadius(AndroidUtilities.dp(16));
- avatarImageView.getImageReceiver().setImage(ImageLocation.getForChat(chat, false), "50_50",thumbDrawable, null, chat, 0);
+ avatarImageView.getImageReceiver().setImage(ImageLocation.getForUserOrChat(chat, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(chat, ImageLocation.TYPE_STRIPPED), "50_50", thumbDrawable, chat, 0);
}
} else if (data.filterType == FiltersView.FILTER_TYPE_ARCHIVE) {
CombinedDrawable combinedDrawable = Theme.createCircleDrawableWithIcon(AndroidUtilities.dp(32), R.drawable.chats_archive);
diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/AlertDialog.java b/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/AlertDialog.java
index f4d4b70f5..7775c20fc 100644
--- a/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/AlertDialog.java
+++ b/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/AlertDialog.java
@@ -68,6 +68,8 @@ public class AlertDialog extends Dialog implements Drawable.Callback {
private AnimatorSet[] shadowAnimation = new AnimatorSet[2];
private int customViewOffset = 20;
+ private String dialogButtonColorKey = Theme.key_dialogButton;
+
private OnCancelListener onCancelListener;
private AlertDialog cancelDialog;
@@ -728,13 +730,13 @@ public class AlertDialog extends Dialog implements Drawable.Callback {
textView.setMinWidth(AndroidUtilities.dp(64));
textView.setTag(Dialog.BUTTON_POSITIVE);
textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14);
- textView.setTextColor(getThemeColor(Theme.key_dialogButton));
+ textView.setTextColor(getThemeColor(dialogButtonColorKey));
textView.setGravity(Gravity.CENTER);
textView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
// textView.setLines(1);
// textView.setSingleLine(true); //TODO
textView.setText(positiveButtonText.toString().toUpperCase());
- textView.setBackgroundDrawable(Theme.getRoundRectSelectorDrawable(getThemeColor(Theme.key_dialogButton)));
+ textView.setBackgroundDrawable(Theme.getRoundRectSelectorDrawable(getThemeColor(dialogButtonColorKey)));
textView.setPadding(AndroidUtilities.dp(10), 0, AndroidUtilities.dp(10), 0);
if (verticalButtons) {
buttonsLayout.addView(textView, LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT, 36, LocaleController.isRTL ? Gravity.LEFT : Gravity.RIGHT));
@@ -768,13 +770,13 @@ public class AlertDialog extends Dialog implements Drawable.Callback {
textView.setMinWidth(AndroidUtilities.dp(64));
textView.setTag(Dialog.BUTTON_NEGATIVE);
textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14);
- textView.setTextColor(getThemeColor(Theme.key_dialogButton));
+ textView.setTextColor(getThemeColor(dialogButtonColorKey));
textView.setGravity(Gravity.CENTER);
textView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
textView.setEllipsize(TextUtils.TruncateAt.END);
textView.setSingleLine(true);
textView.setText(negativeButtonText.toString().toUpperCase());
- textView.setBackgroundDrawable(Theme.getRoundRectSelectorDrawable(getThemeColor(Theme.key_dialogButton)));
+ textView.setBackgroundDrawable(Theme.getRoundRectSelectorDrawable(getThemeColor(dialogButtonColorKey)));
textView.setPadding(AndroidUtilities.dp(10), 0, AndroidUtilities.dp(10), 0);
if (verticalButtons) {
buttonsLayout.addView(textView, 0, LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT, 36, LocaleController.isRTL ? Gravity.LEFT : Gravity.RIGHT));
@@ -808,13 +810,13 @@ public class AlertDialog extends Dialog implements Drawable.Callback {
textView.setMinWidth(AndroidUtilities.dp(64));
textView.setTag(Dialog.BUTTON_NEUTRAL);
textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14);
- textView.setTextColor(getThemeColor(Theme.key_dialogButton));
+ textView.setTextColor(getThemeColor(dialogButtonColorKey));
textView.setGravity(Gravity.CENTER);
textView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
textView.setEllipsize(TextUtils.TruncateAt.END);
textView.setSingleLine(true);
textView.setText(neutralButtonText.toString().toUpperCase());
- textView.setBackgroundDrawable(Theme.getRoundRectSelectorDrawable(getThemeColor(Theme.key_dialogButton)));
+ textView.setBackgroundDrawable(Theme.getRoundRectSelectorDrawable(getThemeColor(dialogButtonColorKey)));
textView.setPadding(AndroidUtilities.dp(10), 0, AndroidUtilities.dp(10), 0);
if (verticalButtons) {
buttonsLayout.addView(textView, 1, LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT, 36, LocaleController.isRTL ? Gravity.LEFT : Gravity.RIGHT));
@@ -1015,6 +1017,9 @@ public class AlertDialog extends Dialog implements Drawable.Callback {
@Override
public void dismiss() {
+ if (onDismissListener != null) {
+ onDismissListener.onDismiss(this);
+ }
if (cancelDialog != null) {
cancelDialog.dismiss();
}
@@ -1176,8 +1181,8 @@ public class AlertDialog extends Dialog implements Drawable.Callback {
private AlertDialog alertDialog;
- protected Builder(AlertDialog alert){
- alertDialog=alert;
+ protected Builder(AlertDialog alert) {
+ alertDialog = alert;
}
public Builder(Context context) {
@@ -1241,6 +1246,11 @@ public class AlertDialog extends Dialog implements Drawable.Callback {
return this;
}
+ public Builder setDialogButtonColorKey(String key) {
+ alertDialog.dialogButtonColorKey = key;
+ return this;
+ }
+
public Builder setTopAnimation(int resId, int backgroundColor) {
alertDialog.topAnimationId = resId;
alertDialog.topBackgroundColor = backgroundColor;
@@ -1329,5 +1339,10 @@ public class AlertDialog extends Dialog implements Drawable.Callback {
public void setButtonsVertical(boolean vertical) {
alertDialog.verticalButtons = vertical;
}
+
+ public Builder setOnPreDismissListener(OnDismissListener onDismissListener) {
+ alertDialog.onDismissListener = onDismissListener;
+ return this;
+ }
}
}
diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/BaseFragment.java b/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/BaseFragment.java
index 54dea6608..448d01bac 100644
--- a/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/BaseFragment.java
+++ b/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/BaseFragment.java
@@ -8,6 +8,7 @@
package org.telegram.ui.ActionBar;
+import android.animation.Animator;
import android.animation.AnimatorSet;
import android.app.Activity;
import android.app.Dialog;
@@ -46,7 +47,7 @@ import org.telegram.ui.Components.LayoutHelper;
import java.util.ArrayList;
-public class BaseFragment {
+public abstract class BaseFragment {
private boolean isFinished;
private boolean finishing;
@@ -327,6 +328,10 @@ public class BaseFragment {
}
+ public boolean isLastFragment() {
+ return parentLayout != null && !parentLayout.fragmentsStack.isEmpty() && parentLayout.fragmentsStack.get(parentLayout.fragmentsStack.size() - 1) == this;
+ }
+
public ActionBarLayout getParentLayout() {
return parentLayout;
}
@@ -411,6 +416,10 @@ public class BaseFragment {
}
}
+ protected void onSlideProgress(boolean isOpen, float progress) {
+
+ }
+
protected void onTransitionAnimationProgress(boolean isOpen, float progress) {
}
@@ -597,4 +606,16 @@ public class BaseFragment {
public void saveKeyboardPositionBeforeTransition() {
}
+
+ protected Animator getCustomSlideTransition(boolean topFragment, boolean backAnimation, float distanceToMove) {
+ return null;
+ }
+
+ protected void prepareFragmentToSlide(boolean topFragment, boolean beginSlide) {
+
+ }
+
+ public void setProgressToDrawerOpened(float v) {
+
+ }
}
diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/BottomSheet.java b/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/BottomSheet.java
index 214b35589..7ee178602 100644
--- a/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/BottomSheet.java
+++ b/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/BottomSheet.java
@@ -58,6 +58,7 @@ import org.telegram.ui.Components.AnimationProperties;
import org.telegram.ui.Components.Bulletin;
import org.telegram.ui.Components.CubicBezierInterpolator;
import org.telegram.ui.Components.LayoutHelper;
+import org.telegram.ui.LaunchActivity;
import java.util.ArrayList;
@@ -107,6 +108,8 @@ public class BottomSheet extends Dialog {
private boolean allowCustomAnimation = true;
private boolean showWithoutAnimation;
+ protected int statusBarHeight = AndroidUtilities.statusBarHeight;
+
protected boolean calcMandatoryInsets;
private int touchSlop;
@@ -766,6 +769,10 @@ public class BottomSheet extends Dialog {
if (Build.VERSION.SDK_INT >= 21) {
container.setFitsSystemWindows(true);
container.setOnApplyWindowInsetsListener((v, insets) -> {
+ int newTopInset = insets.getSystemWindowInsetTop();
+ if ((newTopInset != 0 || AndroidUtilities.isInMultiwindow) && statusBarHeight != 0 && statusBarHeight != newTopInset) {
+ statusBarHeight = newTopInset;
+ }
lastInsets = insets;
v.requestLayout();
if (Build.VERSION.SDK_INT >= 30) {
diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/DrawerLayoutContainer.java b/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/DrawerLayoutContainer.java
index 7989b6833..38d0ce579 100644
--- a/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/DrawerLayoutContainer.java
+++ b/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/DrawerLayoutContainer.java
@@ -193,6 +193,14 @@ public class DrawerLayoutContainer extends FrameLayout {
if (drawerLayout.getVisibility() != newVisibility) {
drawerLayout.setVisibility(newVisibility);
}
+ BaseFragment currentFragment = parentActionBarLayout.fragmentsStack.get(0);
+ if (drawerPosition == drawerLayout.getMeasuredWidth()) {
+ currentFragment.setProgressToDrawerOpened(1f);
+ } else if (drawerPosition == 0){
+ currentFragment.setProgressToDrawerOpened(0);
+ } else {
+ currentFragment.setProgressToDrawerOpened(drawerPosition / drawerLayout.getMeasuredWidth());
+ }
setScrimOpacity(drawerPosition / (float) drawerLayout.getMeasuredWidth());
}
diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/SimpleTextView.java b/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/SimpleTextView.java
index bd8f3e4db..a6387e11f 100644
--- a/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/SimpleTextView.java
+++ b/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/SimpleTextView.java
@@ -27,6 +27,8 @@ import android.view.Gravity;
import android.view.View;
import android.view.accessibility.AccessibilityNodeInfo;
+import com.google.android.exoplayer2.util.Log;
+
import org.telegram.messenger.AndroidUtilities;
import org.telegram.messenger.LocaleController;
import org.telegram.ui.Components.EmptyStubSpan;
@@ -79,7 +81,7 @@ public class SimpleTextView extends View implements Drawable.Callback {
private static final int SCROLL_SLOWDOWN_PX = 100;
private int fullLayoutAdditionalWidth;
private int fullLayoutLeftOffset;
- private boolean crosfadeFullLayout;
+ private float fullLayoutLeftCharactersOffset;
public SimpleTextView(Context context) {
super(context);
@@ -186,19 +188,15 @@ public class SimpleTextView extends View implements Drawable.Callback {
}
if ((gravity & Gravity.HORIZONTAL_GRAVITY_MASK) == Gravity.CENTER_HORIZONTAL) {
- offsetX = (width - textWidth) / 2;
+ offsetX = (width - textWidth) / 2 - (int) layout.getLineLeft(0);
} else if ((gravity & Gravity.HORIZONTAL_GRAVITY_MASK) == Gravity.LEFT) {
- if (crosfadeFullLayout) {
- offsetX = 0;
- } else if (firstLineLayout != null) {
+ if (firstLineLayout != null) {
offsetX = -(int) firstLineLayout.getLineLeft(0);
} else {
offsetX = -(int) layout.getLineLeft(0);
}
} else if (layout.getLineLeft(0) == 0) {
- if (crosfadeFullLayout) {
- offsetX = 0;
- } else if (firstLineLayout != null) {
+ if (firstLineLayout != null) {
offsetX = (int) (width - firstLineLayout.getLineWidth(0));
} else {
offsetX = width - textWidth;
@@ -208,6 +206,10 @@ public class SimpleTextView extends View implements Drawable.Callback {
}
offsetX += getPaddingLeft();
textDoesNotFit = textWidth > width;
+
+ if (fullLayout != null && fullLayoutAdditionalWidth > 0) {
+ fullLayoutLeftCharactersOffset = fullLayout.getPrimaryHorizontal(0) - firstLineLayout.getPrimaryHorizontal(0);
+ }
}
}
@@ -223,38 +225,30 @@ public class SimpleTextView extends View implements Drawable.Callback {
width -= dw;
width -= drawablePadding;
}
- crosfadeFullLayout = false;
if (buildFullLayout) {
CharSequence string = TextUtils.ellipsize(text, textPaint, width, TextUtils.TruncateAt.END);
if (!string.equals(text)) {
fullLayout = StaticLayoutEx.createStaticLayout(text, 0, text.length(), textPaint, width, Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false, TextUtils.TruncateAt.END, width, 3, false);
if (fullLayout != null) {
- if (LocaleController.isRTL || fullLayout.isRtlCharAt(0) && fullLayoutAdditionalWidth != 0) {
- layout = StaticLayoutEx.createStaticLayout(text, 0, text.length(), textPaint, width + AndroidUtilities.dp(8), Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false, TextUtils.TruncateAt.END, width, maxLines, false);
- fullLayout = StaticLayoutEx.createStaticLayout(text, 0, text.length(), textPaint, width + fullLayoutAdditionalWidth, Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false, TextUtils.TruncateAt.END, width + fullLayoutAdditionalWidth, 3, false);
- partLayout = null;
- firstLineLayout = null;
- crosfadeFullLayout = true;
+
+ int end = fullLayout.getLineEnd(0);
+ int start = fullLayout.getLineStart(1);
+ CharSequence substr = text.subSequence(0, end);
+ SpannableStringBuilder full = SpannableStringBuilder.valueOf(text);
+ full.setSpan(new EmptyStubSpan(), 0, start, 0);
+ CharSequence part;
+ if (end < string.length()) {
+ part = string.subSequence(end, string.length());
} else {
- int end = fullLayout.getLineEnd(0);
- int start = fullLayout.getLineStart(1);
- CharSequence substr = text.subSequence(0, end);
- SpannableStringBuilder full = SpannableStringBuilder.valueOf(text);
- full.setSpan(new EmptyStubSpan(), 0, start, 0);
- CharSequence part;
- if (end < string.length()) {
- part = string.subSequence(end, string.length());
- } else {
- part = "…";
- }
- firstLineLayout = new StaticLayout(string, 0, string.length(), textPaint, scrollNonFitText ? AndroidUtilities.dp(2000) : width + AndroidUtilities.dp(8), Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false);
- layout = new StaticLayout(substr, 0, substr.length(), textPaint, scrollNonFitText ? AndroidUtilities.dp(2000) : width + AndroidUtilities.dp(8), Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false);
- if (layout.getLineLeft(0) != 0) {
- part = "\u200F" + part;
- }
- partLayout = new StaticLayout(part, 0, part.length(), textPaint, scrollNonFitText ? AndroidUtilities.dp(2000) : width + AndroidUtilities.dp(8), Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false);
- fullLayout = StaticLayoutEx.createStaticLayout(full, 0, full.length(), textPaint, width + fullLayoutAdditionalWidth, Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false, TextUtils.TruncateAt.END, width + fullLayoutAdditionalWidth, 3, false);
+ part = "…";
}
+ firstLineLayout = new StaticLayout(string, 0, string.length(), textPaint, scrollNonFitText ? AndroidUtilities.dp(2000) : width + AndroidUtilities.dp(8), Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false);
+ layout = new StaticLayout(substr, 0, substr.length(), textPaint, scrollNonFitText ? AndroidUtilities.dp(2000) : width + AndroidUtilities.dp(8), Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false);
+ if (layout.getLineLeft(0) != 0) {
+ part = "\u200F" + part;
+ }
+ partLayout = new StaticLayout(part, 0, part.length(), textPaint, scrollNonFitText ? AndroidUtilities.dp(2000) : width + AndroidUtilities.dp(8), Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false);
+ fullLayout = StaticLayoutEx.createStaticLayout(full, 0, full.length(), textPaint, width + AndroidUtilities.dp(8) + fullLayoutAdditionalWidth, Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false, TextUtils.TruncateAt.END, width + fullLayoutAdditionalWidth, 3, false);
}
} else {
layout = new StaticLayout(string, 0, string.length(), textPaint, scrollNonFitText ? AndroidUtilities.dp(2000) : width + AndroidUtilities.dp(8), Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false);
@@ -579,7 +573,7 @@ public class SimpleTextView extends View implements Drawable.Callback {
} else {
canvas.translate(layout.getLineWidth(0) - (partLayout.getText().length() == 1 ? AndroidUtilities.dp(4) : 0), 0);
}
- canvas.translate(-fullLayoutLeftOffset * fullAlpha, 0);
+ canvas.translate(-fullLayoutLeftOffset * fullAlpha + fullLayoutLeftCharactersOffset * fullAlpha, 0);
partLayout.draw(canvas);
canvas.restore();
textPaint.setAlpha(prevAlpha);
@@ -588,10 +582,7 @@ public class SimpleTextView extends View implements Drawable.Callback {
int prevAlpha = textPaint.getAlpha();
textPaint.setAlpha((int) (255 * fullAlpha));
- if (layout.getLineLeft(0) != 0) {
- canvas.translate(-offsetX, 0);
- }
- canvas.translate(-fullLayoutLeftOffset * fullAlpha, 0);
+ canvas.translate(-fullLayoutLeftOffset * fullAlpha + fullLayoutLeftCharactersOffset * fullAlpha - fullLayoutLeftCharactersOffset, 0);
fullLayout.draw(canvas);
textPaint.setAlpha(prevAlpha);
}
@@ -625,17 +616,9 @@ public class SimpleTextView extends View implements Drawable.Callback {
}
private void drawLayout(Canvas canvas) {
- if (crosfadeFullLayout && fullAlpha > 0) {
- int prevAlpha = textPaint.getAlpha();
- textPaint.setAlpha((int) (255 * (1f - fullAlpha)));
+ if (fullAlpha > 0 && fullLayoutLeftOffset != 0) {
canvas.save();
- canvas.translate(-fullLayoutLeftOffset * fullAlpha, 0);
- layout.draw(canvas);
- textPaint.setAlpha(prevAlpha);
- canvas.restore();
- } else if (fullAlpha > 0 && fullLayoutLeftOffset != 0) {
- canvas.save();
- canvas.translate(-fullLayoutLeftOffset * fullAlpha, 0);
+ canvas.translate(-fullLayoutLeftOffset * fullAlpha + fullLayoutLeftCharactersOffset * fullAlpha, 0);
layout.draw(canvas);
canvas.restore();
} else {
@@ -703,6 +686,9 @@ public class SimpleTextView extends View implements Drawable.Callback {
this.fullLayoutLeftOffset = fullLayoutLeftOffset;
createLayout(getMeasuredWidth());
}
+ }
+ public int getTextColor() {
+ return textPaint.getColor();
}
}
diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/Theme.java b/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/Theme.java
index 367cafc40..3f21352f7 100644
--- a/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/Theme.java
+++ b/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/Theme.java
@@ -2172,6 +2172,7 @@ public class Theme {
public static Drawable chat_replyIconDrawable;
public static Drawable chat_goIconDrawable;
public static Drawable chat_botLinkDrawalbe;
+ public static Drawable chat_botCardDrawalbe;
public static Drawable chat_botInlineDrawable;
public static Drawable chat_systemDrawable;
public static Drawable chat_commentDrawable;
@@ -7202,6 +7203,7 @@ public class Theme {
chat_botLinkDrawalbe = resources.getDrawable(R.drawable.bot_link);
chat_botInlineDrawable = resources.getDrawable(R.drawable.bot_lines);
+ chat_botCardDrawalbe = resources.getDrawable(R.drawable.bot_card);
chat_commentDrawable = resources.getDrawable(R.drawable.msg_msgbubble);
chat_commentStickerDrawable = resources.getDrawable(R.drawable.msg_msgbubble2);
diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Adapters/DialogsAdapter.java b/TMessagesProj/src/main/java/org/telegram/ui/Adapters/DialogsAdapter.java
index d958a19c8..28b4661cb 100644
--- a/TMessagesProj/src/main/java/org/telegram/ui/Adapters/DialogsAdapter.java
+++ b/TMessagesProj/src/main/java/org/telegram/ui/Adapters/DialogsAdapter.java
@@ -204,8 +204,6 @@ public class DialogsAdapter extends RecyclerListView.SelectionAdapter {
if (folderId == 0 && onlineContacts != null) {
if (!hasContacts) {
onlineContacts = null;
- } else {
- MessagesController.getInstance(currentAccount).preloadGreetingsSticker();
}
}
if (folderId == 1 && showArchiveHint) {
@@ -508,12 +506,6 @@ public class DialogsAdapter extends RecyclerListView.SelectionAdapter {
}
cell.setChecked(selectedDialogs.contains(dialog.id), false);
cell.setDialog(dialog, dialogsType, folderId);
- if ((int) dialog.id > 0) {
- MessageObject message = MessagesController.getInstance(currentAccount).dialogMessage.get(dialog.id);
- if (MessageObject.isSystemSignUp(message)) {
- MessagesController.getInstance(currentAccount).preloadGreetingsSticker();
- }
- }
if (preloader != null && i < 10) {
preloader.add(dialog.id);
}
diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Adapters/DrawerLayoutAdapter.java b/TMessagesProj/src/main/java/org/telegram/ui/Adapters/DrawerLayoutAdapter.java
index 79ecc9a16..ef6bc038c 100644
--- a/TMessagesProj/src/main/java/org/telegram/ui/Adapters/DrawerLayoutAdapter.java
+++ b/TMessagesProj/src/main/java/org/telegram/ui/Adapters/DrawerLayoutAdapter.java
@@ -304,7 +304,7 @@ public class DrawerLayoutAdapter extends RecyclerListView.SelectionAdapter {
items.add(new Item(8, LocaleController.getString("Settings", R.string.Settings), settingsIcon));
items.add(null); // divider
items.add(new Item(7, LocaleController.getString("InviteFriends", R.string.InviteFriends), inviteIcon));
- items.add(new Item(9, LocaleController.getString("TelegramFAQ", R.string.TelegramFAQ), helpIcon));
+ items.add(new Item(13, LocaleController.getString("TelegramFeatures", R.string.TelegramFeatures), helpIcon));
}
public int getId(int position) {
diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Adapters/FiltersView.java b/TMessagesProj/src/main/java/org/telegram/ui/Adapters/FiltersView.java
index cbbf4cff1..4e4b52869 100644
--- a/TMessagesProj/src/main/java/org/telegram/ui/Adapters/FiltersView.java
+++ b/TMessagesProj/src/main/java/org/telegram/ui/Adapters/FiltersView.java
@@ -40,7 +40,6 @@ import org.telegram.ui.Components.CombinedDrawable;
import org.telegram.ui.Components.LayoutHelper;
import org.telegram.ui.Components.RecyclerListView;
-import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.LocalDateTime;
@@ -49,7 +48,6 @@ import java.time.format.DateTimeFormatter;
import java.time.format.DateTimeParseException;
import java.util.ArrayList;
import java.util.Calendar;
-import java.util.Date;
import java.util.GregorianCalendar;
import java.util.Locale;
import java.util.regex.Matcher;
@@ -730,12 +728,12 @@ public class FiltersView extends RecyclerListView {
avatarImageView.setImageDrawable(combinedDrawable);
} else {
avatarImageView.getImageReceiver().setRoundRadius(AndroidUtilities.dp(16));
- avatarImageView.getImageReceiver().setImage(ImageLocation.getForUser(user, false), "50_50", thumbDrawable, null, user, 0);
+ avatarImageView.getImageReceiver().setImage(ImageLocation.getForUserOrChat(user, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(user, ImageLocation.TYPE_STRIPPED), "50_50", thumbDrawable, user, 0);
}
} else if (data.chat instanceof TLRPC.Chat) {
TLRPC.Chat chat = (TLRPC.Chat) data.chat;
avatarImageView.getImageReceiver().setRoundRadius(AndroidUtilities.dp(16));
- avatarImageView.getImageReceiver().setImage(ImageLocation.getForChat(chat, false), "50_50", thumbDrawable, null, chat, 0);
+ avatarImageView.getImageReceiver().setImage(ImageLocation.getForUserOrChat(chat, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(chat, ImageLocation.TYPE_STRIPPED), "50_50", thumbDrawable, chat, 0);
}
} else {
avatarImageView.setImageDrawable(thumbDrawable);
diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ArticleViewer.java b/TMessagesProj/src/main/java/org/telegram/ui/ArticleViewer.java
index 9a975dd7d..f3464151a 100644
--- a/TMessagesProj/src/main/java/org/telegram/ui/ArticleViewer.java
+++ b/TMessagesProj/src/main/java/org/telegram/ui/ArticleViewer.java
@@ -290,6 +290,8 @@ public class ArticleViewer implements NotificationCenter.NotificationCenterDeleg
TextSelectionHelper.ArticleTextSelectionHelper textSelectionHelper;
TextSelectionHelper.ArticleTextSelectionHelper textSelectionHelperBottomSheet;
+ PinchToZoomHelper pinchToZoomHelper;
+
private int allowAnimationIndex = -1;
private final String BOTTOM_SHEET_VIEW_TAG = "bottomSheet";
@@ -707,6 +709,10 @@ public class ArticleViewer implements NotificationCenter.NotificationCenterDeleg
@Override
public boolean dispatchTouchEvent(MotionEvent ev) {
+ if (pinchToZoomHelper.isInOverlayMode()) {
+ ev.offsetLocation(-containerView.getX(), -containerView.getY());
+ return pinchToZoomHelper.onTouchEvent(ev);
+ }
TextSelectionHelper.TextSelectionOverlay selectionOverlay = textSelectionHelper.getOverlayView(getContext());
MotionEvent textSelectionEv = MotionEvent.obtain(ev);
textSelectionEv.offsetLocation(-containerView.getX(), -containerView.getY());
@@ -3657,6 +3663,22 @@ public class ArticleViewer implements NotificationCenter.NotificationCenterDeleg
});
containerView.addView(textSelectionHelper.getOverlayView(activity));
+ pinchToZoomHelper = new PinchToZoomHelper(containerView);
+ pinchToZoomHelper.setClipBoundsListener(new PinchToZoomHelper.ClipBoundsListener() {
+ @Override
+ public void getClipTopBottom(float[] topBottom) {
+ topBottom[0] = currentHeaderHeight;
+ topBottom[1] = listView[0].getMeasuredHeight();
+ }
+ });
+ pinchToZoomHelper.setCallback(new PinchToZoomHelper.Callback() {
+ @Override
+ public void onZoomStarted(MessageObject messageObject) {
+ if (listView[0] != null) {
+ listView[0].cancelClickRunnables(true);
+ }
+ }
+ });
updatePaintColors();
}
@@ -5952,6 +5974,9 @@ public class ArticleViewer implements NotificationCenter.NotificationCenterDeleg
@Override
public boolean onTouchEvent(MotionEvent event) {
+ if (pinchToZoomHelper.checkPinchToZoom(event, this, imageView, null)) {
+ return true;
+ }
float x = event.getX();
float y = event.getY();
if (channelCell.getVisibility() == VISIBLE && y > channelCell.getTranslationY() && y < channelCell.getTranslationY() + AndroidUtilities.dp(39)) {
@@ -6118,9 +6143,11 @@ public class ArticleViewer implements NotificationCenter.NotificationCenterDeleg
if (!imageView.hasBitmapImage() || imageView.getCurrentAlpha() != 1.0f) {
canvas.drawRect(imageView.getDrawRegion(), photoBackgroundPaint);
}
- imageView.draw(canvas);
- if (imageView.getVisible()) {
- radialProgress.draw(canvas);
+ if (!pinchToZoomHelper.isInOverlayModeFor(this)) {
+ imageView.draw(canvas);
+ if (imageView.getVisible()) {
+ radialProgress.draw(canvas);
+ }
}
int count = 0;
if (captionLayout != null) {
@@ -9831,6 +9858,9 @@ public class ArticleViewer implements NotificationCenter.NotificationCenterDeleg
@Override
public boolean onTouchEvent(MotionEvent event) {
+ if (pinchToZoomHelper.checkPinchToZoom(event, this, imageView, null)) {
+ return true;
+ }
float x = event.getX();
float y = event.getY();
if (channelCell.getVisibility() == VISIBLE && y > channelCell.getTranslationY() && y < channelCell.getTranslationY() + AndroidUtilities.dp(39)) {
@@ -9992,9 +10022,11 @@ public class ArticleViewer implements NotificationCenter.NotificationCenterDeleg
if (!imageView.hasBitmapImage() || imageView.getCurrentAlpha() != 1.0f) {
canvas.drawRect(imageView.getImageX(), imageView.getImageY(), imageView.getImageX2(), imageView.getImageY2(), photoBackgroundPaint);
}
- imageView.draw(canvas);
- if (imageView.getVisible()) {
- radialProgress.draw(canvas);
+ if (!pinchToZoomHelper.isInOverlayModeFor(this)) {
+ imageView.draw(canvas);
+ if (imageView.getVisible()) {
+ radialProgress.draw(canvas);
+ }
}
if (!TextUtils.isEmpty(currentBlock.url)) {
int x = getMeasuredWidth() - AndroidUtilities.dp(11 + 24);
diff --git a/TMessagesProj/src/main/java/org/telegram/ui/AvatarPreviewer.java b/TMessagesProj/src/main/java/org/telegram/ui/AvatarPreviewer.java
index 67fd91bb7..3d9eceb18 100644
--- a/TMessagesProj/src/main/java/org/telegram/ui/AvatarPreviewer.java
+++ b/TMessagesProj/src/main/java/org/telegram/ui/AvatarPreviewer.java
@@ -163,15 +163,15 @@ public class AvatarPreviewer {
public static class Data {
public static Data of(TLRPC.User user, int classGuid, MenuItem... menuItems) {
- final ImageLocation imageLocation = ImageLocation.getForUser(user, true);
- final ImageLocation thumbImageLocation = ImageLocation.getForUser(user, false);
+ final ImageLocation imageLocation = ImageLocation.getForUserOrChat(user, ImageLocation.TYPE_BIG);
+ final ImageLocation thumbImageLocation = ImageLocation.getForUserOrChat(user, ImageLocation.TYPE_SMALL);
final String thumbFilter = thumbImageLocation != null && thumbImageLocation.photoSize instanceof TLRPC.TL_photoStrippedSize ? "b" : null;
return new Data(imageLocation, thumbImageLocation, null, null, thumbFilter, null, null, user, menuItems, new UserInfoLoadTask(user, classGuid));
}
public static Data of(TLRPC.UserFull userFull, MenuItem... menuItems) {
- final ImageLocation imageLocation = ImageLocation.getForUser(userFull.user, true);
- final ImageLocation thumbImageLocation = ImageLocation.getForUser(userFull.user, false);
+ final ImageLocation imageLocation = ImageLocation.getForUserOrChat(userFull.user, ImageLocation.TYPE_BIG);
+ final ImageLocation thumbImageLocation = ImageLocation.getForUserOrChat(userFull.user, ImageLocation.TYPE_SMALL);
final String thumbFilter = thumbImageLocation != null && thumbImageLocation.photoSize instanceof TLRPC.TL_photoStrippedSize ? "b" : null;
final ImageLocation videoLocation;
final String videoFileName;
@@ -188,15 +188,15 @@ public class AvatarPreviewer {
}
public static Data of(TLRPC.Chat chat, int classGuid, MenuItem... menuItems) {
- final ImageLocation imageLocation = ImageLocation.getForChat(chat, true);
- final ImageLocation thumbImageLocation = ImageLocation.getForChat(chat, false);
+ final ImageLocation imageLocation = ImageLocation.getForUserOrChat(chat, ImageLocation.TYPE_BIG);
+ final ImageLocation thumbImageLocation = ImageLocation.getForUserOrChat(chat, ImageLocation.TYPE_SMALL);
final String thumbFilter = thumbImageLocation != null && thumbImageLocation.photoSize instanceof TLRPC.TL_photoStrippedSize ? "b" : null;
return new Data(imageLocation, thumbImageLocation, null, null, thumbFilter, null, null, chat, menuItems, new ChatInfoLoadTask(chat, classGuid));
}
public static Data of(TLRPC.Chat chat, TLRPC.ChatFull chatFull, MenuItem... menuItems) {
- final ImageLocation imageLocation = ImageLocation.getForChat(chat, true);
- final ImageLocation thumbImageLocation = ImageLocation.getForChat(chat, false);
+ final ImageLocation imageLocation = ImageLocation.getForUserOrChat(chat, ImageLocation.TYPE_BIG);
+ final ImageLocation thumbImageLocation = ImageLocation.getForUserOrChat(chat, ImageLocation.TYPE_SMALL);
final String thumbFilter = thumbImageLocation != null && thumbImageLocation.photoSize instanceof TLRPC.TL_photoStrippedSize ? "b" : null;
final ImageLocation videoLocation;
final String videoFileName;
diff --git a/TMessagesProj/src/main/java/org/telegram/ui/CancelAccountDeletionActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/CancelAccountDeletionActivity.java
index 5ca7406f5..8daa702c2 100644
--- a/TMessagesProj/src/main/java/org/telegram/ui/CancelAccountDeletionActivity.java
+++ b/TMessagesProj/src/main/java/org/telegram/ui/CancelAccountDeletionActivity.java
@@ -25,6 +25,7 @@ import android.graphics.PorterDuff;
import android.graphics.PorterDuffColorFilter;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
+import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.telephony.PhoneNumberUtils;
@@ -553,8 +554,8 @@ public class CancelAccountDeletionActivity extends BaseFragment {
PackageInfo pInfo = ApplicationLoader.applicationContext.getPackageManager().getPackageInfo(ApplicationLoader.applicationContext.getPackageName(), 0);
String version = String.format(Locale.US, "%s (%d)", pInfo.versionName, pInfo.versionCode);
- Intent mailer = new Intent(Intent.ACTION_SEND);
- mailer.setType("message/rfc822");
+ Intent mailer = new Intent(Intent.ACTION_SENDTO);
+ mailer.setData(Uri.parse("mailto:"));
mailer.putExtra(Intent.EXTRA_EMAIL, new String[]{"sms@stel.com"});
mailer.putExtra(Intent.EXTRA_SUBJECT, "Android cancel account deletion issue " + version + " " + phone);
mailer.putExtra(Intent.EXTRA_TEXT, "Phone: " + phone + "\nApp version: " + version + "\nOS version: SDK " + Build.VERSION.SDK_INT + "\nDevice Name: " + Build.MANUFACTURER + Build.MODEL + "\nLocale: " + Locale.getDefault() + "\nError: " + lastError);
diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Cells/AccountSelectCell.java b/TMessagesProj/src/main/java/org/telegram/ui/Cells/AccountSelectCell.java
index 6dc5efb73..b770c86e7 100644
--- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/AccountSelectCell.java
+++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/AccountSelectCell.java
@@ -110,12 +110,12 @@ public class AccountSelectCell extends FrameLayout {
TLRPC.User user = (TLRPC.User) object;
avatarDrawable.setInfo(user);
infoTextView.setText(ContactsController.formatName(user.first_name, user.last_name));
- imageView.setImage(ImageLocation.getForUser(user, false), "50_50", avatarDrawable, user);
+ imageView.setImage(ImageLocation.getForUserOrChat(user, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(user, ImageLocation.TYPE_STRIPPED), "50_50", avatarDrawable, user);
} else {
TLRPC.Chat chat = (TLRPC.Chat) object;
avatarDrawable.setInfo(chat);
infoTextView.setText(chat.title);
- imageView.setImage(ImageLocation.getForChat(chat, false), "50_50", avatarDrawable, chat);
+ imageView.setImage(ImageLocation.getForUserOrChat(chat, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(chat, ImageLocation.TYPE_STRIPPED), "50_50", avatarDrawable, chat);
}
}
@@ -125,7 +125,7 @@ public class AccountSelectCell extends FrameLayout {
avatarDrawable.setInfo(user);
textView.setText(ContactsController.formatName(user.first_name, user.last_name));
imageView.getImageReceiver().setCurrentAccount(account);
- imageView.setImage(ImageLocation.getForUser(user,false), "50_50", avatarDrawable, user);
+ imageView.setImage(ImageLocation.getForUserOrChat(user,ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(user, ImageLocation.TYPE_STRIPPED), "50_50", avatarDrawable, user);
checkImageView.setVisibility(check && account == UserConfig.selectedAccount ? VISIBLE : INVISIBLE);
}
diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Cells/AdminedChannelCell.java b/TMessagesProj/src/main/java/org/telegram/ui/Cells/AdminedChannelCell.java
index 833781d5d..f5fc04de1 100644
--- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/AdminedChannelCell.java
+++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/AdminedChannelCell.java
@@ -81,7 +81,7 @@ public class AdminedChannelCell extends FrameLayout {
SpannableStringBuilder stringBuilder = new SpannableStringBuilder(url + channel.username);
stringBuilder.setSpan(new URLSpanNoUnderline(""), url.length(), stringBuilder.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
statusTextView.setText(stringBuilder);
- avatarImageView.setImage(ImageLocation.getForChat(channel, false), "50_50", avatarDrawable, currentChannel);
+ avatarImageView.setImage(ImageLocation.getForUserOrChat(channel, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(channel, ImageLocation.TYPE_STRIPPED), "50_50", avatarDrawable, currentChannel);
isLast = last;
}
diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatMessageCell.java b/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatMessageCell.java
index a94138042..a53acbce7 100644
--- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatMessageCell.java
+++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatMessageCell.java
@@ -126,6 +126,7 @@ import org.telegram.ui.Components.URLSpanBrowser;
import org.telegram.ui.Components.URLSpanMono;
import org.telegram.ui.Components.URLSpanNoUnderline;
import org.telegram.ui.PhotoViewer;
+import org.telegram.ui.PinchToZoomHelper;
import org.telegram.ui.SecretMediaViewer;
import java.io.File;
@@ -257,6 +258,11 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
default boolean shouldDrawThreadProgress(ChatMessageCell cell) {
return false;
}
+
+ default PinchToZoomHelper getPinchToZoomHelper() {
+ return null;
+ }
+
}
private final static int DOCUMENT_ATTACH_TYPE_NONE = 0;
@@ -775,6 +781,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
};
private SparseArray accessibilityVirtualViewBounds = new SparseArray<>();
private int currentFocusedVirtualView = -1;
+ public boolean drawFromPinchToZoom;
public ChatMessageCell(Context context) {
super(context);
@@ -1930,6 +1937,9 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
boolean result = checkTextBlockMotionEvent(event);
+ if (!result) {
+ result = checkPinchToZoom(event);
+ }
if (!result) {
result = checkDateMotionEvent(event);
}
@@ -2196,6 +2206,17 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
return result;
}
+
+ private boolean checkPinchToZoom(MotionEvent ev) {
+ PinchToZoomHelper pinchToZoomHelper = delegate == null ? null : delegate.getPinchToZoomHelper();
+ if (currentMessageObject == null || !photoImage.hasNotThumb() || pinchToZoomHelper == null || currentMessageObject.isSticker() ||
+ currentMessageObject.isAnimatedEmoji() || (currentMessageObject.isVideo() && !autoPlayingMedia) ||
+ currentMessageObject.isRoundVideo() || currentMessageObject.isAnimatedSticker() || (currentMessageObject.isDocument() && !currentMessageObject.isGif()) || currentMessageObject.needDrawBluredPreview()) {
+ return false;
+ }
+ return pinchToZoomHelper.checkPinchToZoom(ev, this, photoImage, currentMessageObject);
+ }
+
private boolean checkTextSelection(MotionEvent event) {
TextSelectionHelper.ChatListTextSelectionHelper textSelectionHelper = delegate.getTextSelectionHelper();
if (textSelectionHelper == null) {
@@ -3144,10 +3165,10 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
}
if (user != null) {
commentAvatarDrawables[a].setInfo(user);
- commentAvatarImages[a].setImage(ImageLocation.getForUser(user, false), "50_50", commentAvatarDrawables[a], null, user, 0);
+ commentAvatarImages[a].setImage(ImageLocation.getForUserOrChat(user, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(chat, ImageLocation.TYPE_STRIPPED), "50_50", commentAvatarDrawables[a], user, 0);
} else if (chat != null) {
commentAvatarDrawables[a].setInfo(chat);
- commentAvatarImages[a].setImage(ImageLocation.getForChat(chat, false), "50_50", commentAvatarDrawables[a], null, chat, 0);
+ commentAvatarImages[a].setImage(ImageLocation.getForUserOrChat(chat, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(chat, ImageLocation.TYPE_STRIPPED), "50_50", commentAvatarDrawables[a], chat, 0);
} else {
commentAvatarDrawables[a].setInfo(id, "", "");
}
@@ -3236,9 +3257,9 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
hasInvoicePreview = messageObject.messageOwner.media instanceof TLRPC.TL_messageMediaInvoice;
hasLinkPreview = !messageObject.isRestrictedMessage && messageObject.messageOwner.media instanceof TLRPC.TL_messageMediaWebPage && messageObject.messageOwner.media.webpage instanceof TLRPC.TL_webPage;
drawInstantView = hasLinkPreview && messageObject.messageOwner.media.webpage.cached_page != null;
- hasEmbed = hasLinkPreview && !TextUtils.isEmpty(messageObject.messageOwner.media.webpage.embed_url) && !messageObject.isGif();
- boolean slideshow = false;
String siteName = hasLinkPreview ? messageObject.messageOwner.media.webpage.site_name : null;
+ hasEmbed = hasLinkPreview && !TextUtils.isEmpty(messageObject.messageOwner.media.webpage.embed_url) && !messageObject.isGif() && !"instangram".equalsIgnoreCase(siteName);
+ boolean slideshow = false;
String webpageType = hasLinkPreview ? messageObject.messageOwner.media.webpage.type : null;
TLRPC.Document androidThemeDocument = null;
TLRPC.TL_themeSettings androidThemeSettings = null;
@@ -3908,8 +3929,21 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
width = height = maxPhotoWidth;
} else {
if (hasGamePreview || hasInvoicePreview) {
- width = 640;
- height = 360;
+ if (hasInvoicePreview) {
+ width = 640;
+ height = 360;
+ for (int a = 0, N = webDocument.attributes.size(); a < N; a++) {
+ TLRPC.DocumentAttribute attribute = webDocument.attributes.get(a);
+ if (attribute instanceof TLRPC.TL_documentAttributeImageSize) {
+ width = attribute.w;
+ height = attribute.h;
+ break;
+ }
+ }
+ } else {
+ width = 640;
+ height = 360;
+ }
float scale = width / (float) (maxPhotoWidth - AndroidUtilities.dp(2));
width /= scale;
height /= scale;
@@ -4202,7 +4236,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
} else {
hasName = false;
}
- photoImage.setImage(ImageLocation.getForUser(user, false), "50_50", hasName ? contactAvatarDrawable : Theme.chat_contactDrawable[messageObject.isOutOwner() ? 1 : 0], null, messageObject, 0);
+ photoImage.setImage(ImageLocation.getForUserOrChat(user, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(user, ImageLocation.TYPE_STRIPPED), "50_50", hasName ? contactAvatarDrawable : Theme.chat_contactDrawable[messageObject.isOutOwner() ? 1 : 0], messageObject, 0);
CharSequence phone;
if (!TextUtils.isEmpty(messageObject.vCardData)) {
@@ -4394,7 +4428,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
TLRPC.User user = MessagesController.getInstance(currentAccount).getUser(id);
if (user != null) {
pollAvatarDrawables[a].setInfo(user);
- pollAvatarImages[a].setImage(ImageLocation.getForUser(user, false), "50_50", pollAvatarDrawables[a], null, user, 0);
+ pollAvatarImages[a].setImage(ImageLocation.getForUserOrChat(user, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(user, ImageLocation.TYPE_STRIPPED), "50_50", pollAvatarDrawables[a], user, 0);
} else {
pollAvatarDrawables[a].setInfo(id, "", "");
}
@@ -4728,13 +4762,13 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
updateCurrentUserAndChat();
if (currentUser != null) {
contactAvatarDrawable.setInfo(currentUser);
- locationImageReceiver.setImage(ImageLocation.getForUser(currentUser, false), "50_50", contactAvatarDrawable, null, currentUser, 0);
+ locationImageReceiver.setImage(ImageLocation.getForUserOrChat(currentUser, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(currentUser, ImageLocation.TYPE_STRIPPED), "50_50", contactAvatarDrawable, currentUser, 0);
} else if (currentChat != null) {
if (currentChat.photo != null) {
currentPhoto = currentChat.photo.photo_small;
}
contactAvatarDrawable.setInfo(currentChat);
- locationImageReceiver.setImage(ImageLocation.getForChat(currentChat, false), "50_50", contactAvatarDrawable, null, currentChat, 0);
+ locationImageReceiver.setImage(ImageLocation.getForUserOrChat(currentChat, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(currentChat, ImageLocation.TYPE_STRIPPED), "50_50", contactAvatarDrawable, currentChat, 0);
} else {
locationImageReceiver.setImage(null, null, contactAvatarDrawable, null, null, 0);
}
@@ -4809,7 +4843,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
} else if (currentMapProvider == 2) {
if (currentWebFile != null) {
ImageLocation lastLocation = lastWebFile == null ? null : ImageLocation.getForWebFile(lastWebFile);
- photoImage.setImage(ImageLocation.getForWebFile(currentWebFile), null, lastLocation, null, null, messageObject, 0);
+ photoImage.setImage(ImageLocation.getForWebFile(currentWebFile), null, lastLocation, null, (Drawable) null, messageObject, 0);
}
} else {
if (currentMapProvider == 3 || currentMapProvider == 4) {
@@ -7097,7 +7131,9 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
buttonY = this.buttonY = (int) (photoImage.getImageY() + (photoImage.getImageHeight() - size) / 2.0f);
radialProgress.setProgressRect((int) buttonX, (int ) buttonY, (int) buttonX + size, (int) buttonY + size);
}
- imageDrawn = photoImage.draw(canvas);
+ if (delegate == null || delegate.getPinchToZoomHelper() == null || !delegate.getPinchToZoomHelper().isInOverlayModeFor(this)) {
+ imageDrawn = photoImage.draw(canvas);
+ }
}
linkPreviewY += photoImage.getImageHeight() + AndroidUtilities.dp(6);
}
@@ -7180,7 +7216,9 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
imageDrawn = true;
drawTime = true;
} else {
- imageDrawn = photoImage.draw(canvas);
+ if (delegate == null || delegate.getPinchToZoomHelper() == null || !delegate.getPinchToZoomHelper().isInOverlayModeFor(this)) {
+ imageDrawn = photoImage.draw(canvas);
+ }
}
}
if (documentAttachType == DOCUMENT_ATTACH_TYPE_VIDEO || documentAttachType == DOCUMENT_ATTACH_TYPE_GIF) {
@@ -7330,7 +7368,9 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
} else {
photoImage.setSideClip(0);
}
- imageDrawn = photoImage.draw(canvas);
+ if (delegate == null || delegate.getPinchToZoomHelper() == null || !delegate.getPinchToZoomHelper().isInOverlayModeFor(this)) {
+ imageDrawn = photoImage.draw(canvas);
+ }
boolean drawTimeOld = drawTime;
drawTime = photoImage.getVisible();
if (currentPosition != null && drawTimeOld != drawTime) {
@@ -7796,11 +7836,19 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
setDrawableBounds(Theme.chat_botInlineDrawable, x, y + AndroidUtilities.dp(3));
Theme.chat_botInlineDrawable.draw(canvas);
} else if (button.button instanceof TLRPC.TL_keyboardButtonCallback || button.button instanceof TLRPC.TL_keyboardButtonRequestGeoLocation || button.button instanceof TLRPC.TL_keyboardButtonGame || button.button instanceof TLRPC.TL_keyboardButtonBuy || button.button instanceof TLRPC.TL_keyboardButtonUrlAuth) {
+ if (button.button instanceof TLRPC.TL_keyboardButtonBuy) {
+ int x = button.x + button.width - AndroidUtilities.dp(5) - Theme.chat_botCardDrawalbe.getIntrinsicWidth() + addX;
+ setDrawableBounds(Theme.chat_botCardDrawalbe, x, y + AndroidUtilities.dp(4));
+ Theme.chat_botCardDrawalbe.draw(canvas);
+ }
boolean drawProgress = (button.button instanceof TLRPC.TL_keyboardButtonCallback || button.button instanceof TLRPC.TL_keyboardButtonGame || button.button instanceof TLRPC.TL_keyboardButtonBuy || button.button instanceof TLRPC.TL_keyboardButtonUrlAuth) && SendMessagesHelper.getInstance(currentAccount).isSendingCallback(currentMessageObject, button.button) ||
button.button instanceof TLRPC.TL_keyboardButtonRequestGeoLocation && SendMessagesHelper.getInstance(currentAccount).isSendingCurrentLocation(currentMessageObject, button.button);
if (drawProgress || button.progressAlpha != 0) {
Theme.chat_botProgressPaint.setAlpha(Math.min(255, (int) (button.progressAlpha * 255)));
int x = button.x + button.width - AndroidUtilities.dp(9 + 3) + addX;
+ if (button.button instanceof TLRPC.TL_keyboardButtonBuy) {
+ y += AndroidUtilities.dp(26);
+ }
rect.set(x, y + AndroidUtilities.dp(4), x + AndroidUtilities.dp(8), y + AndroidUtilities.dp(8 + 4));
canvas.drawArc(rect, button.angle, 220, false, Theme.chat_botProgressPaint);
invalidate();
@@ -9150,7 +9198,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
currentPhoto = null;
}
avatarDrawable.setInfo(currentUser);
- avatarImage.setImage(ImageLocation.getForUser(currentUser, false), "50_50", avatarDrawable, null, currentUser, 0);
+ avatarImage.setImage(ImageLocation.getForUserOrChat(currentUser, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(currentUser, ImageLocation.TYPE_STRIPPED), "50_50", avatarDrawable, currentUser, 0);
} else if (currentChat != null) {
if (currentChat.photo != null) {
currentPhoto = currentChat.photo.photo_small;
@@ -9158,7 +9206,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
currentPhoto = null;
}
avatarDrawable.setInfo(currentChat);
- avatarImage.setImage(ImageLocation.getForChat(currentChat, false), "50_50", avatarDrawable, null, currentChat, 0);
+ avatarImage.setImage(ImageLocation.getForUserOrChat(currentChat, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(currentUser, ImageLocation.TYPE_STRIPPED), "50_50", avatarDrawable, currentChat, 0);
} else {
currentPhoto = null;
avatarDrawable.setInfo(messageObject.getFromChatId(), null, null);
@@ -11020,7 +11068,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
return !forceNotDrawTime;
}
- private boolean shouldDrawTimeOnMedia() {
+ public boolean shouldDrawTimeOnMedia() {
if (overideShouldDrawTimeOnMedia != 0) {
return overideShouldDrawTimeOnMedia == 1;
}
@@ -11028,6 +11076,9 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
}
public void drawTime(Canvas canvas, float alpha, boolean fromParent) {
+ if (!drawFromPinchToZoom && delegate != null && delegate.getPinchToZoomHelper() != null && delegate.getPinchToZoomHelper().isInOverlayModeFor(this) && shouldDrawTimeOnMedia()) {
+ return;
+ }
for (int i = 0; i < 2; i++) {
float curentAplha = alpha;
if (i == 0 && isDrawSelectionBackground() && currentSelectedBackgroundAlpha == 1f && !shouldDrawTimeOnMedia()) {
@@ -11828,6 +11879,9 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
}
public void drawOverlays(Canvas canvas) {
+ if (!drawFromPinchToZoom && delegate != null && delegate.getPinchToZoomHelper() != null && delegate.getPinchToZoomHelper().isInOverlayModeFor(this)) {
+ return;
+ }
long newAnimationTime = SystemClock.elapsedRealtime();
long animationDt = newAnimationTime - lastAnimationTime;
if (animationDt > 17) {
@@ -13127,6 +13181,9 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
info.setParent(ChatMessageCell.this);
info.setPackageName(getContext().getPackageName());
if (virtualViewId >= LINK_IDS_START) {
+ if (!(currentMessageObject.messageText instanceof Spannable)) {
+ return null;
+ }
Spannable buffer = (Spannable) currentMessageObject.messageText;
ClickableSpan link = getLinkById(virtualViewId);
if (link == null) {
diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Cells/CheckBoxUserCell.java b/TMessagesProj/src/main/java/org/telegram/ui/Cells/CheckBoxUserCell.java
index 040e158e9..490c179fe 100644
--- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/CheckBoxUserCell.java
+++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/CheckBoxUserCell.java
@@ -77,7 +77,7 @@ public class CheckBoxUserCell extends FrameLayout {
textView.setText(ContactsController.formatName(user.first_name, user.last_name));
checkBox.setChecked(checked, false);
avatarDrawable.setInfo(user);
- imageView.setImage(ImageLocation.getForUser(user, false), "50_50", avatarDrawable, user);
+ imageView.setImage(ImageLocation.getForUserOrChat(user, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(user, ImageLocation.TYPE_STRIPPED), "50_50", avatarDrawable, user);
needDivider = divider;
setWillNotDraw(!divider);
}
diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Cells/DialogCell.java b/TMessagesProj/src/main/java/org/telegram/ui/Cells/DialogCell.java
index 0b46bad2a..ef3c8af61 100644
--- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/DialogCell.java
+++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/DialogCell.java
@@ -981,7 +981,7 @@ public class DialogCell extends BaseCell {
}
thumbImage.setImage(ImageLocation.getForObject(bigThumb, message.photoThumbsObject), "20_20", ImageLocation.getForObject(smallThumb, message.photoThumbsObject), "20_20", size, null, message, 0);
} else {
- thumbImage.setImage(null, null, ImageLocation.getForObject(smallThumb, message.photoThumbsObject), "20_20", null, message, 0);
+ thumbImage.setImage(null, null, ImageLocation.getForObject(smallThumb, message.photoThumbsObject), "20_20", (Drawable) null, message, 0);
}
needEmoji = false;
}
@@ -2113,11 +2113,11 @@ public class DialogCell extends BaseCell {
avatarDrawable.setAvatarType(AvatarDrawable.AVATAR_TYPE_SAVED);
avatarImage.setImage(null, null, avatarDrawable, null, user, 0);
} else {
- avatarImage.setImage(ImageLocation.getForUser(user, false), "50_50", avatarDrawable, null, user, 0);
+ avatarImage.setImage(ImageLocation.getForUserOrChat(user, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(user, ImageLocation.TYPE_STRIPPED), "50_50", avatarDrawable, user, 0);
}
} else if (chat != null) {
avatarDrawable.setInfo(chat);
- avatarImage.setImage(ImageLocation.getForChat(chat, false), "50_50", avatarDrawable, null, chat, 0);
+ avatarImage.setImage(ImageLocation.getForUserOrChat(chat, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(chat, ImageLocation.TYPE_STRIPPED), "50_50", avatarDrawable, chat, 0);
}
}
@@ -2236,7 +2236,10 @@ public class DialogCell extends BaseCell {
boolean needInvalidate = false;
if (currentDialogFolderId != 0 && archivedChatsDrawable != null && archivedChatsDrawable.outProgress == 0.0f && translationX == 0.0f) {
+ canvas.save();
+ canvas.clipRect(0, 0, getMeasuredWidth(), getMeasuredHeight());
archivedChatsDrawable.draw(canvas);
+ canvas.restore();
return;
}
@@ -2892,7 +2895,10 @@ public class DialogCell extends BaseCell {
canvas.restore();
}
if (currentDialogFolderId != 0 && translationX == 0 && archivedChatsDrawable != null) {
+ canvas.save();
+ canvas.clipRect(0, 0, getMeasuredWidth(), getMeasuredHeight());
archivedChatsDrawable.draw(canvas);
+ canvas.restore();
}
if (useSeparator) {
diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Cells/DialogMeUrlCell.java b/TMessagesProj/src/main/java/org/telegram/ui/Cells/DialogMeUrlCell.java
index 9d6db96b2..d4226ea95 100644
--- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/DialogMeUrlCell.java
+++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/DialogMeUrlCell.java
@@ -129,7 +129,7 @@ public class DialogMeUrlCell extends BaseCell {
}
nameString = chat.title;
avatarDrawable.setInfo(chat);
- avatarImage.setImage(ImageLocation.getForChat(chat, false), "50_50", avatarDrawable, null, recentMeUrl, 0);
+ avatarImage.setImage(ImageLocation.getForUserOrChat(chat, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(chat, ImageLocation.TYPE_STRIPPED), "50_50", avatarDrawable, recentMeUrl, 0);
} else if (recentMeUrl instanceof TLRPC.TL_recentMeUrlUser) {
TLRPC.User user = MessagesController.getInstance(currentAccount).getUser(recentMeUrl.user_id);
if (!LocaleController.isRTL) {
@@ -153,7 +153,7 @@ public class DialogMeUrlCell extends BaseCell {
}
nameString = UserObject.getUserName(user);
avatarDrawable.setInfo(user);
- avatarImage.setImage(ImageLocation.getForUser(user, false), "50_50", avatarDrawable, null, recentMeUrl, 0);
+ avatarImage.setImage(ImageLocation.getForUserOrChat(user, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(user, ImageLocation.TYPE_STRIPPED), "50_50", avatarDrawable, recentMeUrl, 0);
} else if (recentMeUrl instanceof TLRPC.TL_recentMeUrlStickerSet) {
if (!LocaleController.isRTL) {
nameLeft = AndroidUtilities.dp(AndroidUtilities.leftBaseline);
@@ -180,7 +180,7 @@ public class DialogMeUrlCell extends BaseCell {
nameLockTop = AndroidUtilities.dp(17.5f);
}
drawVerified = recentMeUrl.chat_invite.chat.verified;
- avatarImage.setImage(ImageLocation.getForChat(recentMeUrl.chat_invite.chat, false), "50_50", avatarDrawable, null, recentMeUrl, 0);
+ avatarImage.setImage(ImageLocation.getForUserOrChat(recentMeUrl.chat_invite.chat, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(recentMeUrl.chat_invite.chat, ImageLocation.TYPE_STRIPPED), "50_50", avatarDrawable, recentMeUrl, 0);
} else {
nameString = recentMeUrl.chat_invite.title;
avatarDrawable.setInfo(5, recentMeUrl.chat_invite.title, null);
diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Cells/DrawerProfileCell.java b/TMessagesProj/src/main/java/org/telegram/ui/Cells/DrawerProfileCell.java
index 112a8d315..c24c458dc 100644
--- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/DrawerProfileCell.java
+++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/DrawerProfileCell.java
@@ -351,7 +351,7 @@ public class DrawerProfileCell extends FrameLayout {
phoneTextView.setText(PhoneFormat.getInstance().format("+" + user.phone));
AvatarDrawable avatarDrawable = new AvatarDrawable(user);
avatarDrawable.setColor(Theme.getColor(Theme.key_avatar_backgroundInProfileBlue));
- avatarImageView.setImage(ImageLocation.getForUser(user, false), "50_50", avatarDrawable, user);
+ avatarImageView.setImage(ImageLocation.getForUserOrChat(user, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(user, ImageLocation.TYPE_STRIPPED), "50_50", avatarDrawable, user);
applyBackground(true);
}
diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Cells/DrawerUserCell.java b/TMessagesProj/src/main/java/org/telegram/ui/Cells/DrawerUserCell.java
index 7b7650656..53a9857bd 100644
--- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/DrawerUserCell.java
+++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/DrawerUserCell.java
@@ -91,7 +91,7 @@ public class DrawerUserCell extends FrameLayout {
avatarDrawable.setInfo(user);
textView.setText(ContactsController.formatName(user.first_name, user.last_name));
imageView.getImageReceiver().setCurrentAccount(account);
- imageView.setImage(ImageLocation.getForUser(user, false), "50_50", avatarDrawable, user);
+ imageView.setImage(ImageLocation.getForUserOrChat(user, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(user, ImageLocation.TYPE_STRIPPED), "50_50", avatarDrawable, user);
checkBox.setVisibility(account == UserConfig.selectedAccount ? VISIBLE : INVISIBLE);
}
diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Cells/GroupCallInvitedCell.java b/TMessagesProj/src/main/java/org/telegram/ui/Cells/GroupCallInvitedCell.java
index e7a5e73ec..9d33cfb42 100644
--- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/GroupCallInvitedCell.java
+++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/GroupCallInvitedCell.java
@@ -91,7 +91,7 @@ public class GroupCallInvitedCell extends FrameLayout {
nameTextView.setText(lastName);
avatarImageView.getImageReceiver().setCurrentAccount(account);
- avatarImageView.setImage(ImageLocation.getForUser(currentUser, false), "50_50", avatarDrawable, currentUser);
+ avatarImageView.setImage(ImageLocation.getForUserOrChat(currentUser, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(currentUser, ImageLocation.TYPE_STRIPPED), "50_50", avatarDrawable, currentUser);
}
public void setDrawDivider(boolean draw) {
diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Cells/GroupCallUserCell.java b/TMessagesProj/src/main/java/org/telegram/ui/Cells/GroupCallUserCell.java
index bbfd123fa..2e5d92d71 100644
--- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/GroupCallUserCell.java
+++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/GroupCallUserCell.java
@@ -45,8 +45,8 @@ import org.telegram.ui.Components.CubicBezierInterpolator;
import org.telegram.ui.Components.LayoutHelper;
import org.telegram.ui.Components.RLottieDrawable;
import org.telegram.ui.Components.RLottieImageView;
+import org.telegram.ui.Components.RadialProgressView;
import org.telegram.ui.Components.WaveDrawable;
-import org.telegram.ui.ProfileActivity;
import java.util.ArrayList;
@@ -57,10 +57,13 @@ public class GroupCallUserCell extends FrameLayout {
private BackupImageView avatarImageView;
private SimpleTextView nameTextView;
private SimpleTextView[] statusTextView = new SimpleTextView[5];
+ private SimpleTextView fullAboutTextView;
private RLottieImageView muteButton;
private RLottieDrawable muteDrawable;
private RLottieDrawable shakeHandDrawable;
+ private RadialProgressView avatarProgressView;
+
private AvatarDrawable avatarDrawable;
private ChatObject.Call currentCall;
@@ -81,7 +84,6 @@ public class GroupCallUserCell extends FrameLayout {
private int currentStatus;
private int selfId;
-
private Runnable shakeHandCallback = () -> {
shakeHandDrawable.setOnFinishCallback(null, 0);
muteDrawable.setOnFinishCallback(null, 0);
@@ -132,6 +134,7 @@ public class GroupCallUserCell extends FrameLayout {
private boolean updateRunnableScheduled;
private boolean updateVoiceRunnableScheduled;
private boolean isSpeaking;
+ private boolean hasAvatar;
private Drawable speakingDrawable;
@@ -142,17 +145,29 @@ public class GroupCallUserCell extends FrameLayout {
public void setProgressToAvatarPreview(float progressToAvatarPreview) {
this.progressToAvatarPreview = progressToAvatarPreview;
nameTextView.setTranslationX((LocaleController.isRTL ? AndroidUtilities.dp(53) : -AndroidUtilities.dp(53)) * progressToAvatarPreview);
- for (int i = 0; i < statusTextView.length; i++) {
- if (!TextUtils.isEmpty(statusTextView[4].getText()) && statusTextView[4].getLineCount() > 1) {
- statusTextView[i].setFullLayoutAdditionalWidth(AndroidUtilities.dp(92), LocaleController.isRTL ? AndroidUtilities.dp(48) : AndroidUtilities.dp(53));
- statusTextView[i].setFullAlpha(progressToAvatarPreview);
- statusTextView[i].setTranslationX(0);
- statusTextView[i].invalidate();
- } else {
- statusTextView[i].setTranslationX((LocaleController.isRTL ? AndroidUtilities.dp(53) : -AndroidUtilities.dp(53)) * progressToAvatarPreview);
- statusTextView[i].setFullLayoutAdditionalWidth(0, 0);
+
+ if (isSelfUser() && progressToAvatarPreview > 0) {
+ fullAboutTextView.setTranslationX((LocaleController.isRTL ? -AndroidUtilities.dp(53) : AndroidUtilities.dp(53)) * (1f - progressToAvatarPreview));
+ fullAboutTextView.setVisibility(View.VISIBLE);
+ fullAboutTextView.setAlpha(progressToAvatarPreview);
+ statusTextView[4].setAlpha(1f - progressToAvatarPreview);
+ statusTextView[4].setTranslationX((LocaleController.isRTL ? AndroidUtilities.dp(53) : -AndroidUtilities.dp(53)) * progressToAvatarPreview);
+ } else {
+ fullAboutTextView.setVisibility(View.GONE);
+
+ for (int i = 0; i < statusTextView.length; i++) {
+ if (!TextUtils.isEmpty(statusTextView[4].getText()) && statusTextView[4].getLineCount() > 1) {
+ statusTextView[i].setFullLayoutAdditionalWidth(AndroidUtilities.dp(92), LocaleController.isRTL ? AndroidUtilities.dp(48) : AndroidUtilities.dp(53));
+ statusTextView[i].setFullAlpha(progressToAvatarPreview);
+ statusTextView[i].setTranslationX(0);
+ statusTextView[i].invalidate();
+ } else {
+ statusTextView[i].setTranslationX((LocaleController.isRTL ? AndroidUtilities.dp(53) : -AndroidUtilities.dp(53)) * progressToAvatarPreview);
+ statusTextView[i].setFullLayoutAdditionalWidth(0, 0);
+ }
}
}
+
avatarImageView.setAlpha(progressToAvatarPreview == 0 ? 1f : 0);
avatarWavesDrawable.setShowWaves(isSpeaking && progressToAvatarPreview == 0, this);
@@ -160,6 +175,8 @@ public class GroupCallUserCell extends FrameLayout {
muteButton.setAlpha(1f - progressToAvatarPreview);
muteButton.setScaleX(0.6f + 0.4f * (1f - progressToAvatarPreview));
muteButton.setScaleY(0.6f + 0.4f * (1f - progressToAvatarPreview));
+
+
invalidate();
}
@@ -167,6 +184,15 @@ public class GroupCallUserCell extends FrameLayout {
return avatarWavesDrawable;
}
+ public void setUploadProgress(float progress, boolean animated) {
+ avatarProgressView.setProgress(progress);
+ if (progress < 1f) {
+ AndroidUtilities.updateViewVisibilityAnimated(avatarProgressView, true, 1f, animated);
+ } else {
+ AndroidUtilities.updateViewVisibilityAnimated(avatarProgressView, false, 1f, animated);
+ }
+ }
+
private static class VerifiedDrawable extends Drawable {
private Drawable[] drawables = new Drawable[2];
@@ -227,6 +253,28 @@ public class GroupCallUserCell extends FrameLayout {
avatarImageView.setRoundRadius(AndroidUtilities.dp(24));
addView(avatarImageView, LayoutHelper.createFrame(46, 46, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, LocaleController.isRTL ? 0 : 11, 6, LocaleController.isRTL ? 11 : 0, 0));
+ avatarProgressView = new RadialProgressView(context) {
+ private Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
+ {
+ paint.setColor(0x55000000);
+ }
+
+ @Override
+ protected void onDraw(Canvas canvas) {
+ if (avatarImageView.getImageReceiver().hasNotThumb() && avatarImageView.getAlpha() > 0) {
+ paint.setAlpha((int) (0x55 * avatarImageView.getImageReceiver().getCurrentAlpha() * avatarImageView.getAlpha()));
+ canvas.drawCircle(getMeasuredWidth() / 2.0f, getMeasuredHeight() / 2.0f, getMeasuredWidth() / 2.0f, paint);
+ }
+ avatarProgressView.setProgressColor(ColorUtils.setAlphaComponent(0xffffffff, (int) (255 * avatarImageView.getImageReceiver().getCurrentAlpha() * avatarImageView.getAlpha())));
+ super.onDraw(canvas);
+ }
+ };
+ avatarProgressView.setSize(AndroidUtilities.dp(26));
+ avatarProgressView.setProgressColor(0xffffffff);
+ avatarProgressView.setNoProgress(false);
+ addView(avatarProgressView, LayoutHelper.createFrame(46, 46, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, LocaleController.isRTL ? 0 : 11, 6, LocaleController.isRTL ? 11 : 0, 0));
+ AndroidUtilities.updateViewVisibilityAnimated(avatarProgressView, false, 1f, false);
+
nameTextView = new SimpleTextView(context);
nameTextView.setTextColor(Theme.getColor(Theme.key_voipgroup_nameText));
nameTextView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
@@ -247,15 +295,18 @@ public class GroupCallUserCell extends FrameLayout {
@Override
public void setAlpha(float alpha) {
originalAlpha = alpha;
+ float alphaOverride;
if (num == 4) {
- float alphaOverride = statusTextView[4].getFullAlpha();
- if (alphaOverride > 0) {
+ alphaOverride = statusTextView[4].getFullAlpha();
+ if (isSelfUser() && progressToAvatarPreview > 0) {
+ super.setAlpha(1f - progressToAvatarPreview);
+ } else if (alphaOverride > 0) {
super.setAlpha(Math.max(alpha, alphaOverride));
} else {
super.setAlpha(alpha);
}
} else {
- float alphaOverride = 1.0f - statusTextView[4].getFullAlpha();
+ alphaOverride = 1.0f - statusTextView[4].getFullAlpha();
super.setAlpha(alpha * alphaOverride);
}
}
@@ -306,6 +357,13 @@ public class GroupCallUserCell extends FrameLayout {
}
}
+ fullAboutTextView = new SimpleTextView(context);
+ fullAboutTextView.setMaxLines(3);
+ fullAboutTextView.setTextSize(15);
+ fullAboutTextView.setTextColor(Theme.getColor(Theme.key_voipgroup_mutedIcon));
+ fullAboutTextView.setVisibility(View.GONE);
+ addView(fullAboutTextView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 20 * 3, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, 14, 32, 14, 0));
+
muteDrawable = new RLottieDrawable(R.raw.voice_outlined2, "" + R.raw.voice_outlined2, AndroidUtilities.dp(34), AndroidUtilities.dp(32), true, null);
shakeHandDrawable = new RLottieDrawable(R.raw.hand_1, "" + R.raw.hand_1, AndroidUtilities.dp(34), AndroidUtilities.dp(32), true, null);
@@ -333,10 +391,16 @@ public class GroupCallUserCell extends FrameLayout {
}
public int getClipHeight() {
- int lineCount = statusTextView[4].getLineCount();
+ SimpleTextView aboutTextView;
+ if (!TextUtils.isEmpty(fullAboutTextView.getText()) && hasAvatar) {
+ aboutTextView = fullAboutTextView;
+ } else {
+ aboutTextView = statusTextView[4];
+ }
+ int lineCount = aboutTextView.getLineCount();
if (lineCount > 1) {
- int h = statusTextView[4].getTextHeight();
- return statusTextView[4].getTop() + h + AndroidUtilities.dp(8);
+ int h = aboutTextView.getTextHeight();
+ return aboutTextView.getTop() + h + AndroidUtilities.dp(8);
}
return getMeasuredHeight();
}
@@ -377,7 +441,7 @@ public class GroupCallUserCell extends FrameLayout {
return avatarImageView.getImageReceiver().hasNotThumb();
}
- public void setData(AccountInstance account, TLRPC.TL_groupCallParticipant groupCallParticipant, ChatObject.Call call, int self) {
+ public void setData(AccountInstance account, TLRPC.TL_groupCallParticipant groupCallParticipant, ChatObject.Call call, int self, TLRPC.FileLocation uploadingAvatar) {
currentCall = call;
accountInstance = account;
selfId = self;
@@ -393,7 +457,14 @@ public class GroupCallUserCell extends FrameLayout {
nameTextView.setText(UserObject.getUserName(currentUser));
nameTextView.setRightDrawable(currentUser != null && currentUser.verified ? new VerifiedDrawable(getContext()) : null);
avatarImageView.getImageReceiver().setCurrentAccount(account.getCurrentAccount());
- avatarImageView.setImage(ImageLocation.getForUser(currentUser, false), "50_50", avatarDrawable, currentUser);
+ if (uploadingAvatar != null) {
+ hasAvatar = true;
+ avatarImageView.setImage(ImageLocation.getForLocal(uploadingAvatar), "50_50", avatarDrawable, null);
+ } else {
+ ImageLocation imageLocation = ImageLocation.getForUser(currentUser, ImageLocation.TYPE_SMALL);
+ hasAvatar = imageLocation != null;
+ avatarImageView.setImage(imageLocation, "50_50", avatarDrawable, currentUser);
+ }
} else {
currentChat = accountInstance.getMessagesController().getChat(-id);
currentUser = null;
@@ -403,9 +474,17 @@ public class GroupCallUserCell extends FrameLayout {
nameTextView.setText(currentChat.title);
nameTextView.setRightDrawable(currentChat.verified ? new VerifiedDrawable(getContext()) : null);
avatarImageView.getImageReceiver().setCurrentAccount(account.getCurrentAccount());
- avatarImageView.setImage(ImageLocation.getForChat(currentChat, false), "50_50", avatarDrawable, currentChat);
+ if (uploadingAvatar != null) {
+ hasAvatar = true;
+ avatarImageView.setImage(ImageLocation.getForLocal(uploadingAvatar), "50_50", avatarDrawable, null);
+ } else {
+ ImageLocation imageLocation = ImageLocation.getForChat(currentChat, ImageLocation.TYPE_SMALL);
+ hasAvatar = imageLocation != null;
+ avatarImageView.setImage(imageLocation, "50_50", avatarDrawable, currentChat);
+ }
}
}
+ applyParticipantChanges(false);
}
public void setDrawDivider(boolean draw) {
@@ -578,18 +657,45 @@ public class GroupCallUserCell extends FrameLayout {
}
}
- if (isSelfUser()) {
- statusTextView[4].setTextColor(Theme.getColor(Theme.key_voipgroup_listeningText));
- } else {
+ if (!isSelfUser()) {
statusTextView[4].setTextColor(Theme.getColor(grayIconColor));
}
if (isSelfUser()) {
- statusTextView[4].setText(LocaleController.getString("ThisIsYou", R.string.ThisIsYou));
+ if (!hasAbout && !hasAvatar) {
+ if (currentUser != null) {
+ statusTextView[4].setText(LocaleController.getString("TapToAddPhotoOrBio", R.string.TapToAddPhotoOrBio));
+ } else {
+ statusTextView[4].setText(LocaleController.getString("TapToAddPhotoOrDescription", R.string.TapToAddPhotoOrDescription));
+ }
+ statusTextView[4].setTextColor(Theme.getColor(grayIconColor));
+ } else if (!hasAbout ){
+ if (currentUser != null) {
+ statusTextView[4].setText(LocaleController.getString("TapToAddBio", R.string.TapToAddBio));
+ } else {
+ statusTextView[4].setText(LocaleController.getString("TapToAddDescription", R.string.TapToAddDescription));
+ }
+ statusTextView[4].setTextColor(Theme.getColor(grayIconColor));
+ } else if (!hasAvatar) {
+ statusTextView[4].setText(LocaleController.getString("TapToAddPhoto", R.string.TapToAddPhoto));
+ statusTextView[4].setTextColor(Theme.getColor(grayIconColor));
+ } else {
+ statusTextView[4].setText(LocaleController.getString("ThisIsYou", R.string.ThisIsYou));
+ statusTextView[4].setTextColor(Theme.getColor(Theme.key_voipgroup_listeningText));
+ }
+ if (hasAbout) {
+ fullAboutTextView.setText(AndroidUtilities.replaceNewLines(participant.about));
+ fullAboutTextView.setTextColor(Theme.getColor(Theme.key_voipgroup_mutedIcon));
+ } else {
+ fullAboutTextView.setText(statusTextView[newStatus].getText());
+ fullAboutTextView.setTextColor(statusTextView[newStatus].getTextColor());
+ }
} else if (hasAbout) {
statusTextView[4].setText(AndroidUtilities.replaceNewLines(participant.about));
+ fullAboutTextView.setText("");
} else {
statusTextView[4].setText("");
+ fullAboutTextView.setText("");
}
boolean somethingChanged = false;
if (animatorSet != null) {
@@ -626,7 +732,7 @@ public class GroupCallUserCell extends FrameLayout {
int volume = vol / 100;
if (volume != 100) {
statusTextView[1].setLeftDrawable(speakingDrawable);
- statusTextView[1].setText((vol < 100 ? 1 : volume) + "% " + LocaleController.getString("Speaking", R.string.Speaking));
+ statusTextView[1].setText(LocaleController.formatString("SpeakingWithVolume", R.string.SpeakingWithVolume, vol < 100 ? 1 : volume));
} else {
statusTextView[1].setLeftDrawable(null);
statusTextView[1].setText(LocaleController.getString("Speaking", R.string.Speaking));
@@ -766,6 +872,8 @@ public class GroupCallUserCell extends FrameLayout {
avatarImageView.setScaleX(avatarWavesDrawable.getAvatarScale());
avatarImageView.setScaleY(avatarWavesDrawable.getAvatarScale());
+ avatarProgressView.setScaleX(avatarWavesDrawable.getAvatarScale());
+ avatarProgressView.setScaleY(avatarWavesDrawable.getAvatarScale());
super.dispatchDraw(canvas);
}
@@ -913,6 +1021,7 @@ public class GroupCallUserCell extends FrameLayout {
return avatarImageView;
}
+
@Override
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
super.onInitializeAccessibilityNodeInfo(info);
diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Cells/GroupCreateUserCell.java b/TMessagesProj/src/main/java/org/telegram/ui/Cells/GroupCreateUserCell.java
index c3004876f..78dad291a 100644
--- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/GroupCreateUserCell.java
+++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/GroupCreateUserCell.java
@@ -330,7 +330,7 @@ public class GroupCreateUserCell extends FrameLayout {
}
}
- avatarImageView.setImage(ImageLocation.getForUser(currentUser, false), "50_50", avatarDrawable, currentUser);
+ avatarImageView.setImage(ImageLocation.getForUserOrChat(currentUser, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(currentUser, ImageLocation.TYPE_STRIPPED), "50_50", avatarDrawable, currentUser);
} else {
TLRPC.Chat currentChat = (TLRPC.Chat) currentObject;
if (currentChat.photo != null) {
@@ -390,7 +390,7 @@ public class GroupCreateUserCell extends FrameLayout {
}
}
- avatarImageView.setImage(ImageLocation.getForChat(currentChat, false), "50_50", avatarDrawable, currentChat);
+ avatarImageView.setImage(ImageLocation.getForUserOrChat(currentChat, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(currentChat, ImageLocation.TYPE_STRIPPED), "50_50", avatarDrawable, currentChat);
}
}
diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Cells/HintDialogCell.java b/TMessagesProj/src/main/java/org/telegram/ui/Cells/HintDialogCell.java
index 801e04156..d18cddd94 100644
--- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/HintDialogCell.java
+++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/HintDialogCell.java
@@ -11,8 +11,6 @@ package org.telegram.ui.Cells;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.RectF;
-import android.text.Layout;
-import android.text.StaticLayout;
import android.text.TextUtils;
import android.util.TypedValue;
import android.view.Gravity;
@@ -130,7 +128,7 @@ public class HintDialogCell extends FrameLayout {
nameTextView.setText("");
}
avatarDrawable.setInfo(currentUser);
- imageView.setImage(ImageLocation.getForUser(currentUser, false), "50_50", avatarDrawable, currentUser);
+ imageView.setImage(ImageLocation.getForUserOrChat(currentUser, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(currentUser, ImageLocation.TYPE_STRIPPED), "50_50", avatarDrawable, currentUser);
} else {
TLRPC.Chat chat = MessagesController.getInstance(currentAccount).getChat(-uid);
if (name != null) {
@@ -142,7 +140,7 @@ public class HintDialogCell extends FrameLayout {
}
avatarDrawable.setInfo(chat);
currentUser = null;
- imageView.setImage(ImageLocation.getForChat(chat, false), "50_50", avatarDrawable, chat);
+ imageView.setImage(ImageLocation.getForUserOrChat(chat, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(chat, ImageLocation.TYPE_STRIPPED), "50_50", avatarDrawable, chat);
}
if (counter) {
update(0);
diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Cells/JoinSheetUserCell.java b/TMessagesProj/src/main/java/org/telegram/ui/Cells/JoinSheetUserCell.java
index a134e6922..1c21246f4 100644
--- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/JoinSheetUserCell.java
+++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/JoinSheetUserCell.java
@@ -58,7 +58,7 @@ public class JoinSheetUserCell extends FrameLayout {
public void setUser(TLRPC.User user) {
nameTextView.setText(ContactsController.formatName(user.first_name, user.last_name));
avatarDrawable.setInfo(user);
- imageView.setImage(ImageLocation.getForUser(user, false), "50_50", avatarDrawable, user);
+ imageView.setImage(ImageLocation.getForUserOrChat(user, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(user, ImageLocation.TYPE_STRIPPED), "50_50", avatarDrawable, user);
}
public void setCount(int count) {
diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Cells/ManageChatUserCell.java b/TMessagesProj/src/main/java/org/telegram/ui/Cells/ManageChatUserCell.java
index c08857730..22fcc3a87 100644
--- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/ManageChatUserCell.java
+++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/ManageChatUserCell.java
@@ -260,7 +260,7 @@ public class ManageChatUserCell extends FrameLayout {
}
}
lastAvatar = photo;
- avatarImageView.setImage(ImageLocation.getForUser(currentUser, false), "50_50", avatarDrawable, currentUser);
+ avatarImageView.setImage(ImageLocation.getForUserOrChat(currentUser, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(currentUser, ImageLocation.TYPE_STRIPPED), "50_50", avatarDrawable, currentUser);
} else if (currentObject instanceof TLRPC.Chat) {
TLRPC.Chat currentChat = (TLRPC.Chat) currentObject;
@@ -317,7 +317,7 @@ public class ManageChatUserCell extends FrameLayout {
}
}
lastAvatar = photo;
- avatarImageView.setImage(ImageLocation.getForChat(currentChat, false), "50_50", avatarDrawable, currentChat);
+ avatarImageView.setImage(ImageLocation.getForUserOrChat(currentChat, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(currentChat, ImageLocation.TYPE_STRIPPED), "50_50", avatarDrawable, currentChat);
} else if (currentObject instanceof Integer) {
nameTextView.setText(currentName);
statusTextView.setTextColor(statusColor);
diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Cells/MentionCell.java b/TMessagesProj/src/main/java/org/telegram/ui/Cells/MentionCell.java
index 0152ee1a0..a3bc21010 100644
--- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/MentionCell.java
+++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/MentionCell.java
@@ -76,7 +76,7 @@ public class MentionCell extends LinearLayout {
}
avatarDrawable.setInfo(user);
if (user.photo != null && user.photo.photo_small != null) {
- imageView.setImage(ImageLocation.getForUser(user, false), "50_50", avatarDrawable, user);
+ imageView.setImage(ImageLocation.getForUserOrChat(user, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(user, ImageLocation.TYPE_STRIPPED), "50_50", avatarDrawable, user);
} else {
imageView.setImageDrawable(avatarDrawable);
}
@@ -99,7 +99,7 @@ public class MentionCell extends LinearLayout {
}
avatarDrawable.setInfo(chat);
if (chat.photo != null && chat.photo.photo_small != null) {
- imageView.setImage(ImageLocation.getForChat(chat, false), "50_50", avatarDrawable, chat);
+ imageView.setImage(ImageLocation.getForUserOrChat(chat, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(chat, ImageLocation.TYPE_STRIPPED), "50_50", avatarDrawable, chat);
} else {
imageView.setImageDrawable(avatarDrawable);
}
@@ -140,7 +140,7 @@ public class MentionCell extends LinearLayout {
imageView.setVisibility(VISIBLE);
avatarDrawable.setInfo(user);
if (user.photo != null && user.photo.photo_small != null) {
- imageView.setImage(ImageLocation.getForUser(user, false), "50_50", avatarDrawable, user);
+ imageView.setImage(ImageLocation.getForUserOrChat(user, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(user, ImageLocation.TYPE_STRIPPED), "50_50", avatarDrawable, user);
} else {
imageView.setImageDrawable(avatarDrawable);
}
diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Cells/PaymentInfoCell.java b/TMessagesProj/src/main/java/org/telegram/ui/Cells/PaymentInfoCell.java
index da858bba3..66fb58991 100644
--- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/PaymentInfoCell.java
+++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/PaymentInfoCell.java
@@ -60,25 +60,27 @@ public class PaymentInfoCell extends FrameLayout {
detailExTextView = new TextView(context);
detailExTextView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteGrayText2));
- detailExTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 13);
+ detailExTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14);
detailExTextView.setLines(1);
detailExTextView.setMaxLines(1);
detailExTextView.setSingleLine(true);
detailExTextView.setEllipsize(TextUtils.TruncateAt.END);
detailExTextView.setGravity((LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP);
- addView(detailExTextView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, LocaleController.isRTL ? 10 : 123, 90, LocaleController.isRTL ? 123 : 10, 0));
+ addView(detailExTextView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, LocaleController.isRTL ? 10 : 123, 90, LocaleController.isRTL ? 123 : 10, 9));
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
- super.onMeasure(MeasureSpec.makeMeasureSpec(MeasureSpec.getSize(widthMeasureSpec), MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(120), MeasureSpec.EXACTLY));
- }
-
- @Override
- protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
- super.onLayout(changed, left, top, right, bottom);
- top = detailTextView.getBottom() + AndroidUtilities.dp(3);
- detailExTextView.layout(detailExTextView.getLeft(), top, detailExTextView.getRight(), top + detailExTextView.getMeasuredHeight());
+ int h;
+ if (imageView.getVisibility() != GONE) {
+ h = MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(120), MeasureSpec.EXACTLY);
+ } else {
+ h = MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED);
+ measureChildWithMargins(detailTextView, widthMeasureSpec, 0, heightMeasureSpec, 0);
+ FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) detailExTextView.getLayoutParams();
+ layoutParams.topMargin = AndroidUtilities.dp(33) + detailTextView.getMeasuredHeight() + AndroidUtilities.dp(3);
+ }
+ super.onMeasure(MeasureSpec.makeMeasureSpec(MeasureSpec.getSize(widthMeasureSpec), MeasureSpec.EXACTLY), h);
}
public void setInvoice(TLRPC.TL_messageMediaInvoice invoice, String botname) {
@@ -107,7 +109,38 @@ public class PaymentInfoCell extends FrameLayout {
} else {
nameTextView.setLayoutParams(LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, 17, 9, 17, 0));
detailTextView.setLayoutParams(LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, 17, 33, 17, 0));
- detailExTextView.setLayoutParams(LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, 17, 90, 17, 0));
+ detailExTextView.setLayoutParams(LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, 17, 90, 17, 9));
+ imageView.setVisibility(GONE);
+ }
+ }
+
+ public void setReceipt(TLRPC.TL_payments_paymentReceipt receipt, String botname) {
+ nameTextView.setText(receipt.title);
+ detailTextView.setText(receipt.description);
+ detailExTextView.setText(botname);
+
+ int maxPhotoWidth;
+ if (AndroidUtilities.isTablet()) {
+ maxPhotoWidth = (int) (AndroidUtilities.getMinTabletSide() * 0.7f);
+ } else {
+ maxPhotoWidth = (int) (Math.min(AndroidUtilities.displaySize.x, AndroidUtilities.displaySize.y) * 0.7f);
+ }
+ int width = 640;
+ int height = 360;
+ float scale = width / (float) (maxPhotoWidth - AndroidUtilities.dp(2));
+ width /= scale;
+ height /= scale;
+ if (receipt.photo != null && receipt.photo.mime_type.startsWith("image/")) {
+ nameTextView.setLayoutParams(LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, LocaleController.isRTL ? 10 : 123, 9, LocaleController.isRTL ? 123 : 10, 0));
+ detailTextView.setLayoutParams(LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, LocaleController.isRTL ? 10 : 123, 33, LocaleController.isRTL ? 123 : 10, 0));
+ detailExTextView.setLayoutParams(LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, LocaleController.isRTL ? 10 : 123, 90, LocaleController.isRTL ? 123 : 10, 0));
+ imageView.setVisibility(VISIBLE);
+ String filter = String.format(Locale.US, "%d_%d", width, height);
+ imageView.getImageReceiver().setImage(ImageLocation.getForWebFile(WebFile.createWithWebDocument(receipt.photo)), filter, null, null, -1, null, receipt, 1);
+ } else {
+ nameTextView.setLayoutParams(LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, 17, 9, 17, 0));
+ detailTextView.setLayoutParams(LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, 17, 33, 17, 0));
+ detailExTextView.setLayoutParams(LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, 17, 90, 17, 9));
imageView.setVisibility(GONE);
}
}
diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Cells/ProfileSearchCell.java b/TMessagesProj/src/main/java/org/telegram/ui/Cells/ProfileSearchCell.java
index 1e1381fdf..0b6a00721 100644
--- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/ProfileSearchCell.java
+++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/ProfileSearchCell.java
@@ -501,14 +501,14 @@ public class ProfileSearchCell extends BaseCell {
if (user.photo != null) {
photo = user.photo.photo_small;
}
- avatarImage.setImage(ImageLocation.getForUser(user, false), "50_50", avatarDrawable, null, user, 0);
+ avatarImage.setImage(ImageLocation.getForUserOrChat(user, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(user, ImageLocation.TYPE_STRIPPED), "50_50", avatarDrawable, user, 0);
}
} else if (chat != null) {
if (chat.photo != null) {
photo = chat.photo.photo_small;
}
avatarDrawable.setInfo(chat);
- avatarImage.setImage(ImageLocation.getForChat(chat, false), "50_50", avatarDrawable, null, chat, 0);
+ avatarImage.setImage(ImageLocation.getForUserOrChat(chat, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(chat, ImageLocation.TYPE_STRIPPED), "50_50", avatarDrawable, chat, 0);
} else {
avatarDrawable.setInfo(0, null, null);
avatarImage.setImage(null, null, avatarDrawable, null, null, 0);
diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Cells/SessionCell.java b/TMessagesProj/src/main/java/org/telegram/ui/Cells/SessionCell.java
index f45fbb681..1793545f6 100644
--- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/SessionCell.java
+++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/SessionCell.java
@@ -183,7 +183,7 @@ public class SessionCell extends FrameLayout {
if (user != null) {
avatarDrawable.setInfo(user);
name = UserObject.getFirstName(user);
- imageView.setImage(ImageLocation.getForUser(user, false), "50_50", avatarDrawable, user);
+ imageView.setImage(ImageLocation.getForUserOrChat(user, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(user, ImageLocation.TYPE_STRIPPED), "50_50", avatarDrawable, user);
} else {
name = "";
}
diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Cells/ShareDialogCell.java b/TMessagesProj/src/main/java/org/telegram/ui/Cells/ShareDialogCell.java
index 43b396b3f..90557001c 100644
--- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/ShareDialogCell.java
+++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/ShareDialogCell.java
@@ -41,58 +41,68 @@ public class ShareDialogCell extends FrameLayout {
private CheckBox2 checkBox;
private AvatarDrawable avatarDrawable = new AvatarDrawable();
private TLRPC.User user;
- private boolean darkTheme;
+ private int currentType;
private float onlineProgress;
private long lastUpdateTime;
+ private long currentDialog;
private int currentAccount = UserConfig.selectedAccount;
- public ShareDialogCell(Context context, boolean forCall) {
+ public static final int TYPE_SHARE = 0;
+ public static final int TYPE_CALL = 1;
+ public static final int TYPE_CREATE = 2;
+
+ public ShareDialogCell(Context context, int type) {
super(context);
setWillNotDraw(false);
- darkTheme = forCall;
+ currentType = type;
imageView = new BackupImageView(context);
imageView.setRoundRadius(AndroidUtilities.dp(28));
- addView(imageView, LayoutHelper.createFrame(56, 56, Gravity.TOP | Gravity.CENTER_HORIZONTAL, 0, 7, 0, 0));
+ if (type == TYPE_CREATE) {
+ addView(imageView, LayoutHelper.createFrame(48, 48, Gravity.TOP | Gravity.CENTER_HORIZONTAL, 0, 7, 0, 0));
+ } else {
+ addView(imageView, LayoutHelper.createFrame(56, 56, Gravity.TOP | Gravity.CENTER_HORIZONTAL, 0, 7, 0, 0));
+ }
nameTextView = new TextView(context);
- nameTextView.setTextColor(Theme.getColor(forCall ? Theme.key_voipgroup_nameText : Theme.key_dialogTextBlack));
+ nameTextView.setTextColor(Theme.getColor(type == TYPE_CALL ? Theme.key_voipgroup_nameText : Theme.key_dialogTextBlack));
nameTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 12);
nameTextView.setMaxLines(2);
nameTextView.setGravity(Gravity.TOP | Gravity.CENTER_HORIZONTAL);
nameTextView.setLines(2);
nameTextView.setEllipsize(TextUtils.TruncateAt.END);
- addView(nameTextView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.LEFT | Gravity.TOP, 6, 66, 6, 0));
+ addView(nameTextView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.LEFT | Gravity.TOP, 6, currentType == TYPE_CREATE ? 58 : 66, 6, 0));
checkBox = new CheckBox2(context, 21);
- checkBox.setColor(Theme.key_dialogRoundCheckBox, forCall ? Theme.key_voipgroup_inviteMembersBackground : Theme.key_dialogBackground, Theme.key_dialogRoundCheckBoxCheck);
+ checkBox.setColor(Theme.key_dialogRoundCheckBox, type == TYPE_CALL ? Theme.key_voipgroup_inviteMembersBackground : Theme.key_dialogBackground, Theme.key_dialogRoundCheckBoxCheck);
checkBox.setDrawUnchecked(false);
checkBox.setDrawBackgroundAsArc(4);
checkBox.setProgressDelegate(progress -> {
float scale = 1.0f - (1.0f - 0.857f) * checkBox.getProgress();
imageView.setScaleX(scale);
imageView.setScaleY(scale);
+ invalidate();
});
- addView(checkBox, LayoutHelper.createFrame(24, 24, Gravity.CENTER_HORIZONTAL | Gravity.TOP, 19, 42, 0, 0));
+ addView(checkBox, LayoutHelper.createFrame(24, 24, Gravity.CENTER_HORIZONTAL | Gravity.TOP, 19, currentType == TYPE_CREATE ? -40 : 42, 0, 0));
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
- super.onMeasure(widthMeasureSpec, MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(103), MeasureSpec.EXACTLY));
+ super.onMeasure(widthMeasureSpec, MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(currentType == TYPE_CREATE ? 95 : 103), MeasureSpec.EXACTLY));
}
public void setDialog(int uid, boolean checked, CharSequence name) {
if (uid > 0) {
user = MessagesController.getInstance(currentAccount).getUser(uid);
avatarDrawable.setInfo(user);
- if (UserObject.isReplyUser(user)) {
+ if (currentType != TYPE_CREATE && UserObject.isReplyUser(user)) {
nameTextView.setText(LocaleController.getString("RepliesTitle", R.string.RepliesTitle));
avatarDrawable.setAvatarType(AvatarDrawable.AVATAR_TYPE_REPLIES);
imageView.setImage(null, null, avatarDrawable, user);
- } else if (UserObject.isUserSelf(user)) {
+ } else if (currentType != TYPE_CREATE && UserObject.isUserSelf(user)) {
nameTextView.setText(LocaleController.getString("SavedMessages", R.string.SavedMessages));
avatarDrawable.setAvatarType(AvatarDrawable.AVATAR_TYPE_SAVED);
imageView.setImage(null, null, avatarDrawable, user);
@@ -104,7 +114,7 @@ public class ShareDialogCell extends FrameLayout {
} else {
nameTextView.setText("");
}
- imageView.setImage(ImageLocation.getForUser(user, false), "50_50", avatarDrawable, user);
+ imageView.setImage(ImageLocation.getForUserOrChat(user, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(user, ImageLocation.TYPE_STRIPPED), "50_50", avatarDrawable, user);
}
} else {
user = null;
@@ -117,11 +127,16 @@ public class ShareDialogCell extends FrameLayout {
nameTextView.setText("");
}
avatarDrawable.setInfo(chat);
- imageView.setImage(ImageLocation.getForChat(chat, false), "50_50", avatarDrawable, chat);
+ imageView.setImage(ImageLocation.getForUserOrChat(chat, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(chat, ImageLocation.TYPE_STRIPPED), "50_50", avatarDrawable, chat);
}
+ currentDialog = uid;
checkBox.setChecked(checked, false);
}
+ public long getCurrentDialog() {
+ return currentDialog;
+ }
+
public void setChecked(boolean checked, boolean animated) {
checkBox.setChecked(checked, animated);
}
@@ -129,7 +144,7 @@ public class ShareDialogCell extends FrameLayout {
@Override
protected boolean drawChild(Canvas canvas, View child, long drawingTime) {
boolean result = super.drawChild(canvas, child, drawingTime);
- if (child == imageView) {
+ if (child == imageView && currentType != TYPE_CREATE) {
if (user != null && !MessagesController.isSupportUser(user)) {
long newTime = SystemClock.elapsedRealtime();
long dt = newTime - lastUpdateTime;
@@ -142,7 +157,7 @@ public class ShareDialogCell extends FrameLayout {
if (isOnline || onlineProgress != 0) {
int top = imageView.getBottom() - AndroidUtilities.dp(6);
int left = imageView.getRight() - AndroidUtilities.dp(10);
- Theme.dialogs_onlineCirclePaint.setColor(Theme.getColor(darkTheme ? Theme.key_voipgroup_inviteMembersBackground : Theme.key_windowBackgroundWhite));
+ Theme.dialogs_onlineCirclePaint.setColor(Theme.getColor(currentType == TYPE_CALL ? Theme.key_voipgroup_inviteMembersBackground : Theme.key_windowBackgroundWhite));
canvas.drawCircle(left, top, AndroidUtilities.dp(7) * onlineProgress, Theme.dialogs_onlineCirclePaint);
Theme.dialogs_onlineCirclePaint.setColor(Theme.getColor(Theme.key_chats_onlineCircle));
canvas.drawCircle(left, top, AndroidUtilities.dp(5) * onlineProgress, Theme.dialogs_onlineCirclePaint);
@@ -177,6 +192,6 @@ public class ShareDialogCell extends FrameLayout {
int cy = imageView.getTop() + imageView.getMeasuredHeight() / 2;
Theme.checkboxSquare_checkPaint.setColor(Theme.getColor(Theme.key_dialogRoundCheckBox));
Theme.checkboxSquare_checkPaint.setAlpha((int) (checkBox.getProgress() * 255));
- canvas.drawCircle(cx, cy, AndroidUtilities.dp(28), Theme.checkboxSquare_checkPaint);
+ canvas.drawCircle(cx, cy, AndroidUtilities.dp(24), Theme.checkboxSquare_checkPaint);
}
}
diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Cells/SharingLiveLocationCell.java b/TMessagesProj/src/main/java/org/telegram/ui/Cells/SharingLiveLocationCell.java
index acaa813a0..aabcfacc4 100644
--- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/SharingLiveLocationCell.java
+++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/SharingLiveLocationCell.java
@@ -124,14 +124,14 @@ public class SharingLiveLocationCell extends FrameLayout {
if (user != null) {
avatarDrawable = new AvatarDrawable(user);
name = UserObject.getUserName(user);
- avatarImageView.setImage(ImageLocation.getForUser(user, false), "50_50", avatarDrawable, user);
+ avatarImageView.setImage(ImageLocation.getForUserOrChat(user, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(user, ImageLocation.TYPE_STRIPPED), "50_50", avatarDrawable, user);
}
} else {
TLRPC.Chat chat = MessagesController.getInstance(currentAccount).getChat(-lowerId);
if (chat != null) {
avatarDrawable = new AvatarDrawable(chat);
name = chat.title;
- avatarImageView.setImage(ImageLocation.getForChat(chat, false), "50_50", avatarDrawable, chat);
+ avatarImageView.setImage(ImageLocation.getForUserOrChat(chat, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(chat, ImageLocation.TYPE_STRIPPED), "50_50", avatarDrawable, chat);
}
}
nameTextView.setText(name);
@@ -177,14 +177,14 @@ public class SharingLiveLocationCell extends FrameLayout {
if (user != null) {
avatarDrawable = new AvatarDrawable(user);
name = UserObject.getUserName(user);
- avatarImageView.setImage(ImageLocation.getForUser(user, false), "50_50", avatarDrawable, user);
+ avatarImageView.setImage(ImageLocation.getForUserOrChat(user, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(user, ImageLocation.TYPE_STRIPPED), "50_50", avatarDrawable, user);
}
} else {
TLRPC.Chat chat = MessagesController.getInstance(currentAccount).getChat(-fromId);
if (chat != null) {
avatarDrawable = new AvatarDrawable(chat);
name = chat.title;
- avatarImageView.setImage(ImageLocation.getForChat(chat, false), "50_50", avatarDrawable, chat);
+ avatarImageView.setImage(ImageLocation.getForUserOrChat(chat, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(chat, ImageLocation.TYPE_STRIPPED), "50_50", avatarDrawable, chat);
}
}
}
@@ -216,14 +216,14 @@ public class SharingLiveLocationCell extends FrameLayout {
if (user != null) {
avatarDrawable.setInfo(user);
nameTextView.setText(ContactsController.formatName(user.first_name, user.last_name));
- avatarImageView.setImage(ImageLocation.getForUser(user, false), "50_50", avatarDrawable, user);
+ avatarImageView.setImage(ImageLocation.getForUserOrChat(user, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(user, ImageLocation.TYPE_STRIPPED), "50_50", avatarDrawable, user);
}
} else {
TLRPC.Chat chat = MessagesController.getInstance(currentAccount).getChat(-lower_id);
if (chat != null) {
avatarDrawable.setInfo(chat);
nameTextView.setText(chat.title);
- avatarImageView.setImage(ImageLocation.getForChat(chat, false), "50_50", avatarDrawable, chat);
+ avatarImageView.setImage(ImageLocation.getForUserOrChat(chat, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(chat, ImageLocation.TYPE_STRIPPED), "50_50", avatarDrawable, chat);
}
}
@@ -249,14 +249,14 @@ public class SharingLiveLocationCell extends FrameLayout {
if (user != null) {
avatarDrawable.setInfo(user);
nameTextView.setText(ContactsController.formatName(user.first_name, user.last_name));
- avatarImageView.setImage(ImageLocation.getForUser(user, false), "50_50", avatarDrawable, user);
+ avatarImageView.setImage(ImageLocation.getForUserOrChat(user, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(user, ImageLocation.TYPE_STRIPPED), "50_50", avatarDrawable, user);
}
} else {
TLRPC.Chat chat = MessagesController.getInstance(currentAccount).getChat(-lower_id);
if (chat != null) {
avatarDrawable.setInfo(chat);
nameTextView.setText(chat.title);
- avatarImageView.setImage(ImageLocation.getForChat(chat, false), "50_50", avatarDrawable, chat);
+ avatarImageView.setImage(ImageLocation.getForUserOrChat(chat, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(chat, ImageLocation.TYPE_STRIPPED), "50_50", avatarDrawable, chat);
}
}
}
diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Cells/StatisticPostInfoCell.java b/TMessagesProj/src/main/java/org/telegram/ui/Cells/StatisticPostInfoCell.java
index e66fd1887..cbc76b726 100644
--- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/StatisticPostInfoCell.java
+++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/StatisticPostInfoCell.java
@@ -113,7 +113,7 @@ public class StatisticPostInfoCell extends FrameLayout {
public void setData(StatisticActivity.MemberData memberData) {
avatarDrawable.setInfo(memberData.user);
- imageView.setImage(ImageLocation.getForUser(memberData.user, false), "50_50", avatarDrawable, memberData.user);
+ imageView.setImage(ImageLocation.getForUserOrChat(memberData.user, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(memberData.user, ImageLocation.TYPE_STRIPPED), "50_50", avatarDrawable, memberData.user);
imageView.setRoundRadius(AndroidUtilities.dp(46) >> 1);
message.setText(memberData.user.first_name);
date.setText(memberData.description);
diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Cells/UserCell.java b/TMessagesProj/src/main/java/org/telegram/ui/Cells/UserCell.java
index 7fe3538c9..68f59d26b 100644
--- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/UserCell.java
+++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/UserCell.java
@@ -493,9 +493,9 @@ public class UserCell extends FrameLayout {
lastAvatar = photo;
if (currentUser != null) {
- avatarImageView.setImage(ImageLocation.getForUser(currentUser, false), "50_50", avatarDrawable, currentUser);
+ avatarImageView.setImage(ImageLocation.getForUserOrChat(currentUser, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(currentUser, ImageLocation.TYPE_STRIPPED), "50_50", avatarDrawable, currentUser);
} else if (currentChat != null) {
- avatarImageView.setImage(ImageLocation.getForChat(currentChat, false), "50_50", avatarDrawable, currentChat);
+ avatarImageView.setImage(ImageLocation.getForUserOrChat(currentChat, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(currentChat, ImageLocation.TYPE_STRIPPED), "50_50", avatarDrawable, currentChat);
} else {
avatarImageView.setImageDrawable(avatarDrawable);
}
diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Cells/UserCell2.java b/TMessagesProj/src/main/java/org/telegram/ui/Cells/UserCell2.java
index 86c747fd1..8bfb329a0 100644
--- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/UserCell2.java
+++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/UserCell2.java
@@ -260,7 +260,7 @@ public class UserCell2 extends FrameLayout {
statusTextView.setText(LocaleController.formatUserStatus(currentAccount, currentUser));
}
}
- avatarImageView.setImage(ImageLocation.getForUser(currentUser, false), "50_50", avatarDrawable, currentUser);
+ avatarImageView.setImage(ImageLocation.getForUserOrChat(currentUser, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(currentUser, ImageLocation.TYPE_STRIPPED), "50_50", avatarDrawable, currentUser);
} else if (currentChat != null) {
statusTextView.setTextColor(statusColor);
if (ChatObject.isChannel(currentChat) && !currentChat.megagroup) {
@@ -282,7 +282,7 @@ public class UserCell2 extends FrameLayout {
statusTextView.setText(LocaleController.getString("MegaPublic", R.string.MegaPublic));
}
}
- avatarImageView.setImage(ImageLocation.getForChat(currentChat, false), "50_50", avatarDrawable, currentObject);
+ avatarImageView.setImage(ImageLocation.getForUserOrChat(currentChat, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(currentChat, ImageLocation.TYPE_STRIPPED), "50_50", avatarDrawable, currentObject);
} else {
avatarImageView.setImageDrawable(avatarDrawable);
}
diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ChangePhoneActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ChangePhoneActivity.java
index b8733a762..375847929 100644
--- a/TMessagesProj/src/main/java/org/telegram/ui/ChangePhoneActivity.java
+++ b/TMessagesProj/src/main/java/org/telegram/ui/ChangePhoneActivity.java
@@ -27,6 +27,7 @@ import android.graphics.PorterDuff;
import android.graphics.PorterDuffColorFilter;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
+import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.telephony.PhoneNumberUtils;
@@ -981,8 +982,8 @@ public class ChangePhoneActivity extends BaseFragment {
PackageInfo pInfo = ApplicationLoader.applicationContext.getPackageManager().getPackageInfo(ApplicationLoader.applicationContext.getPackageName(), 0);
String version = String.format(Locale.US, "%s (%d)", pInfo.versionName, pInfo.versionCode);
- Intent mailer = new Intent(Intent.ACTION_SEND);
- mailer.setType("message/rfc822");
+ Intent mailer = new Intent(Intent.ACTION_SENDTO);
+ mailer.setData(Uri.parse("mailto:"));
mailer.putExtra(Intent.EXTRA_EMAIL, new String[]{"sms@stel.com"});
mailer.putExtra(Intent.EXTRA_SUBJECT, "Android registration/login issue " + version + " " + emailPhone);
mailer.putExtra(Intent.EXTRA_TEXT, "Phone: " + requestPhone + "\nApp version: " + version + "\nOS version: SDK " + Build.VERSION.SDK_INT + "\nDevice Name: " + Build.MANUFACTURER + Build.MODEL + "\nLocale: " + Locale.getDefault() + "\nError: " + lastError);
diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ChannelAdminLogActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ChannelAdminLogActivity.java
index 0ed2568ea..085368ecf 100644
--- a/TMessagesProj/src/main/java/org/telegram/ui/ChannelAdminLogActivity.java
+++ b/TMessagesProj/src/main/java/org/telegram/ui/ChannelAdminLogActivity.java
@@ -2754,7 +2754,7 @@ public class ChannelAdminLogActivity extends BaseFragment implements Notificatio
themeDescriptions.add(new ThemeDescription(chatListView, ThemeDescription.FLAG_TEXTCOLOR, new Class[]{ChatActionCell.class}, Theme.chat_actionTextPaint, null, null, Theme.key_chat_serviceText));
themeDescriptions.add(new ThemeDescription(chatListView, ThemeDescription.FLAG_LINKCOLOR, new Class[]{ChatActionCell.class}, Theme.chat_actionTextPaint, null, null, Theme.key_chat_serviceLink));
- themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_shareIconDrawable, Theme.chat_botInlineDrawable, Theme.chat_botLinkDrawalbe, Theme.chat_goIconDrawable, Theme.chat_commentStickerDrawable}, null, Theme.key_chat_serviceIcon));
+ themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_botCardDrawalbe, Theme.chat_shareIconDrawable, Theme.chat_botInlineDrawable, Theme.chat_botLinkDrawalbe, Theme.chat_goIconDrawable, Theme.chat_commentStickerDrawable}, null, Theme.key_chat_serviceIcon));
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class, ChatActionCell.class}, null, null, null, Theme.key_chat_serviceBackground));
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class, ChatActionCell.class}, null, null, null, Theme.key_chat_serviceBackgroundSelected));
diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ChannelCreateActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ChannelCreateActivity.java
index 203d005f3..470a6c109 100644
--- a/TMessagesProj/src/main/java/org/telegram/ui/ChannelCreateActivity.java
+++ b/TMessagesProj/src/main/java/org/telegram/ui/ChannelCreateActivity.java
@@ -1003,7 +1003,7 @@ public class ChannelCreateActivity extends BaseFragment implements NotificationC
bundle.putInt("chat_id", chat_id);
bundle.putBoolean("canCreatePublic", canCreatePublic);
if (inputPhoto != null || inputVideo != null) {
- MessagesController.getInstance(currentAccount).changeChatAvatar(chat_id, null, inputPhoto, inputVideo, videoTimestamp, inputVideoPath, avatar, avatarBig);
+ MessagesController.getInstance(currentAccount).changeChatAvatar(chat_id, null, inputPhoto, inputVideo, videoTimestamp, inputVideoPath, avatar, avatarBig, null);
}
presentFragment(new ChannelCreateActivity(bundle), true);
}
diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java
index 1fe23d464..e5f01c9fc 100644
--- a/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java
+++ b/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java
@@ -737,6 +737,8 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
private boolean invalidateMessagesVisiblePart;
private boolean scrollByTouch;
+ private PinchToZoomHelper pinchToZoomHelper;
+
public float getChatListViewPadding() {
return chatListViewPaddingTop;
}
@@ -1666,6 +1668,9 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
if (chatListItemAnimator != null) {
chatListItemAnimator.onDestroy();
}
+ if (pinchToZoomHelper != null) {
+ pinchToZoomHelper.clear();
+ }
}
@Override
@@ -1824,7 +1829,19 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
alert.setDelegate(new ClearHistoryAlert.ClearHistoryAlertDelegate() {
@Override
public void onClearHistory(boolean revoke) {
- performHistoryClear(revoke);
+ if (revoke && currentUser != null) {
+ getMessagesStorage().getMessagesCount(currentUser.id, (count) -> {
+ if (count >= 50) {
+ AlertsCreator.createClearOrDeleteDialogAlert(ChatActivity.this, true, false, true, null, currentUser, false, false, (param) -> {
+ performHistoryClear(true);
+ });
+ } else {
+ performHistoryClear(true);
+ }
+ });
+ } else {
+ performHistoryClear(revoke);
+ }
}
@Override
@@ -1960,6 +1977,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
avatarContainer.onDestroy();
}
avatarContainer = new ChatAvatarContainer(context, this, currentEncryptedChat != null);
+ AndroidUtilities.updateViewVisibilityAnimated(avatarContainer, true, 1f, false);
if (inPreviewMode || inBubbleMode) {
avatarContainer.setOccupyStatusBar(false);
}
@@ -2401,6 +2419,10 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
}
}
+ if (pinchToZoomHelper.isInOverlayMode()) {
+ return pinchToZoomHelper.onTouchEvent(ev);
+ }
+
if (AvatarPreviewer.hasVisibleInstance()) {
AvatarPreviewer.getInstance().onTouchEvent(ev);
return true;
@@ -5566,6 +5588,26 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
return;
}
TLRPC.BotInlineResult result = (TLRPC.BotInlineResult) object;
+ if (currentEncryptedChat != null) {
+ int error = 0;
+ if (result.send_message instanceof TLRPC.TL_botInlineMessageMediaAuto && "game".equals(result.type)) {
+ error = 1;
+ } else if (result.send_message instanceof TLRPC.TL_botInlineMessageMediaInvoice) {
+ error = 2;
+ }
+ if (error != 0) {
+ AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
+ builder.setTitle(LocaleController.getString("SendMessageTitle", R.string.SendMessageTitle));
+ if (error == 1) {
+ builder.setMessage(LocaleController.getString("GameCantSendSecretChat", R.string.GameCantSendSecretChat));
+ } else {
+ builder.setMessage(LocaleController.getString("InvoiceCantSendSecretChat", R.string.InvoiceCantSendSecretChat));
+ }
+ builder.setNegativeButton(LocaleController.getString("OK", R.string.OK), null);
+ showDialog(builder.create());
+ return;
+ }
+ }
if ((result.type.equals("photo") && (result.photo != null || result.content != null) ||
result.type.equals("gif") && (result.document != null || result.content != null) ||
result.type.equals("video") && (result.document != null/* || result.content_url != null*/))) {
@@ -5743,7 +5785,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
}
});
- topUndoView = new UndoView(context, true) {
+ topUndoView = new UndoView(context, this, true) {
@Override
public void didPressUrl(CharacterStyle span) {
didPressMessageUrl(span, false, null, null);
@@ -6362,10 +6404,15 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
replyLayout.setOnClickListener(v -> {
if (forwardingMessages != null && !forwardingMessages.isEmpty()) {
int hasPoll = 0;
+ boolean hasInvoice = false;
for (int a = 0, N = forwardingMessages.size(); a < N; a++) {
MessageObject messageObject = forwardingMessages.get(a);
- if (hasPoll != 2 && messageObject.isPoll()) {
- hasPoll = messageObject.isPublicPoll() ? 2 : 1;
+ if (messageObject.isPoll()) {
+ if (hasPoll != 2) {
+ hasPoll = messageObject.isPublicPoll() ? 2 : 1;
+ }
+ } else if (messageObject.isInvoice()) {
+ hasInvoice = true;
}
selectedMessagesIds[0].put(messageObject.getId(), messageObject);
}
@@ -6373,6 +6420,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
args.putBoolean("onlySelect", true);
args.putInt("dialogsType", 3);
args.putInt("hasPoll", hasPoll);
+ args.putBoolean("hasInvoice", hasInvoice);
args.putInt("messagesCount", forwardingMessages.size());
DialogsActivity fragment = new DialogsActivity(args);
fragment.setDelegate(ChatActivity.this);
@@ -6422,10 +6470,15 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
builder.setNegativeButton(LocaleController.getString("SelectOtherChat", R.string.SelectOtherChat), (dialogInterface, i) -> {
if (forwardingMessages != null && !forwardingMessages.isEmpty()) {
int hasPoll = 0;
+ boolean hasInvoice = false;
for (int a = 0, N = forwardingMessages.size(); a < N; a++) {
MessageObject messageObject = forwardingMessages.get(a);
- if (hasPoll != 2 && messageObject.isPoll()) {
- hasPoll = messageObject.isPublicPoll() ? 2 : 1;
+ if (messageObject.isPoll()) {
+ if (hasPoll != 2) {
+ hasPoll = messageObject.isPublicPoll() ? 2 : 1;
+ }
+ } else if (messageObject.isInvoice()) {
+ hasInvoice = true;
}
selectedMessagesIds[0].put(messageObject.getId(), messageObject);
}
@@ -6433,6 +6486,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
args.putBoolean("onlySelect", true);
args.putInt("dialogsType", 3);
args.putInt("hasPoll", hasPoll);
+ args.putBoolean("hasInvoice", hasInvoice);
args.putInt("messagesCount", forwardingMessages.size());
DialogsActivity fragment = new DialogsActivity(args);
fragment.setDelegate(ChatActivity.this);
@@ -6911,7 +6965,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
contentView.addView(searchContainer, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 51, Gravity.BOTTOM));
- undoView = new UndoView(context);
+ undoView = new UndoView(context, this);
undoView.setAdditionalTranslationY(AndroidUtilities.dp(51));
contentView.addView(undoView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.BOTTOM | Gravity.LEFT, 8, 0, 8, 8));
@@ -7006,6 +7060,109 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
if (replyingMessageObject != null) {
chatActivityEnterView.setReplyingMessageObject(replyingMessageObject);
}
+
+ ViewGroup decorView;
+ if (Build.VERSION.SDK_INT >= 21) {
+ decorView = (ViewGroup) getParentActivity().getWindow().getDecorView();
+ } else {
+ decorView = contentView;
+ }
+ pinchToZoomHelper = new PinchToZoomHelper(decorView) {
+ @Override
+ protected void drawOverlays(Canvas canvas, float alpha, float parentOffsetX, float parentOffsetY, float clipTop, float clipBottom) {
+ if (alpha > 0) {
+ View view = getChild();
+ if (view instanceof ChatMessageCell) {
+ ChatMessageCell cell = (ChatMessageCell) view;
+
+ int top = (int) Math.max(clipTop, parentOffsetY);
+ int bottom = (int) Math.min(clipBottom, parentOffsetY + cell.getMeasuredHeight());
+ AndroidUtilities.rectTmp.set(parentOffsetX, top, parentOffsetX + cell.getMeasuredWidth(), bottom);
+ canvas.saveLayerAlpha(AndroidUtilities.rectTmp, (int) (255 * alpha), Canvas.ALL_SAVE_FLAG);
+ canvas.translate(parentOffsetX, parentOffsetY);
+ cell.drawFromPinchToZoom = true;
+ cell.drawOverlays(canvas);
+ if (cell.shouldDrawTimeOnMedia() && cell.getCurrentMessagesGroup() == null) {
+ cell.drawTime(canvas, 1f, false);
+ }
+ cell.drawFromPinchToZoom = false;
+ canvas.restore();
+ }
+ }
+ }
+ };
+ pinchToZoomHelper.setCallback(new PinchToZoomHelper.Callback() {
+
+ @Override
+ public TextureView getCurrentTextureView() {
+ return videoTextureView;
+ }
+
+ @Override
+ public void onZoomStarted(MessageObject messageObject) {
+ chatListView.cancelClickRunnables(true);
+ chatListView.stopScroll();
+ if (MediaController.getInstance().isPlayingMessage(messageObject)) {
+ contentView.removeView(videoPlayerContainer);
+ videoPlayerContainer = null;
+ videoTextureView = null;
+ aspectRatioFrameLayout = null;
+ }
+
+ for (int i = 0; i < chatListView.getChildCount(); i++) {
+ if (chatListView.getChildAt(i) instanceof ChatMessageCell) {
+ ChatMessageCell cell = (ChatMessageCell) chatListView.getChildAt(i);
+ if (cell.getMessageObject().getId() == messageObject.getId()) {
+ cell.getPhotoImage().setVisible(false, true);
+ }
+ }
+ }
+ }
+
+ @Override
+ public void onZoomFinished(MessageObject messageObject) {
+ if (messageObject == null) {
+ return;
+ }
+ if (MediaController.getInstance().isPlayingMessage(messageObject)) {
+ for (int i = 0; i < chatListView.getChildCount(); i++) {
+ if (chatListView.getChildAt(i) instanceof ChatMessageCell) {
+ ChatMessageCell cell = (ChatMessageCell) chatListView.getChildAt(i);
+ if (cell.getMessageObject().getId() == messageObject.getId()) {
+ AnimatedFileDrawable animation = cell.getPhotoImage().getAnimation();
+ if (animation.isRunning()) {
+ animation.stop();
+ }
+ if (animation != null) {
+ Bitmap bitmap = animation.getAnimatedBitmap();
+ if (bitmap != null) {
+ try {
+ Bitmap src = pinchToZoomHelper.getVideoBitmap(bitmap.getWidth(), bitmap.getHeight());
+ Canvas canvas = new Canvas(bitmap);
+ canvas.drawBitmap(src, 0, 0, null);
+ src.recycle();
+ } catch (Throwable e) {
+ FileLog.e(e);
+ }
+ }
+ }
+ }
+ }
+ }
+ createTextureView(true);
+ MediaController.getInstance().setTextureView(videoTextureView, aspectRatioFrameLayout, videoPlayerContainer, true);
+ }
+ chatListView.invalidate();
+ }
+
+ });
+ pinchToZoomHelper.setClipBoundsListener(new PinchToZoomHelper.ClipBoundsListener() {
+ @Override
+ public void getClipTopBottom(float[] topBottom) {
+ topBottom[1] = chatListView.getBottom();
+ topBottom[0] = chatListView.getTop() + chatListViewPaddingTop - AndroidUtilities.dp(4);
+ }
+ });
return fragmentView;
}
@@ -7597,6 +7754,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
private void openForward() {
int hasPoll = 0;
+ boolean hasInvoice = false;
for (int a = 0; a < 2; a++) {
for (int b = 0; b < selectedMessagesIds[a].size(); b++) {
MessageObject messageObject = selectedMessagesIds[a].valueAt(b);
@@ -7605,6 +7763,8 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
if (hasPoll == 2) {
break;
}
+ } else if (messageObject.isInvoice()) {
+ hasInvoice = true;
}
}
if (hasPoll == 2) {
@@ -7616,6 +7776,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
args.putInt("dialogsType", 3);
args.putInt("messagesCount", canForwardMessagesCount);
args.putInt("hasPoll", hasPoll);
+ args.putBoolean("hasInvoice", hasInvoice);
DialogsActivity fragment = new DialogsActivity(args);
fragment.setDelegate(ChatActivity.this);
presentFragment(fragment);
@@ -7851,7 +8012,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
return;
}
if (chatAttachAlert == null) {
- chatAttachAlert = new ChatAttachAlert(getParentActivity(), this) {
+ chatAttachAlert = new ChatAttachAlert(getParentActivity(), this, false) {
@Override
public void dismissInternal() {
if (chatAttachAlert.isShowing()) {
@@ -9805,7 +9966,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
}
private void moveScrollToLastMessage() {
- if (chatListView != null && !messages.isEmpty()) {
+ if (chatListView != null && !messages.isEmpty() && !pinchToZoomHelper.isInOverlayMode()) {
chatLayoutManager.scrollToPositionWithOffset(0, 0);
chatListView.stopScroll();
}
@@ -18050,11 +18211,13 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
return;
}
- MessageObject message = null;
+ MessageObject message;
if (v instanceof ChatMessageCell) {
message = ((ChatMessageCell) v).getMessageObject();
} else if (v instanceof ChatActionCell) {
message = ((ChatActionCell) v).getMessageObject();
+ } else {
+ message = null;
}
if (message == null) {
return;
@@ -18072,7 +18235,17 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
if (avatarContainer.openSetTimer()) {
return;
}
- } else if (message.messageOwner.action instanceof TLRPC.TL_messageActionGroupCall || message.messageOwner.action instanceof TLRPC.TL_messageActionInviteToGroupCall) {
+ } else if (message.messageOwner.action instanceof TLRPC.TL_messageActionPaymentSent && message.replyMessageObject != null && message.replyMessageObject.isInvoice()) {
+ TLRPC.TL_payments_getPaymentReceipt req = new TLRPC.TL_payments_getPaymentReceipt();
+ req.msg_id = message.getId();
+ req.peer = getMessagesController().getInputPeer(message.messageOwner.peer_id);
+ getConnectionsManager().sendRequest(req, (response, error) -> AndroidUtilities.runOnUIThread(() -> {
+ if (response instanceof TLRPC.TL_payments_paymentReceipt) {
+ presentFragment(new PaymentFormActivity((TLRPC.TL_payments_paymentReceipt) response));
+ }
+ }), ConnectionsManager.RequestFlagFailOnServerErrors);
+ return;
+ } else if (message.messageOwner.action instanceof TLRPC.TL_messageActionGroupCall || message.messageOwner.action instanceof TLRPC.TL_messageActionInviteToGroupCall || message.messageOwner.action instanceof TLRPC.TL_messageActionGroupCallScheduled) {
if (getParentActivity() == null) {
return;
}
@@ -18080,7 +18253,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
if (sharedInstance != null) {
if (sharedInstance.groupCall != null && message.messageOwner.action.call.id == sharedInstance.groupCall.call.id) {
if (getParentActivity() instanceof LaunchActivity) {
- GroupCallActivity.create((LaunchActivity) getParentActivity(), AccountInstance.getInstance(currentAccount));
+ GroupCallActivity.create((LaunchActivity) getParentActivity(), AccountInstance.getInstance(currentAccount), null, null, false, null);
} else {
Intent intent = new Intent(getParentActivity(), LaunchActivity.class).setAction("voip_chat");
intent.putExtra("currentAccount", VoIPService.getSharedInstance().getAccount());
@@ -18093,7 +18266,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
return;
} else if (fragmentContextView != null && getGroupCall() != null) {
if (VoIPService.getSharedInstance() != null) {
- GroupCallActivity.create((LaunchActivity) getParentActivity(), AccountInstance.getInstance(VoIPService.getSharedInstance().getAccount()));
+ GroupCallActivity.create((LaunchActivity) getParentActivity(), AccountInstance.getInstance(VoIPService.getSharedInstance().getAccount()), null, null, false, null);
} else {
ChatObject.Call call = getGroupCall();
if (call == null) {
@@ -19077,6 +19250,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
args.putInt("dialogsType", 3);
args.putInt("messagesCount", forwardingMessageGroup == null ? 1 : forwardingMessageGroup.messages.size());
args.putInt("hasPoll", forwardingMessage.isPoll() ? (forwardingMessage.isPublicPoll() ? 2 : 1) : 0);
+ args.putBoolean("hasInvoice", forwardingMessage.isInvoice());
DialogsActivity fragment = new DialogsActivity(args);
fragment.setDelegate(this);
presentFragment(fragment);
@@ -21550,6 +21724,11 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
fireworksOverlay.start();
fireworksOverlay.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
}
+
+ @Override
+ public PinchToZoomHelper getPinchToZoomHelper() {
+ return pinchToZoomHelper;
+ }
});
if (currentEncryptedChat == null) {
chatMessageCell.setAllowAssistant(true);
@@ -22406,6 +22585,9 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
public void onStartAnimation() {
super.onStartAnimation();
scrollCallbackAnimationIndex = getNotificationCenter().setAnimationInProgress(scrollCallbackAnimationIndex, allowedNotificationsDuringChatListAnimations);
+ if (pinchToZoomHelper.isInOverlayMode()) {
+ pinchToZoomHelper.finishZoom();
+ }
}
@Override
@@ -22562,7 +22744,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
themeDescriptions.add(new ThemeDescription(chatListView, ThemeDescription.FLAG_TEXTCOLOR, new Class[]{ChatActionCell.class}, Theme.chat_actionTextPaint, null, null, Theme.key_chat_serviceText));
themeDescriptions.add(new ThemeDescription(chatListView, ThemeDescription.FLAG_LINKCOLOR, new Class[]{ChatActionCell.class}, Theme.chat_actionTextPaint, null, null, Theme.key_chat_serviceLink));
- themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_shareIconDrawable, Theme.chat_replyIconDrawable, Theme.chat_botInlineDrawable, Theme.chat_botLinkDrawalbe, Theme.chat_goIconDrawable, Theme.chat_commentStickerDrawable}, null, Theme.key_chat_serviceIcon));
+ themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_botCardDrawalbe, Theme.chat_shareIconDrawable, Theme.chat_replyIconDrawable, Theme.chat_botInlineDrawable, Theme.chat_botLinkDrawalbe, Theme.chat_goIconDrawable, Theme.chat_commentStickerDrawable}, null, Theme.key_chat_serviceIcon));
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class, ChatActionCell.class}, null, null, null, Theme.key_chat_serviceBackground));
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class, ChatActionCell.class}, null, null, null, Theme.key_chat_serviceBackgroundSelected));
diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ChatEditActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ChatEditActivity.java
index 9e065c7d6..490ef9351 100644
--- a/TMessagesProj/src/main/java/org/telegram/ui/ChatEditActivity.java
+++ b/TMessagesProj/src/main/java/org/telegram/ui/ChatEditActivity.java
@@ -584,7 +584,7 @@ public class ChatEditActivity extends BaseFragment implements ImageUpdater.Image
setAvatarCell.setColors(Theme.key_windowBackgroundWhiteBlueIcon, Theme.key_windowBackgroundWhiteBlueButton);
setAvatarCell.setOnClickListener(v -> imageUpdater.openMenu(avatar != null, () -> {
avatar = null;
- MessagesController.getInstance(currentAccount).changeChatAvatar(chatId, null, null, null, 0, null, null, null);
+ MessagesController.getInstance(currentAccount).changeChatAvatar(chatId, null, null, null, 0, null, null, null, null);
showAvatarProgress(false, true);
avatarImage.setImage(null, null, avatarDrawable, currentChat);
}, null));
@@ -775,7 +775,7 @@ public class ChatEditActivity extends BaseFragment implements ImageUpdater.Image
blockCell = new TextCell(context);
blockCell.setBackgroundDrawable(Theme.getSelectorDrawable(false));
- blockCell.setVisibility(ChatObject.isChannel(currentChat) || currentChat.creator ? View.VISIBLE : View.GONE);
+ blockCell.setVisibility(ChatObject.isChannel(currentChat) || currentChat.creator || ChatObject.hasAdminRights(currentChat) && ChatObject.canChangeChatInfo(currentChat) ? View.VISIBLE : View.GONE);
blockCell.setOnClickListener(v -> {
Bundle args = new Bundle();
args.putInt("chat_id", chatId);
@@ -937,8 +937,8 @@ public class ChatEditActivity extends BaseFragment implements ImageUpdater.Image
boolean hasPhoto;
if (currentChat.photo != null) {
avatar = currentChat.photo.photo_small;
- ImageLocation location = ImageLocation.getForChat(currentChat, false);
- avatarImage.setImage(location, "50_50", avatarDrawable, currentChat);
+ ImageLocation location = ImageLocation.getForUserOrChat(currentChat, ImageLocation.TYPE_SMALL);
+ avatarImage.setImage(location, "50_50", ImageLocation.getForUserOrChat(currentChat, ImageLocation.TYPE_STRIPPED), "50_50", avatarDrawable, currentChat);
hasPhoto = location != null;
} else {
avatarImage.setImageDrawable(avatarDrawable);
@@ -1001,7 +1001,7 @@ public class ChatEditActivity extends BaseFragment implements ImageUpdater.Image
AndroidUtilities.runOnUIThread(() -> {
avatar = smallSize.location;
if (photo != null || video != null) {
- MessagesController.getInstance(currentAccount).changeChatAvatar(chatId, null, photo, video, videoStartTimestamp, videoPath, smallSize.location, bigSize.location);
+ MessagesController.getInstance(currentAccount).changeChatAvatar(chatId, null, photo, video, videoStartTimestamp, videoPath, smallSize.location, bigSize.location, null);
if (createAfterUpload) {
try {
if (progressDialog != null && progressDialog.isShowing()) {
diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ChatLinkActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ChatLinkActivity.java
index 9ade21d3a..08f7c6873 100644
--- a/TMessagesProj/src/main/java/org/telegram/ui/ChatLinkActivity.java
+++ b/TMessagesProj/src/main/java/org/telegram/ui/ChatLinkActivity.java
@@ -499,7 +499,7 @@ public class ChatLinkActivity extends BaseFragment implements NotificationCenter
frameLayout2.addView(textView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, (LocaleController.isRTL ? 21 : 76), 11, (LocaleController.isRTL ? 76 : 21), 0));
frameLayout2.addView(messageTextView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, 24, 57, 24, 9));
avatarDrawable.setInfo(chat);
- imageView.setImage(ImageLocation.getForChat(chat, false), "50_50", avatarDrawable, chat);
+ imageView.setImage(ImageLocation.getForUserOrChat(chat, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(chat, ImageLocation.TYPE_STRIPPED), "50_50", avatarDrawable, chat);
builder.setPositiveButton(LocaleController.getString("DiscussionLinkGroup", R.string.DiscussionLinkGroup), (dialogInterface, i) -> {
if (chatFull.hidden_prehistory) {
MessagesController.getInstance(currentAccount).toogleChannelInvitesHistory(chat.id, false);
diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ChatUsersActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ChatUsersActivity.java
index 18584bfff..02243691d 100644
--- a/TMessagesProj/src/main/java/org/telegram/ui/ChatUsersActivity.java
+++ b/TMessagesProj/src/main/java/org/telegram/ui/ChatUsersActivity.java
@@ -514,7 +514,7 @@ public class ChatUsersActivity extends BaseFragment implements NotificationCente
if (slowmodeInfoRow == -1 && gigaHeaderRow == -1 || removedUsersRow != -1) {
participantsDividerRow = rowCount++;
}
- if (ChatObject.canBlockUsers(currentChat)) {
+ if (ChatObject.canBlockUsers(currentChat) && (ChatObject.isChannel(currentChat) || currentChat.creator)) {
addNewRow = rowCount++;
}
@@ -726,6 +726,9 @@ public class ChatUsersActivity extends BaseFragment implements NotificationCente
} else {
searchItem.setSearchFieldHint(LocaleController.getString("Search", R.string.Search));
}
+ if (!(ChatObject.isChannel(currentChat) || currentChat.creator)) {
+ searchItem.setVisibility(View.GONE);
+ }
if (type == TYPE_KICKED) {
doneItem = menu.addItemWithWidth(done_button, R.drawable.ic_done, AndroidUtilities.dp(56), LocaleController.getString("Done", R.string.Done));
@@ -2109,7 +2112,7 @@ public class ChatUsersActivity extends BaseFragment implements NotificationCente
if (type != TYPE_KICKED) {
return;
}
- if (!ChatObject.isChannel(currentChat) && selectedSlowmode != initialSlowmode && info != null) {
+ if (currentChat.creator && !ChatObject.isChannel(currentChat) && selectedSlowmode != initialSlowmode && info != null) {
MessagesController.getInstance(currentAccount).convertToMegaGroup(getParentActivity(), chatId, this, param -> {
if (param != 0) {
chatId = param;
diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/AlertsCreator.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/AlertsCreator.java
index a573767a1..08a786a04 100644
--- a/TMessagesProj/src/main/java/org/telegram/ui/Components/AlertsCreator.java
+++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/AlertsCreator.java
@@ -28,22 +28,28 @@ import android.os.Build;
import android.os.Bundle;
import android.os.Vibrator;
import android.provider.Settings;
+import android.text.Editable;
import android.text.Html;
+import android.text.InputFilter;
import android.text.InputType;
import android.text.Spannable;
import android.text.SpannableString;
import android.text.SpannableStringBuilder;
+import android.text.Spanned;
import android.text.TextUtils;
+import android.text.TextWatcher;
import android.text.style.URLSpan;
import android.util.Base64;
import android.util.SparseArray;
import android.util.TypedValue;
import android.view.Gravity;
import android.view.HapticFeedbackConstants;
+import android.view.KeyEvent;
import android.view.View;
import android.view.ViewOutlineProvider;
import android.view.inputmethod.EditorInfo;
import android.widget.Button;
+import android.widget.EditText;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.TextView;
@@ -89,6 +95,7 @@ import org.telegram.ui.ChatActivity;
import org.telegram.ui.Components.voip.VoIPHelper;
import org.telegram.ui.LanguageSelectActivity;
import org.telegram.ui.LaunchActivity;
+import org.telegram.ui.LoginActivity;
import org.telegram.ui.NotificationsCustomSettingsActivity;
import org.telegram.ui.NotificationsSettingsActivity;
import org.telegram.ui.ProfileNotificationsActivity;
@@ -285,7 +292,7 @@ public class AlertsCreator {
}
} else if (request instanceof TLRPC.TL_account_sendChangePhoneCode) {
if (error.text.contains("PHONE_NUMBER_INVALID")) {
- showSimpleAlert(fragment, LocaleController.getString("InvalidPhoneNumber", R.string.InvalidPhoneNumber));
+ LoginActivity.needShowInvalidAlert(fragment, (String) args[0], false);
} else if (error.text.contains("PHONE_CODE_EMPTY") || error.text.contains("PHONE_CODE_INVALID")) {
showSimpleAlert(fragment, LocaleController.getString("InvalidCode", R.string.InvalidCode));
} else if (error.text.contains("PHONE_CODE_EXPIRED")) {
@@ -294,6 +301,8 @@ public class AlertsCreator {
showSimpleAlert(fragment, LocaleController.getString("FloodWait", R.string.FloodWait));
} else if (error.text.startsWith("PHONE_NUMBER_OCCUPIED")) {
showSimpleAlert(fragment, LocaleController.formatString("ChangePhoneNumberOccupied", R.string.ChangePhoneNumberOccupied, args[0]));
+ } else if (error.text.startsWith("PHONE_NUMBER_BANNED")) {
+ LoginActivity.needShowInvalidAlert(fragment, (String) args[0], true);
} else {
showSimpleAlert(fragment, LocaleController.getString("ErrorOccurred", R.string.ErrorOccurred));
}
@@ -837,10 +846,26 @@ public class AlertsCreator {
}
}
}
+
if (callback != null) {
callback.run(i);
}
builder.getDismissRunnable().run();
+ int setting = -1;
+ if (i == 0) {
+ setting = NotificationsController.SETTING_MUTE_UNMUTE;
+ } else if (i == 1) {
+ setting = NotificationsController.SETTING_MUTE_HOUR;
+ } else if (i == 2) {
+ setting = NotificationsController.SETTING_MUTE_2_DAYS;
+ } else if (i == 4){
+ setting = NotificationsController.SETTING_MUTE_FOREVER;
+ }
+ if (setting >= 0) {
+ if (BulletinFactory.canShowBulletin(parentFragment)) {
+ BulletinFactory.createMuteBulletin(parentFragment, setting).show();
+ }
+ }
});
}
builder.setTitle(LocaleController.getString("Notifications", R.string.Notifications));
@@ -1136,11 +1161,11 @@ public class AlertsCreator {
} else {
avatarDrawable.setSmallSize(false);
avatarDrawable.setInfo(user);
- imageView.setImage(ImageLocation.getForUser(user, false), "50_50", avatarDrawable, user);
+ imageView.setImage(ImageLocation.getForUserOrChat(user, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(user, ImageLocation.TYPE_STRIPPED), "50_50", avatarDrawable, user);
}
} else {
avatarDrawable.setInfo(chat);
- imageView.setImage(ImageLocation.getForChat(chat, false), "50_50", avatarDrawable, chat);
+ imageView.setImage(ImageLocation.getForUserOrChat(chat, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(chat, ImageLocation.TYPE_STRIPPED), "50_50", avatarDrawable, chat);
}
messageTextView.setText(AndroidUtilities.replaceTags(message));
@@ -1304,11 +1329,11 @@ public class AlertsCreator {
} else {
avatarDrawable.setSmallSize(false);
avatarDrawable.setInfo(user);
- imageView.setImage(ImageLocation.getForUser(user, false), "50_50", avatarDrawable, user);
+ imageView.setImage(ImageLocation.getForUserOrChat(user, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(user, ImageLocation.TYPE_STRIPPED), "50_50", avatarDrawable, user);
}
} else {
avatarDrawable.setInfo(chat);
- imageView.setImage(ImageLocation.getForChat(chat, false), "50_50", avatarDrawable, chat);
+ imageView.setImage(ImageLocation.getForUserOrChat(chat, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(chat, ImageLocation.TYPE_STRIPPED), "50_50", avatarDrawable, chat);
}
if (second) {
@@ -1474,7 +1499,7 @@ public class AlertsCreator {
BackupImageView imageView = new BackupImageView(context);
imageView.setRoundRadius(AndroidUtilities.dp(20));
- imageView.setImage(ImageLocation.getForUser(user, false), "50_50", avatarDrawable, user);
+ imageView.setImage(ImageLocation.getForUserOrChat(user, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(user, ImageLocation.TYPE_STRIPPED), "50_50", avatarDrawable, user);
frameLayout.addView(imageView, LayoutHelper.createFrame(40, 40, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, 22, 5, 22, 0));
TextView textView = new TextView(context);
@@ -1500,6 +1525,292 @@ public class AlertsCreator {
fragment.showDialog(dialog);
}
+ public static void createChangeBioAlert(String currentBio, int peerId, Context context, int currentAccount) {
+ AlertDialog.Builder builder = new AlertDialog.Builder(context);
+ builder.setTitle(peerId > 0 ? LocaleController.getString("UserBio", R.string.UserBio) : LocaleController.getString("DescriptionPlaceholder", R.string.DescriptionPlaceholder));
+ builder.setMessage(peerId > 0 ? LocaleController.getString("VoipGroupBioEditAlertText", R.string.VoipGroupBioEditAlertText) : LocaleController.getString("DescriptionInfo", R.string.DescriptionInfo));
+ FrameLayout dialogView = new FrameLayout(context);
+ dialogView.setClipChildren(false);
+
+ if (peerId < 0) {
+ TLRPC.ChatFull chatFull = MessagesController.getInstance(currentAccount).getChatFull(-peerId);
+ if (chatFull == null) {
+ MessagesController.getInstance(currentAccount).loadFullChat(-peerId, ConnectionsManager.generateClassGuid(), true);
+ }
+ }
+
+ NumberTextView checkTextView = new NumberTextView(context);
+ EditText editTextView = new EditText(context);
+ editTextView.setTextColor(Theme.getColor(Theme.key_voipgroup_actionBarItems));
+ editTextView.setHint(peerId > 0 ? LocaleController.getString("UserBio", R.string.UserBio) : LocaleController.getString("DescriptionPlaceholder", R.string.DescriptionPlaceholder));
+ editTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16);
+ editTextView.setBackground(Theme.createEditTextDrawable(context, true));
+
+ editTextView.setMaxLines(4);
+ editTextView.setRawInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_CAP_SENTENCES | InputType.TYPE_TEXT_FLAG_MULTI_LINE);
+ editTextView.setImeOptions(EditorInfo.IME_ACTION_DONE);
+
+ InputFilter[] inputFilters = new InputFilter[1];
+ int maxSymbolsCount = peerId > 0 ? 70 : 255;
+ inputFilters[0] = new CodepointsLengthInputFilter(maxSymbolsCount) {
+ @Override
+ public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend) {
+ CharSequence result = super.filter(source, start, end, dest, dstart, dend);
+ if (result != null && source != null && result.length() != source.length()) {
+ Vibrator v = (Vibrator) context.getSystemService(Context.VIBRATOR_SERVICE);
+ if (v != null) {
+ v.vibrate(200);
+ }
+ AndroidUtilities.shakeView(checkTextView, 2, 0);
+ }
+ return result;
+ }
+ };
+ editTextView.setFilters(inputFilters);
+
+ checkTextView.setCenterAlign(true);
+ checkTextView.setTextSize(15);
+ checkTextView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteGrayText4));
+ checkTextView.setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_NO);
+ dialogView.addView(checkTextView, LayoutHelper.createFrame(20, 20, LocaleController.isRTL ? Gravity.LEFT : Gravity.RIGHT, 0, 14, 21, 0));
+ editTextView.setPadding(LocaleController.isRTL ? AndroidUtilities.dp(24) : 0, AndroidUtilities.dp(8), LocaleController.isRTL ? 0 : AndroidUtilities.dp(24), AndroidUtilities.dp(8));
+ editTextView.addTextChangedListener(new TextWatcher() {
+ @Override
+ public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
+
+ }
+
+ @Override
+ public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
+
+ }
+
+ @Override
+ public void afterTextChanged(Editable s) {
+ int count = maxSymbolsCount - Character.codePointCount(s, 0, s.length());
+ if (count < 30) {
+ checkTextView.setNumber(count, checkTextView.getVisibility() == View.VISIBLE);
+ AndroidUtilities.updateViewVisibilityAnimated(checkTextView, true);
+ } else {
+ AndroidUtilities.updateViewVisibilityAnimated(checkTextView, false);
+ }
+ }
+ });
+ AndroidUtilities.updateViewVisibilityAnimated(checkTextView, false, 0, false);
+ editTextView.setText(currentBio);
+ editTextView.setSelection(editTextView.getText().toString().length());
+
+ builder.setView(dialogView);
+ DialogInterface.OnClickListener onDoneListener = (dialogInterface, i) -> {
+ if (peerId > 0) {
+ final TLRPC.UserFull userFull = MessagesController.getInstance(currentAccount).getUserFull(UserConfig.getInstance(currentAccount).getClientUserId());
+ final String newName = editTextView.getText().toString().replace("\n", " ").replaceAll(" +", " ").trim();
+ if (userFull != null) {
+ String currentName = userFull.about;
+ if (currentName == null) {
+ currentName = "";
+ }
+ if (currentName.equals(newName)) {
+ AndroidUtilities.hideKeyboard(editTextView);
+ dialogInterface.dismiss();
+ return;
+ }
+ userFull.about = newName;
+ NotificationCenter.getInstance(currentAccount).postNotificationName(NotificationCenter.userInfoDidLoad, peerId, userFull);
+ }
+
+ final TLRPC.TL_account_updateProfile req = new TLRPC.TL_account_updateProfile();
+ req.about = newName;
+ req.flags |= 4;
+ NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.showBulletin, Bulletin.TYPE_BIO_CHANGED, peerId);
+ ConnectionsManager.getInstance(currentAccount).sendRequest(req, (response, error) -> {
+
+ }, ConnectionsManager.RequestFlagFailOnServerErrors);
+ } else {
+ TLRPC.ChatFull chatFull = MessagesController.getInstance(currentAccount).getChatFull(-peerId);
+ final String newAbout = editTextView.getText().toString();
+ if (chatFull != null) {
+ String currentName = chatFull.about;
+ if (currentName == null) {
+ currentName = "";
+ }
+ if (currentName.equals(newAbout)) {
+ AndroidUtilities.hideKeyboard(editTextView);
+ dialogInterface.dismiss();
+ return;
+ }
+ chatFull.about = newAbout;
+ NotificationCenter.getInstance(currentAccount).postNotificationName(NotificationCenter.chatInfoDidLoad, chatFull, 0, false, false);
+ }
+ NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.showBulletin, Bulletin.TYPE_BIO_CHANGED, peerId);
+ MessagesController.getInstance(currentAccount).updateChatAbout(-peerId, newAbout, chatFull);
+ }
+ dialogInterface.dismiss();
+ };
+ builder.setPositiveButton(LocaleController.getString("Save", R.string.Save), onDoneListener);
+ builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
+ builder.setOnPreDismissListener(dialogInterface -> AndroidUtilities.hideKeyboard(editTextView));
+ dialogView.addView(editTextView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, 0, 23, 12, 23, 21));
+ editTextView.requestFocus();
+ AndroidUtilities.showKeyboard(editTextView);
+
+ AlertDialog dialog = builder.create();
+ editTextView.setOnEditorActionListener((textView, i, keyEvent) -> {
+ if ((i == EditorInfo.IME_ACTION_DONE || (peerId > 0 && keyEvent.getKeyCode() == KeyEvent.KEYCODE_ENTER)) && dialog.isShowing()) {
+ onDoneListener.onClick(dialog, 0);
+ return true;
+ }
+ return false;
+ });
+
+ dialog.setBackgroundColor(Theme.getColor(Theme.key_voipgroup_dialogBackground));
+ dialog.show();
+ dialog.setTextColor(Theme.getColor(Theme.key_voipgroup_actionBarItems));
+
+ }
+
+ public static void createChangeNameAlert(int peerId, Context context, int currentAccount) {
+ String currentName;
+ String currentLastName = null;
+ if (peerId > 0) {
+ TLRPC.User user = MessagesController.getInstance(currentAccount).getUser(peerId);
+ currentName = user.first_name;
+ currentLastName = user.last_name;
+ } else {
+ TLRPC.Chat chat = MessagesController.getInstance(currentAccount).getChat(-peerId);
+ currentName = chat.title;
+ }
+ AlertDialog.Builder builder = new AlertDialog.Builder(context);
+ builder.setTitle(peerId > 0 ? LocaleController.getString("VoipEditName", R.string.VoipEditName) : LocaleController.getString("VoipEditTitle", R.string.VoipEditTitle));
+ LinearLayout dialogView = new LinearLayout(context);
+ dialogView.setOrientation(LinearLayout.VERTICAL);
+
+ EditText firstNameEditTextView = new EditText(context);
+ firstNameEditTextView.setTextColor(Theme.getColor(Theme.key_voipgroup_actionBarItems));
+ firstNameEditTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16);
+ firstNameEditTextView.setMaxLines(1);
+ firstNameEditTextView.setLines(1);
+ firstNameEditTextView.setSingleLine(true);
+ firstNameEditTextView.setGravity(LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT);
+ firstNameEditTextView.setInputType(InputType.TYPE_TEXT_FLAG_CAP_SENTENCES | InputType.TYPE_TEXT_FLAG_AUTO_CORRECT);
+ firstNameEditTextView.setImeOptions(peerId > 0 ? EditorInfo.IME_ACTION_NEXT : EditorInfo.IME_ACTION_DONE);
+ firstNameEditTextView.setHint(peerId > 0 ? LocaleController.getString("FirstName", R.string.FirstName) : LocaleController.getString("VoipEditTitleHint", R.string.VoipEditTitleHint));
+ firstNameEditTextView.setBackground(Theme.createEditTextDrawable(context, true));
+ firstNameEditTextView.setPadding(0, AndroidUtilities.dp(8), 0, AndroidUtilities.dp(8));
+ firstNameEditTextView.requestFocus();
+
+ EditText lastNameEditTextView = null;
+ if (peerId > 0) {
+ lastNameEditTextView = new EditText(context);
+ lastNameEditTextView.setTextColor(Theme.getColor(Theme.key_voipgroup_actionBarItems));
+ lastNameEditTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16);
+ lastNameEditTextView.setMaxLines(1);
+ lastNameEditTextView.setLines(1);
+ lastNameEditTextView.setSingleLine(true);
+ lastNameEditTextView.setGravity(LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT);
+ lastNameEditTextView.setInputType(InputType.TYPE_TEXT_FLAG_CAP_SENTENCES | InputType.TYPE_TEXT_FLAG_AUTO_CORRECT);
+ lastNameEditTextView.setImeOptions(EditorInfo.IME_ACTION_DONE);
+ lastNameEditTextView.setHint(LocaleController.getString("LastName", R.string.LastName));
+ lastNameEditTextView.setBackground(Theme.createEditTextDrawable(context, true));
+ lastNameEditTextView.setPadding(0, AndroidUtilities.dp(8), 0, AndroidUtilities.dp(8));
+ }
+
+ AndroidUtilities.showKeyboard(firstNameEditTextView);
+
+ dialogView.addView(firstNameEditTextView, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, 0, 23, 12, 23, 21));
+ if (lastNameEditTextView != null) {
+ dialogView.addView(lastNameEditTextView, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, 0, 23, 12, 23, 21));
+ }
+
+ firstNameEditTextView.setText(currentName);
+ firstNameEditTextView.setSelection(firstNameEditTextView.getText().toString().length());
+
+ if (lastNameEditTextView != null) {
+ lastNameEditTextView.setText(currentLastName);
+ lastNameEditTextView.setSelection(lastNameEditTextView.getText().toString().length());
+ }
+
+
+ builder.setView(dialogView);
+ EditText finalLastNameEditTextView = lastNameEditTextView;
+ DialogInterface.OnClickListener onDoneListener = (dialogInterface, i) -> {
+ if (firstNameEditTextView.getText() == null) {
+ return;
+ }
+ if (peerId > 0) {
+ TLRPC.User currentUser = MessagesController.getInstance(currentAccount).getUser(peerId);
+
+ String newFirst = firstNameEditTextView.getText().toString();
+ String newLast = finalLastNameEditTextView.getText().toString();
+ String oldFirst = currentUser.first_name;
+ String oldLast = currentUser.last_name;
+ if (oldFirst == null) {
+ oldFirst = "";
+ }
+ if (oldLast == null) {
+ oldLast = "";
+ }
+ if (oldFirst.equals(newFirst) && oldLast.equals(newLast)) {
+ dialogInterface.dismiss();
+ return;
+ }
+ TLRPC.TL_account_updateProfile req = new TLRPC.TL_account_updateProfile();
+ req.flags = 3;
+ currentUser.first_name = req.first_name = newFirst;
+ currentUser.last_name = req.last_name = newLast;
+ TLRPC.User user = MessagesController.getInstance(currentAccount).getUser(UserConfig.getInstance(currentAccount).getClientUserId());
+ if (user != null) {
+ user.first_name = req.first_name;
+ user.last_name = req.last_name;
+ }
+ UserConfig.getInstance(currentAccount).saveConfig(true);
+ NotificationCenter.getInstance(currentAccount).postNotificationName(NotificationCenter.mainUserInfoChanged);
+ NotificationCenter.getInstance(currentAccount).postNotificationName(NotificationCenter.updateInterfaces, MessagesController.UPDATE_MASK_NAME);
+ ConnectionsManager.getInstance(currentAccount).sendRequest(req, (response, error) -> {
+
+ });
+ NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.showBulletin, Bulletin.TYPE_NAME_CHANGED, peerId);
+ } else {
+ TLRPC.Chat chat = MessagesController.getInstance(currentAccount).getChat(-peerId);
+ String newFirst = firstNameEditTextView.getText().toString();
+ if (chat.title != null && chat.title.equals(newFirst)) {
+ dialogInterface.dismiss();
+ return;
+ }
+ chat.title = newFirst;
+ NotificationCenter.getInstance(currentAccount).postNotificationName(NotificationCenter.updateInterfaces, MessagesController.UPDATE_MASK_CHAT_NAME);
+ MessagesController.getInstance(currentAccount).changeChatTitle(-peerId, newFirst);
+ NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.showBulletin, Bulletin.TYPE_NAME_CHANGED, peerId);
+ }
+ dialogInterface.dismiss();
+ };
+ builder.setPositiveButton(LocaleController.getString("Save", R.string.Save), onDoneListener);
+ builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
+ builder.setOnPreDismissListener(dialogInterface -> {
+ AndroidUtilities.hideKeyboard(firstNameEditTextView);
+ AndroidUtilities.hideKeyboard(finalLastNameEditTextView);
+ });
+ AlertDialog dialog = builder.create();
+
+ dialog.setBackgroundColor(Theme.getColor(Theme.key_voipgroup_dialogBackground));
+ dialog.show();
+ dialog.setTextColor(Theme.getColor(Theme.key_voipgroup_actionBarItems));
+
+ TextView.OnEditorActionListener actionListener = (textView, i, keyEvent) -> {
+ if ((i == EditorInfo.IME_ACTION_DONE || keyEvent.getKeyCode() == KeyEvent.KEYCODE_ENTER) && dialog.isShowing()) {
+ onDoneListener.onClick(dialog, 0);
+ return true;
+ }
+ return false;
+ };
+ if (lastNameEditTextView != null) {
+ lastNameEditTextView.setOnEditorActionListener(actionListener);
+ } else {
+ firstNameEditTextView.setOnEditorActionListener(actionListener);
+ }
+
+ }
+
public interface BlockDialogCallback {
void run(boolean report, boolean delete);
}
@@ -1640,16 +1951,28 @@ public class AlertsCreator {
return builder;
}
- private static boolean checkScheduleDate(TextView button, boolean reminder, NumberPicker dayPicker, NumberPicker hourPicker, NumberPicker minutePicker) {
+ public static boolean checkScheduleDate(TextView button, TextView infoText, int type, NumberPicker dayPicker, NumberPicker hourPicker, NumberPicker minutePicker) {
+ return checkScheduleDate(button, infoText, 0, type, dayPicker, hourPicker, minutePicker);
+ }
+
+ public static boolean checkScheduleDate(TextView button, TextView infoText, long maxDate, int type, NumberPicker dayPicker, NumberPicker hourPicker, NumberPicker minutePicker) {
int day = dayPicker.getValue();
int hour = hourPicker.getValue();
int minute = minutePicker.getValue();
-
Calendar calendar = Calendar.getInstance();
+
long systemTime = System.currentTimeMillis();
calendar.setTimeInMillis(systemTime);
int currentYear = calendar.get(Calendar.YEAR);
int currentDay = calendar.get(Calendar.DAY_OF_YEAR);
+ if (maxDate > 0) {
+ maxDate *= 1000;
+ calendar.setTimeInMillis(systemTime + maxDate);
+ calendar.set(Calendar.HOUR_OF_DAY, 23);
+ calendar.set(Calendar.MINUTE, 59);
+ calendar.set(Calendar.SECOND, 59);
+ maxDate = calendar.getTimeInMillis();
+ }
calendar.setTimeInMillis(System.currentTimeMillis() + (long) day * 24 * 3600 * 1000);
calendar.set(Calendar.HOUR_OF_DAY, hour);
@@ -1658,11 +1981,18 @@ public class AlertsCreator {
if (currentTime <= systemTime + 60000L) {
calendar.setTimeInMillis(systemTime + 60000L);
+
if (currentDay != calendar.get(Calendar.DAY_OF_YEAR)) {
dayPicker.setValue(day = 1);
}
hourPicker.setValue(hour = calendar.get(Calendar.HOUR_OF_DAY));
minutePicker.setValue(minute = calendar.get(Calendar.MINUTE));
+ } else if (maxDate > 0 && currentTime > maxDate) {
+ calendar.setTimeInMillis(maxDate);
+
+ dayPicker.setValue(day = 7);
+ hourPicker.setValue(hour = calendar.get(Calendar.HOUR_OF_DAY));
+ minutePicker.setValue(minute = calendar.get(Calendar.MINUTE));
}
int selectedYear = calendar.get(Calendar.YEAR);
@@ -1670,8 +2000,8 @@ public class AlertsCreator {
calendar.set(Calendar.HOUR_OF_DAY, hour);
calendar.set(Calendar.MINUTE, minute);
+ long time = calendar.getTimeInMillis();
if (button != null) {
- long time = calendar.getTimeInMillis();
int num;
if (day == 0) {
num = 0;
@@ -1680,11 +2010,33 @@ public class AlertsCreator {
} else {
num = 2;
}
- if (reminder) {
+ if (type == 1) {
num += 3;
+ } else if (type == 2) {
+ num += 6;
+ } else if (type == 3) {
+ num += 9;
}
button.setText(LocaleController.getInstance().formatterScheduleSend[num].format(time));
}
+ if (infoText != null) {
+ int diff = (int) ((time - systemTime) / 1000);
+ String t;
+ if (diff > 24 * 60 * 60) {
+ t = LocaleController.formatPluralString("DaysSchedule", diff / (24 * 60 * 60));
+ } else if (diff >= 60 * 60) {
+ t = LocaleController.formatPluralString("HoursSchedule", diff / (60 * 60));
+ } else if (diff >= 60) {
+ t = LocaleController.formatPluralString("MinutesSchedule", diff / 60);
+ } else {
+ t = LocaleController.formatPluralString("SecondsSchedule", diff);
+ }
+ if (infoText.getTag() != null) {
+ infoText.setText(LocaleController.formatString("VoipGroupScheduleInfo", R.string.VoipGroupScheduleInfo, t));
+ } else {
+ infoText.setText(LocaleController.formatString("VoipChannelScheduleInfo", R.string.VoipChannelScheduleInfo, t));
+ }
+ }
return currentTime - systemTime > 60000L;
}
@@ -1892,7 +2244,7 @@ public class AlertsCreator {
} catch (Exception ignore) {
}
- checkScheduleDate(buttonTextView, selfUserId == dialogId, dayPicker, hourPicker, minutePicker);
+ checkScheduleDate(buttonTextView, null, selfUserId == dialogId ? 1 : 0, dayPicker, hourPicker, minutePicker);
};
dayPicker.setOnValueChangedListener(onValueChangeListener);
@@ -1926,7 +2278,7 @@ public class AlertsCreator {
}
final boolean[] canceled = {true};
- checkScheduleDate(buttonTextView, selfUserId == dialogId, dayPicker, hourPicker, minutePicker);
+ checkScheduleDate(buttonTextView, null, selfUserId == dialogId ? 1 : 0, dayPicker, hourPicker, minutePicker);
buttonTextView.setPadding(AndroidUtilities.dp(34), 0, AndroidUtilities.dp(34), 0);
buttonTextView.setGravity(Gravity.CENTER);
@@ -1937,7 +2289,7 @@ public class AlertsCreator {
container.addView(buttonTextView, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, 48, Gravity.LEFT | Gravity.BOTTOM, 16, 15, 16, 16));
buttonTextView.setOnClickListener(v -> {
canceled[0] = false;
- boolean setSeconds = checkScheduleDate(null, selfUserId == dialogId, dayPicker, hourPicker, minutePicker);
+ boolean setSeconds = checkScheduleDate(null, null, selfUserId == dialogId ? 1 : 0, dayPicker, hourPicker, minutePicker);
calendar.setTimeInMillis(System.currentTimeMillis() + (long) dayPicker.getValue() * 24 * 3600 * 1000);
calendar.set(Calendar.HOUR_OF_DAY, hourPicker.getValue());
calendar.set(Calendar.MINUTE, minutePicker.getValue());
@@ -2078,7 +2430,7 @@ public class AlertsCreator {
} catch (Exception ignore) {
}
- checkScheduleDate(null, false, dayPicker, hourPicker, minutePicker);
+ checkScheduleDate(null, null, 0, dayPicker, hourPicker, minutePicker);
};
dayPicker.setOnValueChangedListener(onValueChangeListener);
@@ -2110,9 +2462,8 @@ public class AlertsCreator {
dayPicker.setValue(days);
}
}
- final boolean[] canceled = {true};
- checkScheduleDate(null, false, dayPicker, hourPicker, minutePicker);
+ checkScheduleDate(null, null, 0, dayPicker, hourPicker, minutePicker);
buttonTextView.setPadding(AndroidUtilities.dp(34), 0, AndroidUtilities.dp(34), 0);
buttonTextView.setGravity(Gravity.CENTER);
@@ -2123,8 +2474,7 @@ public class AlertsCreator {
buttonTextView.setText(LocaleController.getString("SetTimeLimit", R.string.SetTimeLimit));
container.addView(buttonTextView, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, 48, Gravity.LEFT | Gravity.BOTTOM, 16, 15, 16, 16));
buttonTextView.setOnClickListener(v -> {
- canceled[0] = false;
- boolean setSeconds = checkScheduleDate(null, false, dayPicker, hourPicker, minutePicker);
+ boolean setSeconds = checkScheduleDate(null, null, 0, dayPicker, hourPicker, minutePicker);
calendar.setTimeInMillis(System.currentTimeMillis() + (long) dayPicker.getValue() * 24 * 3600 * 1000);
calendar.set(Calendar.HOUR_OF_DAY, hourPicker.getValue());
calendar.set(Calendar.MINUTE, minutePicker.getValue());
@@ -3011,7 +3361,7 @@ public class AlertsCreator {
BackupImageView imageView = new BackupImageView(activity);
imageView.setRoundRadius(AndroidUtilities.dp(26));
- imageView.setImage(ImageLocation.getForUser(selfUser, false), "50_50", (Drawable) null, selfUser);
+ imageView.setImage(ImageLocation.getForUserOrChat(selfUser, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(selfUser, ImageLocation.TYPE_STRIPPED), "50_50", (Drawable) null, selfUser);
frameLayout.addView(imageView, LayoutHelper.createFrame(52, 52, Gravity.CENTER, 0, 0, 0, 11));
builder.setTopView(frameLayout);
diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/AvatarsImageView.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/AvatarsImageView.java
index 56357b3fb..12e8addb4 100644
--- a/TMessagesProj/src/main/java/org/telegram/ui/Components/AvatarsImageView.java
+++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/AvatarsImageView.java
@@ -234,9 +234,9 @@ public class AvatarsImageView extends FrameLayout {
animatingStates[index].id = -currentChat.id;
}
if (currentUser != null) {
- animatingStates[index].imageReceiver.setImage(ImageLocation.getForUser(currentUser, false), "50_50", animatingStates[index].avatarDrawable, null, currentUser, 0);
+ animatingStates[index].imageReceiver.setImage(ImageLocation.getForUserOrChat(currentUser, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(currentUser, ImageLocation.TYPE_STRIPPED), "50_50", animatingStates[index].avatarDrawable, currentUser, 0);
} else {
- animatingStates[index].imageReceiver.setImage(ImageLocation.getForChat(currentChat, false), "50_50", animatingStates[index].avatarDrawable, null, currentChat, 0);
+ animatingStates[index].imageReceiver.setImage(ImageLocation.getForUserOrChat(currentChat, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(currentChat, ImageLocation.TYPE_STRIPPED), "50_50", animatingStates[index].avatarDrawable, currentChat, 0);
}
animatingStates[index].imageReceiver.setRoundRadius(AndroidUtilities.dp(currentStyle == 4 ? 16 : 12));
int size = AndroidUtilities.dp(currentStyle == 4 ? 32 : 24);
diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/Bulletin.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/Bulletin.java
index a18de5f14..7750c3e3f 100644
--- a/TMessagesProj/src/main/java/org/telegram/ui/Components/Bulletin.java
+++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/Bulletin.java
@@ -61,6 +61,8 @@ public final class Bulletin {
public static final int TYPE_STICKER = 0;
public static final int TYPE_ERROR = 1;
+ public static final int TYPE_BIO_CHANGED = 2;
+ public static final int TYPE_NAME_CHANGED = 3;
public static Bulletin make(@NonNull FrameLayout containerLayout, @NonNull Layout contentLayout, int duration) {
return new Bulletin(containerLayout, contentLayout, duration);
@@ -1031,6 +1033,7 @@ public final class Bulletin {
textView.setTypeface(Typeface.SANS_SERIF);
textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 15);
textView.setEllipsize(TextUtils.TruncateAt.END);
+ textView.setPadding(0, AndroidUtilities.dp(8), 0, AndroidUtilities.dp(8));
addView(textView, LayoutHelper.createFrameRelatively(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.START | Gravity.CENTER_VERTICAL, 56, 0, 16, 0));
}
diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/BulletinFactory.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/BulletinFactory.java
index 04948ecc3..d07641a57 100644
--- a/TMessagesProj/src/main/java/org/telegram/ui/Components/BulletinFactory.java
+++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/BulletinFactory.java
@@ -116,6 +116,8 @@ public final class BulletinFactory {
final Bulletin.LottieLayout layout = new Bulletin.LottieLayout(getContext());
layout.setAnimation(iconRawId, 36, 36);
layout.textView.setText(text);
+ layout.textView.setSingleLine(false);
+ layout.textView.setMaxLines(2);
return create(layout, Bulletin.DURATION_SHORT);
}
diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatActivityEnterView.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatActivityEnterView.java
index 6fdfd9ca3..f45b25c31 100644
--- a/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatActivityEnterView.java
+++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatActivityEnterView.java
@@ -49,6 +49,7 @@ import android.text.TextPaint;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.text.style.ImageSpan;
+import android.util.Log;
import android.util.Property;
import android.util.TypedValue;
import android.view.ActionMode;
@@ -3457,7 +3458,9 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe
showKeyboardOnResume = true;
}
AndroidUtilities.runOnUIThread(hideKeyboardRunnable = () -> {
- closeKeyboard();
+ if (parentFragment == null || parentFragment.isLastFragment()) {
+ closeKeyboard();
+ }
hideKeyboardRunnable = null;
}, 500);
}
@@ -4819,7 +4822,7 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe
slideText.setTranslationX(0);
recordCircle.showTooltipIfNeed();
- messageEditText.setVisibility(View.GONE);
+ messageEditText.setAlpha(0f);
}
});
runningAnimationAudio.setInterpolator(new DecelerateInterpolator());
diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatAttachAlert.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatAttachAlert.java
index c079cedd7..7f94da8cb 100644
--- a/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatAttachAlert.java
+++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatAttachAlert.java
@@ -391,6 +391,7 @@ public class ChatAttachAlert extends BottomSheet implements NotificationCenter.N
private Paint attachButtonPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
private float bottomPannelTranslation;
+ private boolean forceDarkTheme;
private class AttachButton extends FrameLayout {
@@ -552,7 +553,7 @@ public class ChatAttachAlert extends BottomSheet implements NotificationCenter.N
currentUser = user;
nameTextView.setText(ContactsController.formatName(user.first_name, user.last_name));
avatarDrawable.setInfo(user);
- imageView.setImage(ImageLocation.getForUser(user, false), "50_50", avatarDrawable, user);
+ imageView.setImage(ImageLocation.getForUserOrChat(user, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(user, ImageLocation.TYPE_STRIPPED), "50_50", avatarDrawable, user);
requestLayout();
}
}
@@ -563,8 +564,9 @@ public class ChatAttachAlert extends BottomSheet implements NotificationCenter.N
float currentPanTranslationY;
@SuppressLint("ClickableViewAccessibility")
- public ChatAttachAlert(Context context, final BaseFragment parentFragment) {
+ public ChatAttachAlert(Context context, final BaseFragment parentFragment, boolean forceDarkTheme) {
super(context, false);
+ this.forceDarkTheme = forceDarkTheme;
drawNavigationBar = true;
inBubbleMode = parentFragment instanceof ChatActivity && parentFragment.isInBubbleMode();
openInterpolator = new OvershootInterpolator(0.7f);
@@ -896,8 +898,9 @@ public class ChatAttachAlert extends BottomSheet implements NotificationCenter.N
shadowDrawable.setAlpha(viewAlpha);
shadowDrawable.setBounds(0, top, getMeasuredWidth(), height);
shadowDrawable.draw(canvas);
+ int backgroundColor = Theme.getColor(forceDarkTheme ? Theme.key_voipgroup_listViewBackground : Theme.key_dialogBackground);
if (actionBarType == 2) {
- Theme.dialogs_onlineCirclePaint.setColor(Theme.getColor(Theme.key_dialogBackground));
+ Theme.dialogs_onlineCirclePaint.setColor(backgroundColor);
Theme.dialogs_onlineCirclePaint.setAlpha(viewAlpha);
rect.set(backgroundPaddingLeft, backgroundPaddingTop + top, getMeasuredWidth() - backgroundPaddingLeft, backgroundPaddingTop + top + AndroidUtilities.dp(24));
canvas.save();
@@ -909,7 +912,7 @@ public class ChatAttachAlert extends BottomSheet implements NotificationCenter.N
boolean result = super.drawChild(canvas, child, drawingTime);
if (rad != 1.0f && actionBarType != 2) {
- Theme.dialogs_onlineCirclePaint.setColor(Theme.getColor(Theme.key_dialogBackground));
+ Theme.dialogs_onlineCirclePaint.setColor(backgroundColor);
Theme.dialogs_onlineCirclePaint.setAlpha(viewAlpha);
rect.set(backgroundPaddingLeft, backgroundPaddingTop + top, getMeasuredWidth() - backgroundPaddingLeft, backgroundPaddingTop + top + AndroidUtilities.dp(24));
canvas.save();
@@ -946,7 +949,7 @@ public class ChatAttachAlert extends BottomSheet implements NotificationCenter.N
if (inBubbleMode) {
return;
}
- int color1 = Theme.getColor(Theme.key_dialogBackground);
+ int color1 = Theme.getColor(forceDarkTheme ? Theme.key_voipgroup_listViewBackground : Theme.key_dialogBackground);
int finalColor = Color.argb((int) (255 * actionBar.getAlpha()), (int) (Color.red(color1) * 0.8f), (int) (Color.green(color1) * 0.8f), (int) (Color.blue(color1) * 0.8f));
Theme.dialogs_onlineCirclePaint.setColor(finalColor);
canvas.drawRect(backgroundPaddingLeft, currentPanTranslationY, getMeasuredWidth() - backgroundPaddingLeft, AndroidUtilities.statusBarHeight + currentPanTranslationY, Theme.dialogs_onlineCirclePaint);
@@ -1162,7 +1165,7 @@ public class ChatAttachAlert extends BottomSheet implements NotificationCenter.N
selectedTextView.setVisibility(View.INVISIBLE);
selectedTextView.setAlpha(0.0f);
- layouts[0] = photoLayout = new ChatAttachAlertPhotoLayout(this, context);
+ layouts[0] = photoLayout = new ChatAttachAlertPhotoLayout(this, context, forceDarkTheme);
currentAttachLayout = photoLayout;
selectedId = 1;
containerView.addView(photoLayout, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));
@@ -1309,7 +1312,7 @@ public class ChatAttachAlert extends BottomSheet implements NotificationCenter.N
float alphaOffset = (frameLayout2.getMeasuredHeight() - AndroidUtilities.dp(84)) * (1f - getAlpha());
shadow.setTranslationY(-(frameLayout2.getMeasuredHeight() - AndroidUtilities.dp(84)) + captionEditTextTopOffset + currentPanTranslationY + bottomPannelTranslation + alphaOffset);
- int newColor = Theme.getColor(Theme.key_dialogBackground);
+ int newColor = Theme.getColor(forceDarkTheme ? Theme.key_voipgroup_listViewBackground : Theme.key_dialogBackground);
if (color != newColor) {
color = newColor;
p.setColor(color);
@@ -1688,6 +1691,11 @@ public class ChatAttachAlert extends BottomSheet implements NotificationCenter.N
selectedCountView.setScaleX(0.2f);
selectedCountView.setScaleY(0.2f);
containerView.addView(selectedCountView, LayoutHelper.createFrame(42, 24, Gravity.RIGHT | Gravity.BOTTOM, 0, 0, -8, 9));
+
+ if (forceDarkTheme) {
+ checkColors();
+ navBarColorKey = null;
+ }
}
@Override
@@ -2130,18 +2138,18 @@ public class ChatAttachAlert extends BottomSheet implements NotificationCenter.N
for (int a = 0; a < count; a++) {
applyAttachButtonColors(buttonsRecyclerView.getChildAt(a));
}
- selectedTextView.setTextColor(Theme.getColor(Theme.key_dialogTextBlack));
+ selectedTextView.setTextColor(forceDarkTheme ? Theme.getColor(Theme.key_voipgroup_actionBarItems) : Theme.getColor(Theme.key_dialogTextBlack));
doneItem.getTextView().setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlueHeader));
- selectedMenuItem.setIconColor(Theme.getColor(Theme.key_dialogTextBlack));
- Theme.setDrawableColor(selectedMenuItem.getBackground(), Theme.getColor(Theme.key_dialogButtonSelector));
+ selectedMenuItem.setIconColor(forceDarkTheme ? Theme.getColor(Theme.key_voipgroup_actionBarItems) : Theme.getColor(Theme.key_dialogTextBlack));
+ Theme.setDrawableColor(selectedMenuItem.getBackground(), forceDarkTheme ? Theme.getColor(Theme.key_voipgroup_actionBarItemsSelector) : Theme.getColor(Theme.key_dialogButtonSelector));
selectedMenuItem.setPopupItemsColor(Theme.getColor(Theme.key_actionBarDefaultSubmenuItem), false);
selectedMenuItem.setPopupItemsColor(Theme.getColor(Theme.key_actionBarDefaultSubmenuItem), true);
selectedMenuItem.redrawPopup(Theme.getColor(Theme.key_actionBarDefaultSubmenuBackground));
- searchItem.setIconColor(Theme.getColor(Theme.key_dialogTextBlack));
- Theme.setDrawableColor(searchItem.getBackground(), Theme.getColor(Theme.key_dialogButtonSelector));
+ searchItem.setIconColor(forceDarkTheme ? Theme.getColor(Theme.key_voipgroup_actionBarItems) : Theme.getColor(Theme.key_dialogTextBlack));
+ Theme.setDrawableColor(searchItem.getBackground(), forceDarkTheme ? Theme.getColor(Theme.key_voipgroup_actionBarItemsSelector) : Theme.getColor(Theme.key_dialogButtonSelector));
commentTextView.updateColors();
@@ -2149,7 +2157,7 @@ public class ChatAttachAlert extends BottomSheet implements NotificationCenter.N
for (int a = 0; a < itemCells.length; a++) {
if (itemCells[a] != null) {
itemCells[a].setColors(Theme.getColor(Theme.key_actionBarDefaultSubmenuItem), Theme.getColor(Theme.key_actionBarDefaultSubmenuItemIcon));
- itemCells[a].setSelectorColor(Theme.getColor(Theme.key_dialogButtonSelector));
+ itemCells[a].setSelectorColor(forceDarkTheme ? Theme.getColor(Theme.key_voipgroup_actionBarItemsSelector) : Theme.getColor(Theme.key_dialogButtonSelector));
}
}
sendPopupLayout.setBackgroundColor(Theme.getColor(Theme.key_actionBarDefaultSubmenuBackground));
@@ -2165,18 +2173,18 @@ public class ChatAttachAlert extends BottomSheet implements NotificationCenter.N
actionBarShadow.setBackgroundColor(Theme.getColor(Theme.key_dialogShadowLine));
buttonsRecyclerView.setGlowColor(Theme.getColor(Theme.key_dialogScrollGlow));
- buttonsRecyclerView.setBackgroundColor(Theme.getColor(Theme.key_dialogBackground));
+ buttonsRecyclerView.setBackgroundColor(Theme.getColor(forceDarkTheme ? Theme.key_voipgroup_listViewBackground : Theme.key_dialogBackground));
- frameLayout2.setBackgroundColor(Theme.getColor(Theme.key_dialogBackground));
+ frameLayout2.setBackgroundColor(Theme.getColor(forceDarkTheme ? Theme.key_voipgroup_listViewBackground : Theme.key_dialogBackground));
selectedCountView.invalidate();
- actionBar.setBackgroundColor(Theme.getColor(Theme.key_dialogBackground));
- actionBar.setItemsColor(Theme.getColor(Theme.key_dialogTextBlack), false);
- actionBar.setItemsBackgroundColor(Theme.getColor(Theme.key_dialogButtonSelector), false);
- actionBar.setTitleColor(Theme.getColor(Theme.key_dialogTextBlack));
+ actionBar.setBackgroundColor(forceDarkTheme ? Theme.getColor(Theme.key_voipgroup_actionBar) : Theme.getColor(Theme.key_dialogBackground));
+ actionBar.setItemsColor(forceDarkTheme ? Theme.getColor(Theme.key_voipgroup_actionBarItems) : Theme.getColor(Theme.key_dialogTextBlack), false);
+ actionBar.setItemsBackgroundColor(forceDarkTheme ? Theme.getColor(Theme.key_voipgroup_actionBarItemsSelector) : Theme.getColor(Theme.key_dialogButtonSelector), false);
+ actionBar.setTitleColor(forceDarkTheme ? Theme.getColor(Theme.key_voipgroup_actionBarItems) : Theme.getColor(Theme.key_dialogTextBlack));
- Theme.setDrawableColor(shadowDrawable, Theme.getColor(Theme.key_dialogBackground));
+ Theme.setDrawableColor(shadowDrawable, Theme.getColor(forceDarkTheme ? Theme.key_voipgroup_listViewBackground : Theme.key_dialogBackground));
containerView.invalidate();
@@ -2489,7 +2497,7 @@ public class ChatAttachAlert extends BottomSheet implements NotificationCenter.N
if (baseFragment == null) {
return;
}
- if (baseFragment instanceof ChatActivity) {
+ if (baseFragment instanceof ChatActivity && avatarPicker != 2) {
TLRPC.Chat chat = ((ChatActivity) baseFragment).getCurrentChat();
TLRPC.User user = ((ChatActivity) baseFragment).getCurrentUser();
if (chat != null) {
diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatAttachAlertContactsLayout.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatAttachAlertContactsLayout.java
index 5fab1da19..be2606fc8 100644
--- a/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatAttachAlertContactsLayout.java
+++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatAttachAlertContactsLayout.java
@@ -208,7 +208,7 @@ public class ChatAttachAlertContactsLayout extends ChatAttachAlert.AttachAlertLa
lastAvatar = photo;
if (currentUser != null) {
- avatarImageView.setImage(ImageLocation.getForUser(currentUser, false), "50_50", avatarDrawable, currentUser);
+ avatarImageView.setImage(ImageLocation.getForUserOrChat(currentUser, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(currentUser, ImageLocation.TYPE_STRIPPED), "50_50", avatarDrawable, currentUser);
} else {
avatarImageView.setImageDrawable(avatarDrawable);
}
diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatAttachAlertPhotoLayout.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatAttachAlertPhotoLayout.java
index f2f33559a..4ee764590 100644
--- a/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatAttachAlertPhotoLayout.java
+++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatAttachAlertPhotoLayout.java
@@ -190,6 +190,8 @@ public class ChatAttachAlertPhotoLayout extends ChatAttachAlert.AttachAlertLayou
private final static int compress = 1;
private final static int open_in = 2;
+ boolean forceDarkTheme;
+
private class BasePhotoProvider extends PhotoViewer.EmptyPhotoViewerProvider {
@Override
public boolean isPhotoChecked(int index) {
@@ -433,8 +435,9 @@ public class ChatAttachAlertPhotoLayout extends ChatAttachAlert.AttachAlertLayou
return arrayList;
}
- public ChatAttachAlertPhotoLayout(ChatAttachAlert alert, Context context) {
+ public ChatAttachAlertPhotoLayout(ChatAttachAlert alert, Context context, boolean forceDarkTheme) {
super(alert, context);
+ this.forceDarkTheme = forceDarkTheme;
NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.albumsDidLoad);
NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.cameraInitied);
FrameLayout container = alert.getContainer();
@@ -596,16 +599,15 @@ public class ChatAttachAlertPhotoLayout extends ChatAttachAlert.AttachAlertLayou
PhotoViewer.getInstance().setMaxSelectedPhotos(parentAlert.maxSelectedPhotos, parentAlert.allowOrder);
ChatActivity chatActivity;
int type;
- if (parentAlert.baseFragment instanceof ChatActivity) {
+ if (parentAlert.avatarPicker != 0) {
+ chatActivity = null;
+ type = PhotoViewer.SELECT_TYPE_AVATAR;
+ } else if (parentAlert.baseFragment instanceof ChatActivity) {
chatActivity = (ChatActivity) parentAlert.baseFragment;
type = 0;
} else {
chatActivity = null;
- if (parentAlert.avatarPicker != 0) {
- type = PhotoViewer.SELECT_TYPE_AVATAR;
- } else {
- type = 4;
- }
+ type = 4;
}
AndroidUtilities.hideKeyboard(parentAlert.baseFragment.getFragmentView().findFocus());
AndroidUtilities.hideKeyboard(parentAlert.getContainer().findFocus());
@@ -1247,16 +1249,15 @@ public class ChatAttachAlertPhotoLayout extends ChatAttachAlert.AttachAlertLayou
ChatActivity chatActivity;
int type;
- if (parentAlert.baseFragment instanceof ChatActivity) {
+ if (parentAlert.avatarPicker != 0) {
+ type = PhotoViewer.SELECT_TYPE_AVATAR;
+ chatActivity = null;
+ } else if (parentAlert.baseFragment instanceof ChatActivity) {
chatActivity = (ChatActivity) parentAlert.baseFragment;
type = 2;
} else {
chatActivity = null;
- if (parentAlert.avatarPicker != 0) {
- type = PhotoViewer.SELECT_TYPE_AVATAR;
- } else {
- type = 5;
- }
+ type = 5;
}
ArrayList