mirror of
https://github.com/DrKLO/Telegram.git
synced 2024-12-22 06:25:14 +01:00
Update to 7.7.0 (2284)
This commit is contained in:
parent
7ba9838a2d
commit
8bf056e27b
209 changed files with 7639 additions and 2243 deletions
|
@ -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
|
||||
|
|
|
@ -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']
|
||||
|
||||
|
|
67
TMessagesProj/config/release/AndroidManifest_standalone.xml
Normal file
67
TMessagesProj/config/release/AndroidManifest_standalone.xml
Normal file
|
@ -0,0 +1,67 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
package="org.telegram.messenger"
|
||||
android:installLocation="auto">
|
||||
|
||||
<uses-feature android:name="android.hardware.location.gps" android:required="false" />
|
||||
<uses-feature android:name="android.hardware.location.network" android:required="false" />
|
||||
<uses-feature android:name="android.hardware.location" android:required="false" />
|
||||
<uses-feature android:name="android.hardware.LOCATION" android:required="false" />
|
||||
|
||||
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
|
||||
<uses-permission android:name="org.telegram.messenger.permission.MAPS_RECEIVE"/>
|
||||
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
|
||||
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
|
||||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
||||
<uses-permission android:name="android.permission.CALL_PHONE" />
|
||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
|
||||
<uses-permission android:name="android.permission.READ_CALL_LOG" />
|
||||
|
||||
<permission android:name="org.telegram.messenger.permission.MAPS_RECEIVE" android:protectionLevel="signature"/>
|
||||
|
||||
<application
|
||||
android:allowBackup="false"
|
||||
android:icon="@mipmap/ic_launcher_sa"
|
||||
android:roundIcon="@mipmap/ic_launcher_sa"
|
||||
android:label="@string/AppName"
|
||||
android:theme="@style/Theme.TMessages.Start"
|
||||
android:name=".ApplicationLoader"
|
||||
android:hardwareAccelerated="@bool/useHardwareAcceleration"
|
||||
android:largeHeap="true"
|
||||
android:supportsRtl="false"
|
||||
android:requestLegacyExternalStorage="true"
|
||||
tools:replace="android:supportsRtl">
|
||||
|
||||
<meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="AIzaSyA-t0jLPjUt2FxrA8VPK2EiYHcYcboIR6k" />
|
||||
|
||||
<service
|
||||
android:name=".GcmPushListenerService">
|
||||
<intent-filter>
|
||||
<action android:name="com.google.firebase.MESSAGING_EVENT" />
|
||||
</intent-filter>
|
||||
</service>
|
||||
|
||||
<uses-library android:name="com.google.android.maps" android:required="false"/>
|
||||
|
||||
<meta-data android:name="firebase_analytics_collection_deactivated" android:value="true" />
|
||||
<meta-data android:name="google_analytics_adid_collection_enabled" android:value="false" />
|
||||
|
||||
<receiver
|
||||
tools:replace="android:enabled"
|
||||
android:name="com.google.android.gms.measurement.AppMeasurementReceiver"
|
||||
android:enabled="false">
|
||||
<intent-filter>
|
||||
<action android:name="com.google.android.gms.measurement.UPLOAD" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
|
||||
<service
|
||||
tools:replace="android:enabled"
|
||||
android:name="com.google.android.gms.measurement.AppMeasurementService"
|
||||
android:enabled="false"
|
||||
android:exported="false" />
|
||||
|
||||
</application>
|
||||
|
||||
</manifest>
|
|
@ -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"
|
||||
}
|
||||
}
|
|
@ -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
|
||||
|
|
|
@ -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},
|
||||
|
|
|
@ -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>(FileLocation::TLdeserialize(stream, stream->readUint32(&error), instanceNum, error));
|
||||
photo_big = std::unique_ptr<FileLocation>(FileLocation::TLdeserialize(stream, stream->readUint32(&error), instanceNum, error));
|
||||
if ((flags & 2) != 0) {
|
||||
stripped_thumb = std::unique_ptr<ByteArray>(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);
|
||||
}
|
||||
|
||||
|
|
|
@ -257,6 +257,7 @@ public:
|
|||
int64_t photo_id;
|
||||
std::unique_ptr<FileLocation> photo_small;
|
||||
std::unique_ptr<FileLocation> photo_big;
|
||||
std::unique_ptr<ByteArray> 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);
|
||||
|
|
|
@ -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<std::unique_ptr<NetworkMessage>> &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<int64_t> 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<TLObject>(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<TLObject> ConnectionsManager::wrapInLayer(TLObject *object, Data
|
|||
objectValue->key = "installer";
|
||||
objectValue->value = std::unique_ptr<JSONValue>(jsonString);
|
||||
|
||||
objectValue = new TL_jsonObjectValue();
|
||||
jsonObject->value.push_back(std::unique_ptr<TL_jsonObjectValue>(objectValue));
|
||||
jsonString = new TL_jsonString();
|
||||
jsonString->value = package;
|
||||
objectValue->key = "package_id";
|
||||
objectValue->value = std::unique_ptr<JSONValue>(jsonString);
|
||||
|
||||
objectValue = new TL_jsonObjectValue();
|
||||
jsonObject->value.push_back(std::unique_ptr<TL_jsonObjectValue>(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;
|
||||
|
|
|
@ -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<uint32_t> 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;
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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";
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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<String, PluralRules> 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;
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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<TLRPC.TL_messages_stickerSet>[] stickerSets = new ArrayList[]{new ArrayList<>(), new ArrayList<>(), new ArrayList<>(0), new ArrayList<>(), new ArrayList<>()};
|
||||
private LongSparseArray<TLRPC.Document>[] stickersByIds = new LongSparseArray[]{new LongSparseArray<>(), new LongSparseArray<>(), new LongSparseArray<>(), new LongSparseArray<>(), new LongSparseArray<>()};
|
||||
private LongSparseArray<TLRPC.TL_messages_stickerSet> stickerSetsById = new LongSparseArray<>();
|
||||
|
@ -168,9 +170,9 @@ public class MediaDataController extends BaseController {
|
|||
private HashMap<String, ArrayList<TLRPC.Document>> allStickers = new HashMap<>();
|
||||
private HashMap<String, ArrayList<TLRPC.Document>> allStickersFeatured = new HashMap<>();
|
||||
|
||||
private ArrayList<TLRPC.Document>[] recentStickers = new ArrayList[]{new ArrayList<>(), new ArrayList<>(), new ArrayList<>()};
|
||||
private boolean[] loadingRecentStickers = new boolean[3];
|
||||
private boolean[] recentStickersLoaded = new boolean[3];
|
||||
private ArrayList<TLRPC.Document>[] 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<TLRPC.Document> 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<TLRPC.Document> 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<TLRPC.Document> 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 {
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -313,9 +313,6 @@ public class MessagesController extends BaseController implements NotificationCe
|
|||
|
||||
public volatile boolean ignoreSetOnline;
|
||||
|
||||
private ArrayList<TLRPC.Document> 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<TLRPC.Document> 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();
|
||||
|
|
|
@ -6562,6 +6562,7 @@ public class MessagesStorage extends BaseController {
|
|||
}
|
||||
int minId = Integer.MAX_VALUE;
|
||||
int maxId = Integer.MIN_VALUE;
|
||||
ArrayList<Long> 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) {
|
||||
|
|
|
@ -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";
|
||||
|
|
|
@ -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<ArrayList<NotificationCenterDelegate>> observers = new SparseArray<>();
|
||||
private SparseArray<ArrayList<NotificationCenterDelegate>> removeAfterBroadcast = new SparseArray<>();
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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<String, String> 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<String, String> 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<TLRPC.MessageEntity> entities, TLRPC.ReplyMarkup replyMarkup, HashMap<String, String> 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<TLRPC.MessageEntity> entities, TLRPC.ReplyMarkup replyMarkup, HashMap<String, String> 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<String, String> 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<String, String> 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<String, String> 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<TLRPC.MessageEntity> entities, TLRPC.ReplyMarkup replyMarkup, HashMap<String, String> 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<TLRPC.MessageEntity> entities, TLRPC.ReplyMarkup replyMarkup, HashMap<String, String> 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<TLRPC.MessageEntity> entities, TLRPC.ReplyMarkup replyMarkup, HashMap<String, String> 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 {
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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);
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -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) {
|
||||
|
|
|
@ -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 {
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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) {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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<Rect> 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) {
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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 = "";
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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));
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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));
|
||||
|
|
|
@ -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()) {
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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());
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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<Object> arrayList;
|
||||
int index;
|
||||
|
@ -1490,7 +1491,7 @@ public class ChatAttachAlertPhotoLayout extends ChatAttachAlert.AttachAlertLayou
|
|||
}
|
||||
|
||||
public void checkCamera(boolean request) {
|
||||
if (parentAlert.baseFragment == null) {
|
||||
if (parentAlert.baseFragment == null || parentAlert.baseFragment.getParentActivity() == null) {
|
||||
return;
|
||||
}
|
||||
boolean old = deviceHasGoodCamera;
|
||||
|
@ -2363,6 +2364,7 @@ public class ChatAttachAlertPhotoLayout extends ChatAttachAlert.AttachAlertLayou
|
|||
if (cameraIcon != null) {
|
||||
cameraIcon.invalidate();
|
||||
}
|
||||
String textColor = forceDarkTheme ? Theme.key_voipgroup_actionBarItems : Theme.key_dialogTextBlack;
|
||||
Theme.setDrawableColor(cameraDrawable, Theme.getColor(Theme.key_dialogCameraIcon));
|
||||
progressView.setTextColor(Theme.getColor(Theme.key_emptyListPlaceholder));
|
||||
gridView.setGlowColor(Theme.getColor(Theme.key_dialogScrollGlow));
|
||||
|
@ -2371,11 +2373,11 @@ public class ChatAttachAlertPhotoLayout extends ChatAttachAlert.AttachAlertLayou
|
|||
((PhotoAttachCameraCell) holder.itemView).getImageView().setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_dialogCameraIcon), PorterDuff.Mode.MULTIPLY));
|
||||
}
|
||||
|
||||
dropDown.setTextColor(Theme.getColor(Theme.key_dialogTextBlack));
|
||||
dropDownContainer.setPopupItemsColor(Theme.getColor(Theme.key_actionBarDefaultSubmenuItem), false);
|
||||
dropDownContainer.setPopupItemsColor(Theme.getColor(Theme.key_actionBarDefaultSubmenuItem), true);
|
||||
dropDownContainer.redrawPopup(Theme.getColor(Theme.key_actionBarDefaultSubmenuBackground));
|
||||
Theme.setDrawableColor(dropDownDrawable, Theme.getColor(Theme.key_dialogTextBlack));
|
||||
dropDown.setTextColor(Theme.getColor(textColor));
|
||||
dropDownContainer.setPopupItemsColor(Theme.getColor(forceDarkTheme ? Theme.key_voipgroup_actionBarItems : Theme.key_actionBarDefaultSubmenuItem), false);
|
||||
dropDownContainer.setPopupItemsColor(Theme.getColor(forceDarkTheme ? Theme.key_voipgroup_actionBarItems :Theme.key_actionBarDefaultSubmenuItem), true);
|
||||
dropDownContainer.redrawPopup(Theme.getColor(forceDarkTheme ? Theme.key_voipgroup_actionBarUnscrolled : Theme.key_actionBarDefaultSubmenuBackground));
|
||||
Theme.setDrawableColor(dropDownDrawable, Theme.getColor(textColor));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -2389,7 +2391,7 @@ public class ChatAttachAlertPhotoLayout extends ChatAttachAlert.AttachAlertLayou
|
|||
cameraIcon.setAlpha(mediaEnabled ? 1.0f : 0.2f);
|
||||
cameraIcon.setEnabled(mediaEnabled);
|
||||
}
|
||||
if (parentAlert.baseFragment instanceof ChatActivity) {
|
||||
if (parentAlert.baseFragment instanceof ChatActivity && parentAlert.avatarPicker == 0) {
|
||||
galleryAlbumEntry = MediaController.allMediaAlbumEntry;
|
||||
if (mediaEnabled) {
|
||||
progressView.setText(LocaleController.getString("NoPhotos", R.string.NoPhotos));
|
||||
|
|
|
@ -589,7 +589,7 @@ public class ChatAvatarContainer extends FrameLayout implements NotificationCent
|
|||
public void setChatAvatar(TLRPC.Chat chat) {
|
||||
avatarDrawable.setInfo(chat);
|
||||
if (avatarImageView != null) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -615,7 +615,7 @@ public class ChatAvatarContainer extends FrameLayout implements NotificationCent
|
|||
} else {
|
||||
avatarDrawable.setSmallSize(false);
|
||||
if (avatarImageView != null) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -643,13 +643,13 @@ public class ChatAvatarContainer extends FrameLayout implements NotificationCent
|
|||
} else {
|
||||
avatarDrawable.setSmallSize(false);
|
||||
if (avatarImageView != null) {
|
||||
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 if (chat != null) {
|
||||
avatarDrawable.setInfo(chat);
|
||||
if (avatarImageView != null) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,25 +9,20 @@ import android.widget.TextView;
|
|||
|
||||
import org.telegram.messenger.AndroidUtilities;
|
||||
import org.telegram.messenger.DocumentObject;
|
||||
import org.telegram.messenger.Emoji;
|
||||
import org.telegram.messenger.FileLoader;
|
||||
import org.telegram.messenger.ImageLocation;
|
||||
import org.telegram.messenger.LocaleController;
|
||||
import org.telegram.messenger.MediaDataController;
|
||||
import org.telegram.messenger.MessageObject;
|
||||
import org.telegram.messenger.MessagesController;
|
||||
import org.telegram.messenger.NotificationCenter;
|
||||
import org.telegram.messenger.R;
|
||||
import org.telegram.messenger.SvgHelper;
|
||||
import org.telegram.messenger.UserConfig;
|
||||
import org.telegram.tgnet.ConnectionsManager;
|
||||
import org.telegram.tgnet.TLRPC;
|
||||
import org.telegram.ui.ActionBar.Theme;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Locale;
|
||||
import java.util.Random;
|
||||
|
||||
public class ChatGreetingsView extends LinearLayout implements NotificationCenter.NotificationCenterDelegate {
|
||||
public class ChatGreetingsView extends LinearLayout {
|
||||
|
||||
private TLRPC.Document preloadedGreetingsSticker;
|
||||
private TextView titleView;
|
||||
|
@ -39,7 +34,7 @@ public class ChatGreetingsView extends LinearLayout implements NotificationCente
|
|||
public BackupImageView stickerToSendView;
|
||||
|
||||
|
||||
public ChatGreetingsView(Context context, TLRPC.User user, int distance, int currentAccount, TLRPC.Document preloadedGreetingsSticker) {
|
||||
public ChatGreetingsView(Context context, TLRPC.User user, int distance, int currentAccount, TLRPC.Document sticker) {
|
||||
super(context);
|
||||
setOrientation(VERTICAL);
|
||||
this.currentAccount = currentAccount;
|
||||
|
@ -70,16 +65,17 @@ public class ChatGreetingsView extends LinearLayout implements NotificationCente
|
|||
descriptionView.setText(LocaleController.getString("NearbyPeopleGreetingsDescription", R.string.NearbyPeopleGreetingsDescription));
|
||||
}
|
||||
|
||||
this.preloadedGreetingsSticker = preloadedGreetingsSticker;
|
||||
|
||||
preloadedGreetingsSticker = sticker;
|
||||
if (preloadedGreetingsSticker == null) {
|
||||
MessagesController.getInstance(currentAccount).preloadGreetingsSticker();
|
||||
} else {
|
||||
setSticker(preloadedGreetingsSticker);
|
||||
preloadedGreetingsSticker = MediaDataController.getInstance(currentAccount).getGreetingsSticker();
|
||||
}
|
||||
setSticker(preloadedGreetingsSticker);
|
||||
}
|
||||
|
||||
private void setSticker(TLRPC.Document sticker) {
|
||||
if (sticker == null) {
|
||||
return;
|
||||
}
|
||||
SvgHelper.SvgDrawable svgThumb = DocumentObject.getSvgThumb(sticker, Theme.key_chat_serviceBackground, 1.0f);
|
||||
if (svgThumb != null) {
|
||||
stickerToSendView.setImage(ImageLocation.getForDocument(sticker), createFilter(sticker), svgThumb, 0, sticker);
|
||||
|
@ -177,26 +173,17 @@ public class ChatGreetingsView extends LinearLayout implements NotificationCente
|
|||
protected void onAttachedToWindow() {
|
||||
super.onAttachedToWindow();
|
||||
fetchSticker();
|
||||
NotificationCenter.getInstance(currentAccount).addObserver(this, NotificationCenter.greetingsStickerLoaded);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow();
|
||||
NotificationCenter.getInstance(currentAccount).removeObserver(this, NotificationCenter.greetingsStickerLoaded);
|
||||
}
|
||||
|
||||
private void fetchSticker() {
|
||||
if (preloadedGreetingsSticker == null) {
|
||||
preloadedGreetingsSticker = MessagesController.getInstance(currentAccount).getPreloadedSticker();
|
||||
if (preloadedGreetingsSticker != null) {
|
||||
setSticker(preloadedGreetingsSticker);
|
||||
}
|
||||
preloadedGreetingsSticker = MediaDataController.getInstance(currentAccount).getGreetingsSticker();
|
||||
setSticker(preloadedGreetingsSticker);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void didReceivedNotification(int id, int account, Object... args) {
|
||||
fetchSticker();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,6 +27,8 @@ public class ContextProgressView extends View {
|
|||
private int currentColorType;
|
||||
private String innerKey;
|
||||
private String outerKey;
|
||||
private int innerColor;
|
||||
private int outerColor;
|
||||
|
||||
public ContextProgressView(Context context, int colorType) {
|
||||
super(context);
|
||||
|
@ -51,9 +53,25 @@ public class ContextProgressView extends View {
|
|||
updateColors();
|
||||
}
|
||||
|
||||
public void setColors(int innerColor, int outerColor) {
|
||||
innerKey = null;
|
||||
outerKey = null;
|
||||
this.innerColor = innerColor;
|
||||
this.outerColor = outerColor;
|
||||
updateColors();
|
||||
}
|
||||
|
||||
public void updateColors() {
|
||||
innerPaint.setColor(Theme.getColor(innerKey));
|
||||
outerPaint.setColor(Theme.getColor(outerKey));
|
||||
if (innerKey != null) {
|
||||
innerPaint.setColor(Theme.getColor(innerKey));
|
||||
} else {
|
||||
innerPaint.setColor(innerColor);
|
||||
}
|
||||
if (outerKey != null) {
|
||||
outerPaint.setColor(Theme.getColor(outerKey));
|
||||
} else {
|
||||
outerPaint.setColor(outerColor);
|
||||
}
|
||||
invalidate();
|
||||
}
|
||||
|
||||
|
|
|
@ -1134,8 +1134,12 @@ public class FilterTabsView extends FrameLayout {
|
|||
}
|
||||
}
|
||||
if (indicatorWidth != 0) {
|
||||
canvas.save();
|
||||
canvas.translate(listView.getTranslationX(), 0);
|
||||
canvas.scale(listView.getScaleX(), 1f, listView.getPivotX() + listView.getX(), listView.getPivotY());
|
||||
selectorDrawable.setBounds((int) indicatorX, height - AndroidUtilities.dpr(4), (int) (indicatorX + indicatorWidth), height);
|
||||
selectorDrawable.draw(canvas);
|
||||
canvas.restore();
|
||||
}
|
||||
}
|
||||
long newTime = SystemClock.elapsedRealtime();
|
||||
|
@ -1525,4 +1529,8 @@ public class FilterTabsView extends FrameLayout {
|
|||
viewHolder.itemView.setBackground(null);
|
||||
}
|
||||
}
|
||||
|
||||
public RecyclerListView getListView() {
|
||||
return listView;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,8 +17,13 @@ import android.content.Context;
|
|||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.LinearGradient;
|
||||
import android.graphics.Matrix;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.PorterDuffColorFilter;
|
||||
import android.graphics.RectF;
|
||||
import android.graphics.Shader;
|
||||
import android.graphics.Typeface;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
|
@ -26,8 +31,11 @@ import android.os.Bundle;
|
|||
import androidx.annotation.Keep;
|
||||
|
||||
import android.os.SystemClock;
|
||||
import android.text.Layout;
|
||||
import android.text.SpannableStringBuilder;
|
||||
import android.text.Spanned;
|
||||
import android.text.StaticLayout;
|
||||
import android.text.TextPaint;
|
||||
import android.text.TextUtils;
|
||||
import android.util.TypedValue;
|
||||
import android.view.Gravity;
|
||||
|
@ -104,6 +112,42 @@ public class FragmentContextView extends FrameLayout implements NotificationCent
|
|||
private boolean supportsCalls = true;
|
||||
private AvatarsImageView avatars;
|
||||
|
||||
private Paint gradientPaint;
|
||||
private LinearGradient linearGradient;
|
||||
private Matrix matrix;
|
||||
private int gradientWidth;
|
||||
private TextPaint gradientTextPaint;
|
||||
private StaticLayout timeLayout;
|
||||
private RectF rect = new RectF();
|
||||
private boolean scheduleRunnableScheduled;
|
||||
private Runnable updateScheduleTimeRunnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (gradientTextPaint == null || !(fragment instanceof ChatActivity)) {
|
||||
scheduleRunnableScheduled = false;
|
||||
return;
|
||||
}
|
||||
ChatObject.Call call = ((ChatActivity) fragment).getGroupCall();
|
||||
if (call == null || !call.isScheduled()) {
|
||||
timeLayout = null;
|
||||
scheduleRunnableScheduled = false;
|
||||
return;
|
||||
}
|
||||
int currentTime = fragment.getConnectionsManager().getCurrentTime();
|
||||
int diff = call.call.schedule_date - currentTime;
|
||||
String str;
|
||||
if (diff >= 24 * 60 * 60) {
|
||||
str = LocaleController.formatPluralString("Days", Math.round(diff / (24 * 60 * 60.0f)));
|
||||
} else {
|
||||
str = AndroidUtilities.formatFullDuration(call.call.schedule_date - currentTime);
|
||||
}
|
||||
int width = (int) Math.ceil(gradientTextPaint.measureText(str));
|
||||
timeLayout = new StaticLayout(str, gradientTextPaint, width, Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false);
|
||||
AndroidUtilities.runOnUIThread(updateScheduleTimeRunnable, 1000);
|
||||
frameLayout.invalidate();
|
||||
}
|
||||
};
|
||||
|
||||
private final int account = UserConfig.selectedAccount;
|
||||
|
||||
private boolean isLocation;
|
||||
|
@ -173,6 +217,44 @@ public class FragmentContextView extends FrameLayout implements NotificationCent
|
|||
avatars.invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDraw(Canvas canvas) {
|
||||
super.onDraw(canvas);
|
||||
if (currentStyle == 4 && timeLayout != null) {
|
||||
int width = (int) Math.ceil(timeLayout.getLineWidth(0)) + AndroidUtilities.dp(24);
|
||||
if (width != gradientWidth) {
|
||||
linearGradient = new LinearGradient(0, 0, width * 1.7f, 0, new int[]{0xff648CF4, 0xff8C69CF, 0xffD45979, 0xffD45979}, new float[]{0.0f, 0.294f, 0.588f, 1.0f}, Shader.TileMode.CLAMP);
|
||||
gradientPaint.setShader(linearGradient);
|
||||
gradientWidth = width;
|
||||
}
|
||||
ChatObject.Call call = ((ChatActivity) fragment).getGroupCall();
|
||||
float moveProgress = 0.0f;
|
||||
if (fragment != null && call != null && call.isScheduled()) {
|
||||
long diff = ((long) call.call.schedule_date) * 1000 - fragment.getConnectionsManager().getCurrentTimeMillis();
|
||||
if (diff < 0) {
|
||||
moveProgress = 1.0f;
|
||||
} else if (diff < 5000) {
|
||||
moveProgress = 1.0f - diff / 5000.0f;
|
||||
}
|
||||
if (diff < 6000) {
|
||||
invalidate();
|
||||
}
|
||||
}
|
||||
matrix.reset();
|
||||
matrix.postTranslate(-gradientWidth * 0.7f * moveProgress, 0);
|
||||
linearGradient.setLocalMatrix(matrix);
|
||||
int x = getMeasuredWidth() - width - AndroidUtilities.dp(10);
|
||||
int y = AndroidUtilities.dp(12);
|
||||
rect.set(0, 0, width, AndroidUtilities.dp(24));
|
||||
canvas.save();
|
||||
canvas.translate(x, y);
|
||||
canvas.drawRoundRect(rect, AndroidUtilities.dp(12), AndroidUtilities.dp(12), gradientPaint);
|
||||
canvas.translate(AndroidUtilities.dp(12), AndroidUtilities.dp(4));
|
||||
timeLayout.draw(canvas);
|
||||
canvas.restore();
|
||||
}
|
||||
}
|
||||
};
|
||||
addView(frameLayout, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 36, Gravity.TOP | Gravity.LEFT, 0, 0, 0, 0));
|
||||
|
||||
|
@ -528,7 +610,7 @@ public class FragmentContextView extends FrameLayout implements NotificationCent
|
|||
}
|
||||
} else if (currentStyle == 3) {
|
||||
if (VoIPService.getSharedInstance() != null && getContext() instanceof LaunchActivity) {
|
||||
GroupCallActivity.create((LaunchActivity) getContext(), AccountInstance.getInstance(VoIPService.getSharedInstance().getAccount()));
|
||||
GroupCallActivity.create((LaunchActivity) getContext(), AccountInstance.getInstance(VoIPService.getSharedInstance().getAccount()), null, null, false, null);
|
||||
}
|
||||
} else if (currentStyle == 4) {
|
||||
if (fragment.getParentActivity() == null) {
|
||||
|
@ -614,7 +696,7 @@ public class FragmentContextView extends FrameLayout implements NotificationCent
|
|||
show = true;
|
||||
} else if (fragment instanceof ChatActivity && fragment.getSendMessagesHelper().getImportingHistory(((ChatActivity) fragment).getDialogId()) != null && !isPlayingVoice()) {
|
||||
show = true;
|
||||
} else if (fragment instanceof ChatActivity && ((ChatActivity) fragment).getGroupCall() != null && ((ChatActivity) fragment).getGroupCall().call.participants_count > 0 && !GroupCallPip.isShowing() && !isPlayingVoice()) {
|
||||
} else if (fragment instanceof ChatActivity && ((ChatActivity) fragment).getGroupCall() != null && ((ChatActivity) fragment).getGroupCall().shouldShowPanel() && !GroupCallPip.isShowing() && !isPlayingVoice()) {
|
||||
show = true;
|
||||
} else {
|
||||
MessageObject messageObject = MediaController.getInstance().getPlayingMessageObject();
|
||||
|
@ -656,6 +738,10 @@ public class FragmentContextView extends FrameLayout implements NotificationCent
|
|||
}
|
||||
}
|
||||
currentStyle = style;
|
||||
frameLayout.setWillNotDraw(currentStyle != 4);
|
||||
if (style != 4) {
|
||||
timeLayout = null;
|
||||
}
|
||||
|
||||
if (avatars != null) {
|
||||
avatars.setStyle(currentStyle);
|
||||
|
@ -738,9 +824,7 @@ public class FragmentContextView extends FrameLayout implements NotificationCent
|
|||
frameLayout.setBackgroundColor(Theme.getColor(Theme.key_inappPlayerBackground));
|
||||
frameLayout.setTag(Theme.key_inappPlayerBackground);
|
||||
muteButton.setVisibility(GONE);
|
||||
|
||||
subtitleTextView.setVisibility(VISIBLE);
|
||||
joinButton.setVisibility(VISIBLE);
|
||||
|
||||
for (int i = 0; i < 2; i++) {
|
||||
TextView textView = i == 0 ? titleTextView.getTextView() : titleTextView.getNextTextView();
|
||||
|
@ -754,7 +838,6 @@ public class FragmentContextView extends FrameLayout implements NotificationCent
|
|||
}
|
||||
titleTextView.setTag(Theme.key_inappPlayerPerformer);
|
||||
titleTextView.setPadding(0, 0, 0, 0);
|
||||
titleTextView.setText(LocaleController.getString("VoipGroupVoiceChat", R.string.VoipGroupVoiceChat), false);
|
||||
|
||||
importingImageView.setVisibility(GONE);
|
||||
importingImageView.stopAnimation();
|
||||
|
@ -820,6 +903,10 @@ public class FragmentContextView extends FrameLayout implements NotificationCent
|
|||
animatorSet.cancel();
|
||||
animatorSet = null;
|
||||
}
|
||||
if (scheduleRunnableScheduled) {
|
||||
AndroidUtilities.cancelRunOnUIThread(updateScheduleTimeRunnable);
|
||||
scheduleRunnableScheduled = false;
|
||||
}
|
||||
visible = false;
|
||||
NotificationCenter.getInstance(account).onAnimationFinish(animationIndex);
|
||||
topPadding = 0;
|
||||
|
@ -885,7 +972,7 @@ public class FragmentContextView extends FrameLayout implements NotificationCent
|
|||
checkCall(true);
|
||||
} else if (fragment instanceof ChatActivity && fragment.getSendMessagesHelper().getImportingHistory(((ChatActivity) fragment).getDialogId()) != null && !isPlayingVoice()) {
|
||||
checkImport(true);
|
||||
} else if (fragment instanceof ChatActivity && ((ChatActivity) fragment).getGroupCall() != null && ((ChatActivity) fragment).getGroupCall().call.participants_count > 0 && !GroupCallPip.isShowing() && !isPlayingVoice()) {
|
||||
} else if (fragment instanceof ChatActivity && ((ChatActivity) fragment).getGroupCall() != null && ((ChatActivity) fragment).getGroupCall().shouldShowPanel() && !GroupCallPip.isShowing() && !isPlayingVoice()) {
|
||||
checkCall(true);
|
||||
} else {
|
||||
checkPlayer(true);
|
||||
|
@ -905,6 +992,11 @@ public class FragmentContextView extends FrameLayout implements NotificationCent
|
|||
muteDrawable.setCurrentFrame(muteDrawable.getCustomEndFrame() - 1, false, true);
|
||||
muteButton.invalidate();
|
||||
}
|
||||
} else if (currentStyle == 4) {
|
||||
if (!scheduleRunnableScheduled) {
|
||||
scheduleRunnableScheduled = true;
|
||||
updateScheduleTimeRunnable.run();
|
||||
}
|
||||
}
|
||||
|
||||
if (visible && topPadding == 0) {
|
||||
|
@ -963,7 +1055,9 @@ public class FragmentContextView extends FrameLayout implements NotificationCent
|
|||
if (visible && currentStyle == 4) {
|
||||
ChatObject.Call call = ((ChatActivity) fragment).getGroupCall();
|
||||
if (call != null) {
|
||||
if (call.call.participants_count == 0) {
|
||||
if (call.isScheduled()) {
|
||||
subtitleTextView.setText(LocaleController.formatStartsTime(call.call.schedule_date, 4), false);
|
||||
} else if (call.call.participants_count == 0) {
|
||||
subtitleTextView.setText(LocaleController.getString("MembersTalkingNobody", R.string.MembersTalkingNobody), false);
|
||||
} else {
|
||||
subtitleTextView.setText(LocaleController.formatPluralString("Participants", call.call.participants_count), false);
|
||||
|
@ -1226,7 +1320,7 @@ public class FragmentContextView extends FrameLayout implements NotificationCent
|
|||
boolean callAvailable = supportsCalls && VoIPService.getSharedInstance() != null && !VoIPService.getSharedInstance().isHangingUp() && VoIPService.getSharedInstance().getCallState() != VoIPService.STATE_WAITING_INCOMING && !GroupCallPip.isShowing();
|
||||
if (!isPlayingVoice() && !callAvailable && fragment instanceof ChatActivity && !GroupCallPip.isShowing()) {
|
||||
ChatObject.Call call = ((ChatActivity) fragment).getGroupCall();
|
||||
callAvailable = call != null && call.call.participants_count > 0;
|
||||
callAvailable = call != null && call.shouldShowPanel();
|
||||
}
|
||||
if (callAvailable) {
|
||||
checkCall(false);
|
||||
|
@ -1558,7 +1652,7 @@ public class FragmentContextView extends FrameLayout implements NotificationCent
|
|||
groupActive = false;
|
||||
if (!isPlayingVoice() && !GroupCallActivity.groupCallUiVisible && supportsCalls && !callAvailable && fragment instanceof ChatActivity) {
|
||||
ChatObject.Call call = ((ChatActivity) fragment).getGroupCall();
|
||||
if (call != null && call.call.participants_count > 0) {
|
||||
if (call != null && call.shouldShowPanel()) {
|
||||
callAvailable = true;
|
||||
groupActive = true;
|
||||
}
|
||||
|
@ -1614,7 +1708,7 @@ public class FragmentContextView extends FrameLayout implements NotificationCent
|
|||
int newStyle;
|
||||
if (groupActive) {
|
||||
newStyle = 4;
|
||||
} else if (voIPService != null && voIPService.groupCall != null) {
|
||||
} else if (voIPService.groupCall != null) {
|
||||
newStyle = 3;
|
||||
} else {
|
||||
newStyle = 1;
|
||||
|
@ -1653,11 +1747,37 @@ public class FragmentContextView extends FrameLayout implements NotificationCent
|
|||
updateStyle(4);
|
||||
|
||||
ChatObject.Call call = ((ChatActivity) fragment).getGroupCall();
|
||||
if (call.isScheduled()) {
|
||||
if (gradientPaint == null) {
|
||||
gradientTextPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG);
|
||||
gradientTextPaint.setColor(0xffffffff);
|
||||
gradientTextPaint.setTextSize(AndroidUtilities.dp(14));
|
||||
gradientTextPaint.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
|
||||
|
||||
if (call.call.participants_count == 0) {
|
||||
subtitleTextView.setText(LocaleController.getString("MembersTalkingNobody", R.string.MembersTalkingNobody), false);
|
||||
gradientPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
|
||||
gradientPaint.setColor(0xffffffff);
|
||||
|
||||
matrix = new Matrix();
|
||||
}
|
||||
joinButton.setVisibility(GONE);
|
||||
if (!TextUtils.isEmpty(call.call.title)) {
|
||||
titleTextView.setText(call.call.title, false);
|
||||
} else {
|
||||
titleTextView.setText(LocaleController.getString("VoipGroupScheduledVoiceChat", R.string.VoipGroupScheduledVoiceChat), false);
|
||||
}
|
||||
subtitleTextView.setText(LocaleController.formatStartsTime(call.call.schedule_date, 2), false);
|
||||
if (!scheduleRunnableScheduled) {
|
||||
scheduleRunnableScheduled = true;
|
||||
updateScheduleTimeRunnable.run();
|
||||
}
|
||||
} else {
|
||||
subtitleTextView.setText(LocaleController.formatPluralString("Participants", call.call.participants_count), false);
|
||||
joinButton.setVisibility(VISIBLE);
|
||||
titleTextView.setText(LocaleController.getString("VoipGroupVoiceChat", R.string.VoipGroupVoiceChat), false);
|
||||
if (call.call.participants_count == 0) {
|
||||
subtitleTextView.setText(LocaleController.getString("MembersTalkingNobody", R.string.MembersTalkingNobody), false);
|
||||
} else {
|
||||
subtitleTextView.setText(LocaleController.formatPluralString("Participants", call.call.participants_count), false);
|
||||
}
|
||||
}
|
||||
|
||||
updateAvatars(avatars.wasDraw && updateAnimated);
|
||||
|
|
|
@ -10,6 +10,8 @@ import android.graphics.Shader;
|
|||
import android.os.SystemClock;
|
||||
import android.view.View;
|
||||
|
||||
import com.google.android.exoplayer2.util.Log;
|
||||
|
||||
import org.telegram.messenger.AndroidUtilities;
|
||||
import org.telegram.messenger.ChatObject;
|
||||
import org.telegram.messenger.Utilities;
|
||||
|
@ -78,7 +80,11 @@ public class FragmentContextViewWavesDrawable {
|
|||
if (dt > 20) {
|
||||
dt = 17;
|
||||
}
|
||||
|
||||
if (dt < 3) {
|
||||
update = false;
|
||||
}
|
||||
}
|
||||
if (update) {
|
||||
if (animateToAmplitude != amplitude) {
|
||||
amplitude += animateAmplitudeDiff * dt;
|
||||
if (animateAmplitudeDiff > 0) {
|
||||
|
@ -145,7 +151,7 @@ public class FragmentContextViewWavesDrawable {
|
|||
lineBlobDrawable2.minRadius = AndroidUtilities.dp(0);
|
||||
lineBlobDrawable2.maxRadius = AndroidUtilities.dp(3) + AndroidUtilities.dp(9) * amplitude;
|
||||
|
||||
if (i == 1) {
|
||||
if (i == 1 && update) {
|
||||
lineBlobDrawable.update(amplitude, 0.3f);
|
||||
lineBlobDrawable1.update(amplitude, 0.7f);
|
||||
lineBlobDrawable2.update(amplitude, 0.7f);
|
||||
|
|
|
@ -143,7 +143,7 @@ public class GroupCreateSpan extends View {
|
|||
} else {
|
||||
avatarDrawable.setInfo(user);
|
||||
firstName = UserObject.getFirstName(user);
|
||||
imageLocation = ImageLocation.getForUser(user, false);
|
||||
imageLocation = ImageLocation.getForUserOrChat(user, ImageLocation.TYPE_SMALL);
|
||||
imageParent = user;
|
||||
}
|
||||
} else if (object instanceof TLRPC.Chat) {
|
||||
|
@ -151,7 +151,7 @@ public class GroupCreateSpan extends View {
|
|||
avatarDrawable.setInfo(chat);
|
||||
uid = -chat.id;
|
||||
firstName = chat.title;
|
||||
imageLocation = ImageLocation.getForChat(chat, false);
|
||||
imageLocation = ImageLocation.getForUserOrChat(chat, ImageLocation.TYPE_SMALL);
|
||||
imageParent = chat;
|
||||
} else {
|
||||
avatarDrawable.setInfo(0, contact.first_name, contact.last_name);
|
||||
|
|
|
@ -331,12 +331,14 @@ public class HintView extends FrameLayout {
|
|||
top += AndroidUtilities.dp(4);
|
||||
} else if (currentType == 6) {
|
||||
top += view.getMeasuredHeight() + getMeasuredHeight() + AndroidUtilities.dp(10);
|
||||
} else if (currentType == 7 || currentType == 8) {
|
||||
} else if (currentType == 7 || currentType == 8 && isTopArrow) {
|
||||
top += view.getMeasuredHeight() + getMeasuredHeight() + AndroidUtilities.dp(8);
|
||||
} else if (currentType == 8) {
|
||||
top -= AndroidUtilities.dp(10);
|
||||
}
|
||||
|
||||
int centerX;
|
||||
if (currentType == 8) {
|
||||
if (currentType == 8 && isTopArrow) {
|
||||
if (view instanceof SimpleTextView) {
|
||||
SimpleTextView textView = (SimpleTextView) view;
|
||||
Drawable drawable = textView.getRightDrawable();
|
||||
|
@ -374,7 +376,9 @@ public class HintView extends FrameLayout {
|
|||
leftMargin = ((MarginLayoutParams) getLayoutParams()).leftMargin;
|
||||
rightMargin = ((MarginLayoutParams) getLayoutParams()).rightMargin;
|
||||
}
|
||||
if (centerX > parentView.getMeasuredWidth() / 2) {
|
||||
if (currentType == 8 && !isTopArrow) {
|
||||
offset = (parentWidth - leftMargin - rightMargin - getMeasuredWidth()) / 2;
|
||||
} else if (centerX > parentView.getMeasuredWidth() / 2) {
|
||||
if (currentType == TYPE_SEARCH_AS_LIST) {
|
||||
offset = (int) (parentWidth - getMeasuredWidth() * 1.5f);
|
||||
} else {
|
||||
|
|
|
@ -88,6 +88,7 @@ public class ImageUpdater implements NotificationCenter.NotificationCenterDelega
|
|||
private double videoTimestamp;
|
||||
|
||||
private boolean canSelectVideo;
|
||||
private boolean forceDarkTheme;
|
||||
|
||||
private final static int attach_photo = 0;
|
||||
|
||||
|
@ -208,6 +209,11 @@ public class ImageUpdater implements NotificationCenter.NotificationCenterDelega
|
|||
useAttachMenu = searchAvailable = value;
|
||||
}
|
||||
|
||||
public void setSearchAvailable(boolean value, boolean useAttachMenu) {
|
||||
this.useAttachMenu = useAttachMenu;
|
||||
searchAvailable = value;
|
||||
}
|
||||
|
||||
public void setUploadAfterSelect(boolean value) {
|
||||
uploadAfterSelect = value;
|
||||
}
|
||||
|
@ -319,7 +325,7 @@ public class ImageUpdater implements NotificationCenter.NotificationCenterDelega
|
|||
return;
|
||||
}
|
||||
if (chatAttachAlert == null) {
|
||||
chatAttachAlert = new ChatAttachAlert(parentFragment.getParentActivity(), parentFragment);
|
||||
chatAttachAlert = new ChatAttachAlert(parentFragment.getParentActivity(), parentFragment, forceDarkTheme);
|
||||
chatAttachAlert.setAvatarPicker(canSelectVideo ? 2 : 1, searchAvailable);
|
||||
chatAttachAlert.setDelegate(new ChatAttachAlert.ChatAttachViewDelegate() {
|
||||
|
||||
|
@ -882,4 +888,8 @@ public class ImageUpdater implements NotificationCenter.NotificationCenterDelega
|
|||
parentFragment.getFileLoader().uploadFile(uploadingVideo, false, false, (int) convertingVideo.videoEditedInfo.estimatedSize, ConnectionsManager.FileTypeVideo, false);
|
||||
}
|
||||
}
|
||||
|
||||
public void setForceDarkTheme(boolean forceDarkTheme) {
|
||||
this.forceDarkTheme = forceDarkTheme;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@ import org.telegram.ui.ActionBar.BaseFragment;
|
|||
import org.telegram.ui.ActionBar.BottomSheet;
|
||||
import org.telegram.ui.ActionBar.Theme;
|
||||
import org.telegram.ui.Cells.GroupCreateUserCell;
|
||||
import org.telegram.ui.ContentPreviewViewer;
|
||||
import org.telegram.ui.Cells.ShareDialogCell;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
|
@ -67,6 +67,7 @@ public class JoinCallAlert extends BottomSheet {
|
|||
private TLRPC.Peer selectedPeer;
|
||||
private TLRPC.Peer currentPeer;
|
||||
private TLRPC.InputPeer selectAfterDismiss;
|
||||
private boolean schedule;
|
||||
|
||||
private boolean animationInProgress;
|
||||
|
||||
|
@ -101,21 +102,26 @@ public class JoinCallAlert extends BottomSheet {
|
|||
}
|
||||
|
||||
public interface JoinCallAlertDelegate {
|
||||
void didSelectChat(TLRPC.InputPeer peer, boolean hasFewPeers);
|
||||
void didSelectChat(TLRPC.InputPeer peer, boolean hasFewPeers, boolean schedule);
|
||||
}
|
||||
|
||||
public class BottomSheetCell extends FrameLayout {
|
||||
|
||||
private View background;
|
||||
private TextView[] textView = new TextView[2];
|
||||
private LinearLayout linearLayout;
|
||||
private boolean hasBackground;
|
||||
|
||||
public BottomSheetCell(Context context) {
|
||||
public BottomSheetCell(Context context, boolean withoutBackground) {
|
||||
super(context);
|
||||
|
||||
hasBackground = !withoutBackground;
|
||||
setBackground(null);
|
||||
|
||||
background = new View(context);
|
||||
background.setBackground(Theme.createSimpleSelectorRoundRectDrawable(AndroidUtilities.dp(4), Theme.getColor(Theme.key_featuredStickers_addButton), Theme.getColor(Theme.key_featuredStickers_addButtonPressed)));
|
||||
addView(background, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, 0, 16, 16, 16, 16));
|
||||
if (hasBackground) {
|
||||
background.setBackground(Theme.createSimpleSelectorRoundRectDrawable(AndroidUtilities.dp(4), Theme.getColor(Theme.key_featuredStickers_addButton), Theme.getColor(Theme.key_featuredStickers_addButtonPressed)));
|
||||
}
|
||||
addView(background, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, 0, 16, withoutBackground ? 0 : 16, 16, 16));
|
||||
|
||||
for (int a = 0; a < 2; a++) {
|
||||
textView[a] = new TextView(context);
|
||||
|
@ -124,9 +130,14 @@ public class JoinCallAlert extends BottomSheet {
|
|||
textView[a].setGravity(Gravity.CENTER_HORIZONTAL);
|
||||
textView[a].setEllipsize(TextUtils.TruncateAt.END);
|
||||
textView[a].setGravity(Gravity.CENTER);
|
||||
textView[a].setTextColor(Theme.getColor(Theme.key_featuredStickers_buttonText));
|
||||
if (hasBackground) {
|
||||
textView[a].setTextColor(Theme.getColor(Theme.key_featuredStickers_buttonText));
|
||||
textView[a].setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
|
||||
} else {
|
||||
textView[a].setTextColor(Theme.getColor(Theme.key_featuredStickers_addButton));
|
||||
}
|
||||
textView[a].setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14);
|
||||
textView[a].setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
|
||||
textView[a].setPadding(0, 0, 0, hasBackground ? 0 : AndroidUtilities.dp(13));
|
||||
addView(textView[a], LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.CENTER));
|
||||
if (a == 1) {
|
||||
textView[a].setAlpha(0.0f);
|
||||
|
@ -136,7 +147,7 @@ public class JoinCallAlert extends BottomSheet {
|
|||
|
||||
@Override
|
||||
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
||||
super.onMeasure(widthMeasureSpec, MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(80), MeasureSpec.EXACTLY));
|
||||
super.onMeasure(widthMeasureSpec, MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(hasBackground ? 80 : 50), MeasureSpec.EXACTLY));
|
||||
}
|
||||
|
||||
public void setText(CharSequence text, boolean animated) {
|
||||
|
@ -201,16 +212,16 @@ public class JoinCallAlert extends BottomSheet {
|
|||
}
|
||||
}
|
||||
|
||||
public static void open(Context context, int did, AccountInstance accountInstance, BaseFragment fragment, int type, JoinCallAlertDelegate delegate) {
|
||||
public static void open(Context context, int did, AccountInstance accountInstance, BaseFragment fragment, int type, TLRPC.Peer scheduledPeer, JoinCallAlertDelegate delegate) {
|
||||
if (context == null || delegate == null) {
|
||||
return;
|
||||
}
|
||||
if (lastCachedAccount == accountInstance.getCurrentAccount() && lastCacheDid == did && cachedChats != null && SystemClock.elapsedRealtime() - lastCacheTime < 5 * 60 * 1000) {
|
||||
if (cachedChats.size() == 1) {
|
||||
if (cachedChats.size() == 1 && type != TYPE_CREATE) {
|
||||
TLRPC.InputPeer peer = accountInstance.getMessagesController().getInputPeer(MessageObject.getPeerId(cachedChats.get(0)));
|
||||
delegate.didSelectChat(peer, false);
|
||||
delegate.didSelectChat(peer, false, false);
|
||||
} else {
|
||||
showAlert(context, cachedChats, fragment, type, delegate);
|
||||
showAlert(context, did, cachedChats, fragment, type, scheduledPeer, delegate);
|
||||
}
|
||||
} else {
|
||||
final AlertDialog progressDialog = new AlertDialog(context, 3);
|
||||
|
@ -226,7 +237,7 @@ public class JoinCallAlert extends BottomSheet {
|
|||
TLRPC.TL_phone_joinAsPeers res = (TLRPC.TL_phone_joinAsPeers) response;
|
||||
if (res.peers.size() == 1) {
|
||||
TLRPC.InputPeer peer = accountInstance.getMessagesController().getInputPeer(MessageObject.getPeerId(res.peers.get(0)));
|
||||
delegate.didSelectChat(peer, false);
|
||||
delegate.didSelectChat(peer, false, false);
|
||||
return;
|
||||
}
|
||||
cachedChats = res.peers;
|
||||
|
@ -235,7 +246,7 @@ public class JoinCallAlert extends BottomSheet {
|
|||
lastCachedAccount = accountInstance.getCurrentAccount();
|
||||
accountInstance.getMessagesController().putChats(res.chats, false);
|
||||
accountInstance.getMessagesController().putUsers(res.users, false);
|
||||
showAlert(context, res.peers, fragment, type, delegate);
|
||||
showAlert(context, did, res.peers, fragment, type, scheduledPeer, delegate);
|
||||
}
|
||||
}));
|
||||
progressDialog.setOnCancelListener(dialog -> accountInstance.getConnectionsManager().cancelRequest(reqId, true));
|
||||
|
@ -247,8 +258,8 @@ public class JoinCallAlert extends BottomSheet {
|
|||
}
|
||||
}
|
||||
|
||||
private static void showAlert(Context context, ArrayList<TLRPC.Peer> peers, BaseFragment fragment, int type, JoinCallAlertDelegate delegate) {
|
||||
JoinCallAlert alert = new JoinCallAlert(context, peers, type, delegate);
|
||||
private static void showAlert(Context context, long dialogId, ArrayList<TLRPC.Peer> peers, BaseFragment fragment, int type, TLRPC.Peer scheduledPeer, JoinCallAlertDelegate delegate) {
|
||||
JoinCallAlert alert = new JoinCallAlert(context, dialogId, peers, type, scheduledPeer, delegate);
|
||||
if (fragment != null) {
|
||||
if (fragment.getParentActivity() != null) {
|
||||
fragment.showDialog(alert);
|
||||
|
@ -258,14 +269,13 @@ public class JoinCallAlert extends BottomSheet {
|
|||
}
|
||||
}
|
||||
|
||||
private JoinCallAlert(Context context, ArrayList<TLRPC.Peer> chats, int type, JoinCallAlertDelegate delegate) {
|
||||
private JoinCallAlert(Context context, long dialogId, ArrayList<TLRPC.Peer> arrayList, int type, TLRPC.Peer scheduledPeer, JoinCallAlertDelegate delegate) {
|
||||
super(context, false);
|
||||
setApplyBottomPadding(false);
|
||||
this.chats = chats;
|
||||
chats = new ArrayList<>(arrayList);
|
||||
this.delegate = delegate;
|
||||
currentType = type;
|
||||
|
||||
|
||||
shadowDrawable = context.getResources().getDrawable(R.drawable.sheet_shadow_round).mutate();
|
||||
if (type == TYPE_DISPLAY) {
|
||||
if (VoIPService.getSharedInstance() != null) {
|
||||
|
@ -277,6 +287,15 @@ public class JoinCallAlert extends BottomSheet {
|
|||
break;
|
||||
}
|
||||
}
|
||||
} else if (scheduledPeer != null) {
|
||||
long did = MessageObject.getPeerId(scheduledPeer);
|
||||
for (int a = 0, N = chats.size(); a < N; a++) {
|
||||
TLRPC.Peer p = chats.get(a);
|
||||
if (MessageObject.getPeerId(p) == did) {
|
||||
selectedPeer = currentPeer = p;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
selectedPeer = chats.get(0);
|
||||
}
|
||||
|
@ -286,77 +305,119 @@ public class JoinCallAlert extends BottomSheet {
|
|||
selectedPeer = chats.get(0);
|
||||
}
|
||||
|
||||
containerView = new FrameLayout(context) {
|
||||
ViewGroup internalLayout;
|
||||
if (currentType == TYPE_CREATE) {
|
||||
LinearLayout linearLayout = new LinearLayout(context) {
|
||||
|
||||
@Override
|
||||
public boolean onInterceptTouchEvent(MotionEvent ev) {
|
||||
if (ev.getAction() == MotionEvent.ACTION_DOWN && scrollOffsetY != 0 && ev.getY() < scrollOffsetY) {
|
||||
dismiss();
|
||||
return true;
|
||||
boolean sorted;
|
||||
|
||||
@Override
|
||||
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
||||
if (currentType == TYPE_CREATE) {
|
||||
int width = MeasureSpec.getSize(widthMeasureSpec);
|
||||
int totalWidth = chats.size() * AndroidUtilities.dp(95);
|
||||
LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams) listView.getLayoutParams();
|
||||
if (totalWidth > width) {
|
||||
layoutParams.width = LayoutHelper.MATCH_PARENT;
|
||||
layoutParams.gravity = Gravity.TOP | Gravity.LEFT;
|
||||
if (!sorted) {
|
||||
if (selectedPeer != null) {
|
||||
chats.remove(selectedPeer);
|
||||
chats.add(0, selectedPeer);
|
||||
}
|
||||
sorted = true;
|
||||
}
|
||||
} else {
|
||||
layoutParams.width = LayoutHelper.WRAP_CONTENT;
|
||||
layoutParams.gravity = Gravity.TOP | Gravity.CENTER_HORIZONTAL;
|
||||
if (!sorted) {
|
||||
if (selectedPeer != null) {
|
||||
int idx;
|
||||
if (chats.size() % 2 == 0) {
|
||||
idx = Math.max(0, chats.size() / 2 - 1);
|
||||
} else {
|
||||
idx = chats.size() / 2;
|
||||
}
|
||||
chats.remove(selectedPeer);
|
||||
chats.add(idx, selectedPeer);
|
||||
}
|
||||
sorted = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
|
||||
}
|
||||
return super.onInterceptTouchEvent(ev);
|
||||
}
|
||||
};
|
||||
linearLayout.setOrientation(LinearLayout.VERTICAL);
|
||||
setCustomView(internalLayout = linearLayout);
|
||||
} else {
|
||||
containerView = new FrameLayout(context) {
|
||||
|
||||
@Override
|
||||
public boolean onTouchEvent(MotionEvent e) {
|
||||
return !isDismissed() && super.onTouchEvent(e);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
||||
int height = MeasureSpec.getSize(heightMeasureSpec);
|
||||
if (Build.VERSION.SDK_INT >= 21) {
|
||||
height -= AndroidUtilities.statusBarHeight;
|
||||
@Override
|
||||
public boolean onInterceptTouchEvent(MotionEvent ev) {
|
||||
if (ev.getAction() == MotionEvent.ACTION_DOWN && scrollOffsetY != 0 && ev.getY() < scrollOffsetY) {
|
||||
dismiss();
|
||||
return true;
|
||||
}
|
||||
return super.onInterceptTouchEvent(ev);
|
||||
}
|
||||
measureChildWithMargins(messageTextView, widthMeasureSpec, 0, heightMeasureSpec, 0);
|
||||
int h = messageTextView.getMeasuredHeight();
|
||||
((LayoutParams) listView.getLayoutParams()).topMargin = AndroidUtilities.dp(65) + h;
|
||||
int measuredWidth = getMeasuredWidth();
|
||||
int padding;
|
||||
int contentSize = AndroidUtilities.dp(80) + chats.size() * AndroidUtilities.dp(58) + backgroundPaddingTop + AndroidUtilities.dp(55) + h;
|
||||
if (contentSize < height / 5 * 3) {
|
||||
padding = height - contentSize;
|
||||
} else {
|
||||
padding = height / 5 * 2;
|
||||
}
|
||||
if (listView.getPaddingTop() != padding) {
|
||||
ignoreLayout = true;
|
||||
listView.setPadding(0, padding, 0, 0);
|
||||
ignoreLayout = false;
|
||||
}
|
||||
super.onMeasure(widthMeasureSpec, MeasureSpec.makeMeasureSpec(height, MeasureSpec.EXACTLY));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
|
||||
super.onLayout(changed, left, top, right, bottom);
|
||||
updateLayout();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void requestLayout() {
|
||||
if (ignoreLayout) {
|
||||
return;
|
||||
@Override
|
||||
public boolean onTouchEvent(MotionEvent e) {
|
||||
return !isDismissed() && super.onTouchEvent(e);
|
||||
}
|
||||
super.requestLayout();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDraw(Canvas canvas) {
|
||||
shadowDrawable.setBounds(0, scrollOffsetY - backgroundPaddingTop, getMeasuredWidth(), getMeasuredHeight());
|
||||
shadowDrawable.draw(canvas);
|
||||
}
|
||||
};
|
||||
containerView.setWillNotDraw(false);
|
||||
containerView.setPadding(backgroundPaddingLeft, 0, backgroundPaddingLeft, 0);
|
||||
@Override
|
||||
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
||||
int height = MeasureSpec.getSize(heightMeasureSpec);
|
||||
if (Build.VERSION.SDK_INT >= 21) {
|
||||
height -= AndroidUtilities.statusBarHeight;
|
||||
}
|
||||
measureChildWithMargins(messageTextView, widthMeasureSpec, 0, heightMeasureSpec, 0);
|
||||
int h = messageTextView.getMeasuredHeight();
|
||||
((LayoutParams) listView.getLayoutParams()).topMargin = AndroidUtilities.dp(65) + h;
|
||||
int measuredWidth = getMeasuredWidth();
|
||||
int padding;
|
||||
int contentSize = AndroidUtilities.dp(80) + chats.size() * AndroidUtilities.dp(58) + backgroundPaddingTop + AndroidUtilities.dp(55) + h;
|
||||
if (contentSize < height / 5 * 3) {
|
||||
padding = height - contentSize;
|
||||
} else {
|
||||
padding = height / 5 * 2;
|
||||
}
|
||||
if (listView.getPaddingTop() != padding) {
|
||||
ignoreLayout = true;
|
||||
listView.setPadding(0, padding, 0, 0);
|
||||
ignoreLayout = false;
|
||||
}
|
||||
super.onMeasure(widthMeasureSpec, MeasureSpec.makeMeasureSpec(height, MeasureSpec.EXACTLY));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
|
||||
super.onLayout(changed, left, top, right, bottom);
|
||||
updateLayout();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void requestLayout() {
|
||||
if (ignoreLayout) {
|
||||
return;
|
||||
}
|
||||
super.requestLayout();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDraw(Canvas canvas) {
|
||||
shadowDrawable.setBounds(0, scrollOffsetY - backgroundPaddingTop, getMeasuredWidth(), getMeasuredHeight());
|
||||
shadowDrawable.draw(canvas);
|
||||
}
|
||||
};
|
||||
internalLayout = containerView;
|
||||
containerView.setWillNotDraw(false);
|
||||
containerView.setPadding(backgroundPaddingLeft, 0, backgroundPaddingLeft, 0);
|
||||
}
|
||||
|
||||
listView = new RecyclerListView(context) {
|
||||
@Override
|
||||
public boolean onInterceptTouchEvent(MotionEvent event) {
|
||||
boolean result = ContentPreviewViewer.getInstance().onInterceptTouchEvent(event, listView, 0, null);
|
||||
return super.onInterceptTouchEvent(event) || result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void requestLayout() {
|
||||
if (ignoreLayout) {
|
||||
|
@ -365,7 +426,7 @@ public class JoinCallAlert extends BottomSheet {
|
|||
super.requestLayout();
|
||||
}
|
||||
};
|
||||
listView.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayoutManager.VERTICAL, false));
|
||||
listView.setLayoutManager(new LinearLayoutManager(getContext(), currentType == TYPE_CREATE ? LinearLayoutManager.HORIZONTAL : LinearLayoutManager.VERTICAL, false));
|
||||
listView.setAdapter(new ListAdapter(context));
|
||||
listView.setVerticalScrollBarEnabled(false);
|
||||
listView.setClipToPadding(false);
|
||||
|
@ -381,18 +442,41 @@ public class JoinCallAlert extends BottomSheet {
|
|||
if (animationInProgress || chats.get(position) == selectedPeer) {
|
||||
return;
|
||||
}
|
||||
GroupCreateUserCell cell = (GroupCreateUserCell) view;
|
||||
selectedPeer = chats.get(position);
|
||||
cell.setChecked(true, true);
|
||||
if (view instanceof GroupCreateUserCell) {
|
||||
((GroupCreateUserCell) view).setChecked(true, true);
|
||||
} else if (view instanceof ShareDialogCell) {
|
||||
((ShareDialogCell) view).setChecked(true, true);
|
||||
view.invalidate();
|
||||
}
|
||||
for (int a = 0, N = listView.getChildCount(); a < N; a++) {
|
||||
GroupCreateUserCell child = (GroupCreateUserCell) listView.getChildAt(a);
|
||||
if (child != cell) {
|
||||
child.setChecked(false, true);
|
||||
View child = listView.getChildAt(a);
|
||||
if (child != view) {
|
||||
if (view instanceof GroupCreateUserCell) {
|
||||
((GroupCreateUserCell) child).setChecked(false, true);
|
||||
} else if (view instanceof ShareDialogCell) {
|
||||
((ShareDialogCell) child).setChecked(false, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
updateDoneButton(true);
|
||||
if (currentType != TYPE_CREATE) {
|
||||
updateDoneButton(true);
|
||||
}
|
||||
});
|
||||
containerView.addView(listView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, Gravity.TOP | Gravity.LEFT, 0, 100, 0, 80));
|
||||
if (type != TYPE_CREATE) {
|
||||
internalLayout.addView(listView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, Gravity.TOP | Gravity.LEFT, 0, 100, 0, 80));
|
||||
} else {
|
||||
listView.setSelectorDrawableColor(0);
|
||||
listView.setPadding(AndroidUtilities.dp(10), 0, AndroidUtilities.dp(10), 0);
|
||||
}
|
||||
|
||||
if (type == TYPE_CREATE) {
|
||||
RLottieImageView imageView = new RLottieImageView(context);
|
||||
imageView.setAutoRepeat(true);
|
||||
imageView.setAnimation(R.raw.utyan_schedule, 120, 120);
|
||||
imageView.playAnimation();
|
||||
internalLayout.addView(imageView, LayoutHelper.createLinear(160, 160, Gravity.CENTER_HORIZONTAL | Gravity.TOP, 17, 8, 17, 0));
|
||||
}
|
||||
|
||||
textView = new TextView(context);
|
||||
textView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
|
||||
|
@ -402,16 +486,19 @@ public class JoinCallAlert extends BottomSheet {
|
|||
} else {
|
||||
textView.setTextColor(Theme.getColor(Theme.key_dialogTextBlack));
|
||||
}
|
||||
if (type == TYPE_DISPLAY) {
|
||||
textView.setText(LocaleController.getString("VoipGroupDisplayAs", R.string.VoipGroupDisplayAs));
|
||||
} else if (type == TYPE_CREATE) {
|
||||
textView.setText(LocaleController.getString("VoipGroupStartAs", R.string.VoipGroupStartAs));
|
||||
} else {
|
||||
textView.setText(LocaleController.getString("VoipGroupJoinAs", R.string.VoipGroupJoinAs));
|
||||
}
|
||||
textView.setSingleLine(true);
|
||||
textView.setEllipsize(TextUtils.TruncateAt.END);
|
||||
containerView.addView(textView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.TOP | Gravity.LEFT, 23, 0, 23, 0));
|
||||
if (type == TYPE_CREATE) {
|
||||
textView.setText(LocaleController.getString("StartVoipChatTitle", R.string.StartVoipChatTitle));
|
||||
internalLayout.addView(textView, LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.TOP | Gravity.CENTER_HORIZONTAL, 23, 16, 23, 0));
|
||||
} else {
|
||||
if (type == TYPE_DISPLAY) {
|
||||
textView.setText(LocaleController.getString("VoipGroupDisplayAs", R.string.VoipGroupDisplayAs));
|
||||
} else {
|
||||
textView.setText(LocaleController.getString("VoipGroupJoinAs", R.string.VoipGroupJoinAs));
|
||||
}
|
||||
internalLayout.addView(textView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.TOP | Gravity.LEFT, 23, 8, 23, 0));
|
||||
}
|
||||
|
||||
messageTextView = new TextView(getContext());
|
||||
if (type == TYPE_DISPLAY) {
|
||||
|
@ -431,45 +518,86 @@ public class JoinCallAlert extends BottomSheet {
|
|||
}
|
||||
}
|
||||
}
|
||||
if (hasGroup) {
|
||||
messageTextView.setText(LocaleController.getString("VoipGroupStartAsInfoGroup", R.string.VoipGroupStartAsInfoGroup));
|
||||
} else {
|
||||
messageTextView.setText(LocaleController.getString("VoipGroupStartAsInfo", R.string.VoipGroupStartAsInfo));
|
||||
}
|
||||
messageTextView.setMovementMethod(new AndroidUtilities.LinkMovementMethodMy());
|
||||
messageTextView.setLinkTextColor(Theme.getColor(Theme.key_dialogTextLink));
|
||||
messageTextView.setGravity((LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP);
|
||||
containerView.addView(messageTextView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.TOP | Gravity.LEFT, 23, 0, 23, 5));
|
||||
if (type == TYPE_CREATE) {
|
||||
TLRPC.Chat chat = MessagesController.getInstance(currentAccount).getChat((int) -dialogId);
|
||||
StringBuilder builder = new StringBuilder();
|
||||
if (ChatObject.isChannel(chat) && !chat.megagroup) {
|
||||
builder.append(LocaleController.getString("VoipChannelStart2", R.string.VoipChannelStart2));
|
||||
} else {
|
||||
builder.append(LocaleController.getString("VoipGroupStart2", R.string.VoipGroupStart2));
|
||||
}
|
||||
if (chats.size() > 1) {
|
||||
builder.append("\n\n").append(LocaleController.getString("VoipChatDisplayedAs", R.string.VoipChatDisplayedAs));
|
||||
} else {
|
||||
listView.setVisibility(View.GONE);
|
||||
}
|
||||
messageTextView.setText(builder);
|
||||
messageTextView.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.TOP);
|
||||
internalLayout.addView(messageTextView, LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.TOP | Gravity.CENTER_HORIZONTAL, 23, 0, 23, 5));
|
||||
} else {
|
||||
if (hasGroup) {
|
||||
messageTextView.setText(LocaleController.getString("VoipGroupStartAsInfoGroup", R.string.VoipGroupStartAsInfoGroup));
|
||||
} else {
|
||||
messageTextView.setText(LocaleController.getString("VoipGroupStartAsInfo", R.string.VoipGroupStartAsInfo));
|
||||
}
|
||||
messageTextView.setGravity((LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP);
|
||||
internalLayout.addView(messageTextView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.TOP | Gravity.LEFT, 23, 0, 23, 5));
|
||||
}
|
||||
|
||||
doneButton = new BottomSheetCell(context);
|
||||
doneButton.setBackground(null);
|
||||
if (type == TYPE_CREATE) {
|
||||
internalLayout.addView(listView, LayoutHelper.createLinear(chats.size() < 5 ? LayoutHelper.WRAP_CONTENT : LayoutHelper.MATCH_PARENT, 95, Gravity.TOP | Gravity.CENTER_HORIZONTAL, 0, 6, 0, 0));
|
||||
}
|
||||
|
||||
doneButton = new BottomSheetCell(context, false);
|
||||
doneButton.background.setOnClickListener(v -> {
|
||||
TLRPC.InputPeer peer = MessagesController.getInstance(currentAccount).getInputPeer(MessageObject.getPeerId(selectedPeer));
|
||||
if (currentType == TYPE_DISPLAY) {
|
||||
if (selectedPeer != currentPeer) {
|
||||
delegate.didSelectChat(peer, chats.size() > 1);
|
||||
delegate.didSelectChat(peer, chats.size() > 1, false);
|
||||
}
|
||||
} else {
|
||||
selectAfterDismiss = peer;
|
||||
}
|
||||
dismiss();
|
||||
});
|
||||
containerView.addView(doneButton, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 50, Gravity.LEFT | Gravity.BOTTOM, 0, 0, 0, 0));
|
||||
if (currentType == TYPE_CREATE) {
|
||||
internalLayout.addView(doneButton, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, 50, Gravity.LEFT | Gravity.TOP, 0, 0, 0, 0));
|
||||
|
||||
BottomSheetCell scheduleButton = new BottomSheetCell(context, true);
|
||||
scheduleButton.setText(LocaleController.getString("VoipGroupScheduleVoiceChat", R.string.VoipGroupScheduleVoiceChat), false);
|
||||
scheduleButton.background.setOnClickListener(v -> {
|
||||
selectAfterDismiss = MessagesController.getInstance(currentAccount).getInputPeer(MessageObject.getPeerId(selectedPeer));
|
||||
schedule = true;
|
||||
dismiss();
|
||||
});
|
||||
internalLayout.addView(scheduleButton, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, 50, Gravity.LEFT | Gravity.TOP, 0, 0, 0, 0));
|
||||
} else {
|
||||
internalLayout.addView(doneButton, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 50, Gravity.LEFT | Gravity.BOTTOM, 0, 0, 0, 0));
|
||||
}
|
||||
updateDoneButton(false);
|
||||
}
|
||||
|
||||
private void updateDoneButton(boolean animated) {
|
||||
int did = MessageObject.getPeerId(selectedPeer);
|
||||
if (did > 0) {
|
||||
TLRPC.User user = MessagesController.getInstance(currentAccount).getUser(did);
|
||||
doneButton.setText(LocaleController.formatString("VoipGroupContinueAs", R.string.VoipGroupContinueAs, UserObject.getFirstName(user)), animated);
|
||||
if (currentType == TYPE_CREATE) {
|
||||
doneButton.setText(LocaleController.formatString("VoipGroupStartVoiceChat", R.string.VoipGroupStartVoiceChat), animated);
|
||||
} else {
|
||||
TLRPC.Chat chat = MessagesController.getInstance(currentAccount).getChat(-did);
|
||||
doneButton.setText(LocaleController.formatString("VoipGroupContinueAs", R.string.VoipGroupContinueAs, chat != null ? chat.title : ""), animated);
|
||||
int did = MessageObject.getPeerId(selectedPeer);
|
||||
if (did > 0) {
|
||||
TLRPC.User user = MessagesController.getInstance(currentAccount).getUser(did);
|
||||
doneButton.setText(LocaleController.formatString("VoipGroupContinueAs", R.string.VoipGroupContinueAs, UserObject.getFirstName(user)), animated);
|
||||
} else {
|
||||
TLRPC.Chat chat = MessagesController.getInstance(currentAccount).getChat(-did);
|
||||
doneButton.setText(LocaleController.formatString("VoipGroupContinueAs", R.string.VoipGroupContinueAs, chat != null ? chat.title : ""), animated);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void updateLayout() {
|
||||
if (currentType == TYPE_CREATE) {
|
||||
return;
|
||||
}
|
||||
if (listView.getChildCount() <= 0) {
|
||||
listView.setTopGlowOffset(scrollOffsetY = listView.getPaddingTop());
|
||||
containerView.invalidate();
|
||||
|
@ -491,7 +619,7 @@ public class JoinCallAlert extends BottomSheet {
|
|||
public void dismissInternal() {
|
||||
super.dismissInternal();
|
||||
if (selectAfterDismiss != null) {
|
||||
delegate.didSelectChat(selectAfterDismiss, chats.size() > 1);
|
||||
delegate.didSelectChat(selectAfterDismiss, chats.size() > 1, schedule);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -525,30 +653,41 @@ public class JoinCallAlert extends BottomSheet {
|
|||
|
||||
@Override
|
||||
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||
View view = new GroupCreateUserCell(context, 2, 0, false, currentType == TYPE_DISPLAY);
|
||||
View view;
|
||||
if (currentType == TYPE_CREATE) {
|
||||
view = new ShareDialogCell(context, ShareDialogCell.TYPE_CREATE);
|
||||
view.setLayoutParams(new RecyclerView.LayoutParams(AndroidUtilities.dp(80), AndroidUtilities.dp(100)));
|
||||
} else {
|
||||
view = new GroupCreateUserCell(context, 2, 0, false, currentType == TYPE_DISPLAY);
|
||||
}
|
||||
return new RecyclerListView.Holder(view);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewAttachedToWindow(RecyclerView.ViewHolder holder) {
|
||||
int position = holder.getAdapterPosition();
|
||||
GroupCreateUserCell cell = (GroupCreateUserCell) holder.itemView;
|
||||
Object object = cell.getObject();
|
||||
if (object != null) {
|
||||
int did = MessageObject.getPeerId(selectedPeer);
|
||||
int id;
|
||||
if (object instanceof TLRPC.Chat) {
|
||||
id = -((TLRPC.Chat) object).id;
|
||||
} else {
|
||||
id = ((TLRPC.User) object).id;
|
||||
long did = MessageObject.getPeerId(selectedPeer);
|
||||
if (holder.itemView instanceof GroupCreateUserCell) {
|
||||
GroupCreateUserCell cell = (GroupCreateUserCell) holder.itemView;
|
||||
Object object = cell.getObject();
|
||||
long id = 0;
|
||||
if (object != null) {
|
||||
if (object instanceof TLRPC.Chat) {
|
||||
id = -((TLRPC.Chat) object).id;
|
||||
} else {
|
||||
id = ((TLRPC.User) object).id;
|
||||
}
|
||||
}
|
||||
cell.setChecked(did == id, false);
|
||||
} else {
|
||||
ShareDialogCell cell = (ShareDialogCell) holder.itemView;
|
||||
long id = cell.getCurrentDialog();
|
||||
cell.setChecked(did == id, false);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
|
||||
GroupCreateUserCell cell = (GroupCreateUserCell) holder.itemView;
|
||||
int did = MessageObject.getPeerId(chats.get(position));
|
||||
TLObject object;
|
||||
String status;
|
||||
|
@ -559,7 +698,13 @@ public class JoinCallAlert extends BottomSheet {
|
|||
object = MessagesController.getInstance(currentAccount).getChat(-did);
|
||||
status = null;
|
||||
}
|
||||
cell.setObject(object, null, status, position != getItemCount() - 1);
|
||||
if (currentType == TYPE_CREATE) {
|
||||
ShareDialogCell cell = (ShareDialogCell) holder.itemView;
|
||||
cell.setDialog(did, did == MessageObject.getPeerId(selectedPeer), null);
|
||||
} else {
|
||||
GroupCreateUserCell cell = (GroupCreateUserCell) holder.itemView;
|
||||
cell.setObject(object, null, status, position != getItemCount() - 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -80,7 +80,7 @@ public class JoinCallByUrlAlert extends BottomSheet {
|
|||
linearLayout.addView(avatarImageView, LayoutHelper.createLinear(90, 90, Gravity.TOP | Gravity.CENTER_HORIZONTAL, 0, 29, 0, 0));
|
||||
|
||||
AvatarDrawable avatarDrawable = new AvatarDrawable(chat);
|
||||
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);
|
||||
|
||||
TextView percentTextView = new TextView(context);
|
||||
percentTextView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
|
||||
|
|
|
@ -68,7 +68,7 @@ public class JoinGroupAlert extends BottomSheet {
|
|||
avatarDrawable = new AvatarDrawable(invite.chat);
|
||||
title = invite.chat.title;
|
||||
participants_count = invite.chat.participants_count;
|
||||
avatarImageView.setImage(ImageLocation.getForChat(invite.chat, false), "50_50", avatarDrawable, invite);
|
||||
avatarImageView.setImage(ImageLocation.getForUserOrChat(invite.chat, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(invite.chat, ImageLocation.TYPE_STRIPPED), "50_50", avatarDrawable, invite);
|
||||
} else {
|
||||
avatarDrawable = new AvatarDrawable();
|
||||
avatarDrawable.setInfo(0, invite.title, null);
|
||||
|
|
|
@ -232,6 +232,7 @@ public class NumberPicker extends LinearLayout {
|
|||
public NumberPicker(Context context) {
|
||||
this(context, 18);
|
||||
}
|
||||
|
||||
public NumberPicker(Context context, int textSize) {
|
||||
super(context);
|
||||
mTextSize = AndroidUtilities.dp(textSize);
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue