mirror of
https://github.com/DrKLO/Telegram.git
synced 2024-12-22 14:35:03 +01:00
last vertion
This commit is contained in:
parent
5fa5549a4a
commit
97d3b13b88
331 changed files with 9892 additions and 22860 deletions
|
@ -1,6 +1,7 @@
|
|||
import org.gradle.nativeplatform.platform.internal.DefaultNativePlatform
|
||||
|
||||
apply plugin: 'com.android.library'
|
||||
apply plugin: 'kotlin-android'
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
|
@ -61,6 +62,25 @@ dependencies {
|
|||
}
|
||||
|
||||
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5'
|
||||
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.9.20"
|
||||
|
||||
//Retrofit
|
||||
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
|
||||
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
|
||||
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.1.0'
|
||||
|
||||
implementation 'commons-codec:commons-codec:1.15'
|
||||
|
||||
// material
|
||||
implementation 'com.google.android.material:material:1.3.0'
|
||||
|
||||
//SvgConverter
|
||||
implementation 'com.caverock:androidsvg:1.4'
|
||||
|
||||
implementation 'com.squareup.retrofit2:converter-scalars:2.1.0'
|
||||
|
||||
}
|
||||
|
||||
def isWindows = String.valueOf(DefaultNativePlatform.currentOperatingSystem.toFamilyName() == OperatingSystemFamily.WINDOWS)
|
||||
|
@ -200,6 +220,10 @@ android {
|
|||
buildConfigField "boolean", "BUILD_HOST_IS_WINDOWS", isWindows
|
||||
}
|
||||
}
|
||||
|
||||
buildFeatures {
|
||||
viewBinding = true
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -214,23 +238,3 @@ def getProps(String propName) {
|
|||
}
|
||||
}
|
||||
apply plugin: 'com.google.gms.google-services'
|
||||
|
||||
task checkVisibility {
|
||||
doFirst {
|
||||
def isPrivateBuild = project.gradle.startParameter.taskNames.find { it.contains("HA_private") }
|
||||
def isPublicAllowed = !project.hasProperty("IS_PRIVATE") || !project.property("IS_PRIVATE").toBoolean()
|
||||
if (!isPrivateBuild && !isPublicAllowed) {
|
||||
throw new GradleException("Building public version of private code!")
|
||||
}
|
||||
}
|
||||
doLast {
|
||||
if (project.gradle.startParameter.taskNames.find { it.contains("HA_public") }) {
|
||||
def privateBuild = file("${projectDir}_AppHockeyApp/afat/HA_private/app.apk")
|
||||
if (privateBuild.exists()) {
|
||||
privateBuild.delete()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
preBuild.dependsOn checkVisibility
|
|
@ -19,8 +19,8 @@
|
|||
<permission android:name="${applicationId}.permission.MAPS_RECEIVE" android:protectionLevel="signature"/>
|
||||
|
||||
<application
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:roundIcon="@mipmap/ic_launcher_round"
|
||||
android:icon="@mipmap/xatirchi_ic"
|
||||
android:roundIcon="@mipmap/xatirchi_ic"
|
||||
android:label="@string/AppNameBeta"
|
||||
android:theme="@style/Theme.TMessages.Start"
|
||||
android:hardwareAccelerated="@bool/useHardwareAcceleration"
|
||||
|
|
|
@ -21,8 +21,8 @@
|
|||
|
||||
|
||||
<application
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:roundIcon="@mipmap/ic_launcher_round"
|
||||
android:icon="@mipmap/xatirchi_ic"
|
||||
android:roundIcon="@mipmap/xatirchi_ic"
|
||||
android:label="@string/AppNameBeta"
|
||||
android:theme="@style/Theme.TMessages.Start"
|
||||
android:hardwareAccelerated="@bool/useHardwareAcceleration"
|
||||
|
|
Binary file not shown.
|
@ -19,8 +19,8 @@
|
|||
<permission android:name="${applicationId}.permission.MAPS_RECEIVE" android:protectionLevel="signature"/>
|
||||
|
||||
<application
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:roundIcon="@mipmap/ic_launcher_round"
|
||||
android:icon="@mipmap/xatirchi_ic"
|
||||
android:roundIcon="@mipmap/xatirchi_ic"
|
||||
android:label="@string/AppName"
|
||||
android:theme="@style/Theme.TMessages.Start"
|
||||
android:hardwareAccelerated="@bool/useHardwareAcceleration"
|
||||
|
|
|
@ -21,8 +21,8 @@
|
|||
<permission android:name="${applicationId}.permission.MAPS_RECEIVE" android:protectionLevel="signature"/>
|
||||
|
||||
<application
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:roundIcon="@mipmap/ic_launcher_round"
|
||||
android:icon="@mipmap/xatirchi_ic"
|
||||
android:roundIcon="@mipmap/xatirchi_ic"
|
||||
android:label="@string/AppName"
|
||||
android:theme="@style/Theme.TMessages.Start"
|
||||
android:hardwareAccelerated="@bool/useHardwareAcceleration"
|
||||
|
|
|
@ -25,8 +25,8 @@
|
|||
<uses-permission android:name="android.permission.SEND_SMS" />
|
||||
|
||||
<application
|
||||
android:icon="@mipmap/ic_launcher_sa"
|
||||
android:roundIcon="@mipmap/ic_launcher_sa"
|
||||
android:icon="@mipmap/xatirchi_ic"
|
||||
android:roundIcon="@mipmap/xatirchi_ic"
|
||||
android:label="@string/AppName"
|
||||
android:theme="@style/Theme.TMessages.Start"
|
||||
android:hardwareAccelerated="@bool/useHardwareAcceleration"
|
||||
|
|
67
TMessagesProj/google-services.json
Normal file
67
TMessagesProj/google-services.json
Normal file
|
@ -0,0 +1,67 @@
|
|||
{
|
||||
"project_info": {
|
||||
"project_number": "822513698196",
|
||||
"project_id": "xatirchi-b78c6",
|
||||
"storage_bucket": "xatirchi-b78c6.appspot.com"
|
||||
},
|
||||
"client": [
|
||||
{
|
||||
"client_info": {
|
||||
"mobilesdk_app_id": "1:822513698196:android:3257862aaaf054f7287b81",
|
||||
"android_client_info": {
|
||||
"package_name": "org.xatirchi.messenger"
|
||||
}
|
||||
},
|
||||
"oauth_client": [],
|
||||
"api_key": [
|
||||
{
|
||||
"current_key": "AIzaSyCaIiKctKLCfMvGdMHEel5Gj76TWzp_2EI"
|
||||
}
|
||||
],
|
||||
"services": {
|
||||
"appinvite_service": {
|
||||
"other_platform_oauth_client": []
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"client_info": {
|
||||
"mobilesdk_app_id": "1:822513698196:android:b24c53c9c7ef2b19287b81",
|
||||
"android_client_info": {
|
||||
"package_name": "org.xatirchi.messenger.beta"
|
||||
}
|
||||
},
|
||||
"oauth_client": [],
|
||||
"api_key": [
|
||||
{
|
||||
"current_key": "AIzaSyCaIiKctKLCfMvGdMHEel5Gj76TWzp_2EI"
|
||||
}
|
||||
],
|
||||
"services": {
|
||||
"appinvite_service": {
|
||||
"other_platform_oauth_client": []
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"client_info": {
|
||||
"mobilesdk_app_id": "1:822513698196:android:f155ef5b2ae92664287b81",
|
||||
"android_client_info": {
|
||||
"package_name": "org.xatirchi.messenger.web"
|
||||
}
|
||||
},
|
||||
"oauth_client": [],
|
||||
"api_key": [
|
||||
{
|
||||
"current_key": "AIzaSyCaIiKctKLCfMvGdMHEel5Gj76TWzp_2EI"
|
||||
}
|
||||
],
|
||||
"services": {
|
||||
"appinvite_service": {
|
||||
"other_platform_oauth_client": []
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"configuration_version": "1"
|
||||
}
|
|
@ -366,11 +366,9 @@ class Delegate : public ConnectiosManagerDelegate {
|
|||
jniEnv[instanceNum]->CallStaticVoidMethod(jclass_ConnectionsManager, jclass_ConnectionsManager_onPremiumFloodWait, instanceNum, requestToken, isUpload);
|
||||
}
|
||||
|
||||
void onIntegrityCheckClassic(int32_t instanceNum, int32_t requestToken, std::string project, std::string nonce) {
|
||||
jstring projectStr = jniEnv[instanceNum]->NewStringUTF(project.c_str());
|
||||
void onIntegrityCheckClassic(int32_t instanceNum, int32_t requestToken, std::string nonce) {
|
||||
jstring nonceStr = jniEnv[instanceNum]->NewStringUTF(nonce.c_str());
|
||||
jniEnv[instanceNum]->CallStaticVoidMethod(jclass_ConnectionsManager, jclass_ConnectionsManager_onIntegrityCheckClassic, instanceNum, requestToken, projectStr, nonceStr);
|
||||
jniEnv[instanceNum]->DeleteLocalRef(projectStr);
|
||||
jniEnv[instanceNum]->CallStaticVoidMethod(jclass_ConnectionsManager, jclass_ConnectionsManager_onIntegrityCheckClassic, instanceNum, requestToken, nonceStr);
|
||||
jniEnv[instanceNum]->DeleteLocalRef(nonceStr);
|
||||
}
|
||||
|
||||
|
@ -629,7 +627,7 @@ extern "C" int registerNativeTgNetFunctions(JavaVM *vm, JNIEnv *env) {
|
|||
if (jclass_ConnectionsManager_onPremiumFloodWait == 0) {
|
||||
return JNI_FALSE;
|
||||
}
|
||||
jclass_ConnectionsManager_onIntegrityCheckClassic = env->GetStaticMethodID(jclass_ConnectionsManager, "onIntegrityCheckClassic", "(IILjava/lang/String;Ljava/lang/String;)V");
|
||||
jclass_ConnectionsManager_onIntegrityCheckClassic = env->GetStaticMethodID(jclass_ConnectionsManager, "onIntegrityCheckClassic", "(IILjava/lang/String;)V");
|
||||
if (jclass_ConnectionsManager_onIntegrityCheckClassic == 0) {
|
||||
return JNI_FALSE;
|
||||
}
|
||||
|
|
|
@ -840,7 +840,7 @@ enum PARAM_NUM {
|
|||
PARAM_NUM_COUNT = 11,
|
||||
};
|
||||
|
||||
extern "C" JNIEXPORT void JNICALL Java_org_telegram_ui_Components_AnimatedFileDrawable_getVideoInfo(JNIEnv *env, jclass clazz, jint sdkVersion, jstring src, jintArray data) {
|
||||
extern "C" JNIEXPORT void JNICALL Java_org_telegram_ui_Components_AnimatedFileDrawable_getVideoInfo(JNIEnv *env, jclass clazz,jint sdkVersion, jstring src, jintArray data) {
|
||||
VideoInfo *info = new VideoInfo();
|
||||
|
||||
char const *srcString = env->GetStringUTFChars(src, 0);
|
||||
|
|
|
@ -1307,15 +1307,12 @@ void ConnectionsManager::processServerResponse(TLObject *message, int64_t messag
|
|||
}
|
||||
} else if (error->error_code == 403 && error->error_message.find(integrityCheckClassic) != std::string::npos) {
|
||||
discardResponse = true;
|
||||
std::string err = error->error_message;
|
||||
int index = err.find('_', integrityCheckClassic.size());
|
||||
std::string project = err.substr(integrityCheckClassic.size(), index - integrityCheckClassic.size());
|
||||
std::string nonce = err.substr(integrityCheckClassic.size() + project.size() + 1, err.size() - (integrityCheckClassic.size() + project.size() + 1));
|
||||
std::string nonce = error->error_message.substr(integrityCheckClassic.size(), error->error_message.size() - integrityCheckClassic.size());
|
||||
request->awaitingIntegrityCheck = true;
|
||||
request->startTime = 0;
|
||||
request->startTimeMillis = 0;
|
||||
if (delegate != nullptr) {
|
||||
delegate->onIntegrityCheckClassic(instanceNum, request->requestToken, project, nonce);
|
||||
delegate->onIntegrityCheckClassic(instanceNum, request->requestToken, nonce);
|
||||
}
|
||||
} else {
|
||||
bool failServerErrors = (request->requestFlags & RequestFlagFailOnServerErrors) == 0 || processEvenFailed;
|
||||
|
|
|
@ -154,7 +154,7 @@ typedef struct ConnectiosManagerDelegate {
|
|||
virtual void getHostByName(std::string domain, int32_t instanceNum, ConnectionSocket *socket) = 0;
|
||||
virtual int32_t getInitFlags(int32_t instanceNum) = 0;
|
||||
virtual void onPremiumFloodWait(int32_t instanceNum, int32_t requestToken, bool isUpload) = 0;
|
||||
virtual void onIntegrityCheckClassic(int32_t instanceNum, int32_t requestToken, std::string project, std::string nonce) = 0;
|
||||
virtual void onIntegrityCheckClassic(int32_t instanceNum, int32_t requestToken, std::string nonce) = 0;
|
||||
} ConnectiosManagerDelegate;
|
||||
|
||||
typedef struct HandshakeDelegate {
|
||||
|
|
|
@ -255,7 +255,10 @@
|
|||
<data android:host="t.me" android:scheme="http" />
|
||||
<data android:host="t.me" android:scheme="https" />
|
||||
</intent-filter>
|
||||
<intent-filter android:icon="@mipmap/ic_launcher" android:roundIcon="@mipmap/ic_launcher_round" android:priority="1">
|
||||
<intent-filter
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:roundIcon="@mipmap/ic_launcher_round"
|
||||
android:priority="1">
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
|
@ -301,7 +304,10 @@
|
|||
android:stateNotNeeded="true"
|
||||
android:theme="@style/Theme.TMessages.Transparent"
|
||||
android:exported="true">
|
||||
<intent-filter android:icon="@mipmap/ic_launcher" android:roundIcon="@mipmap/ic_launcher_round" android:priority="1">
|
||||
<intent-filter
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:roundIcon="@mipmap/ic_launcher_round"
|
||||
android:priority="1">
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
|
@ -314,7 +320,9 @@
|
|||
android:hardwareAccelerated="@bool/useHardwareAcceleration"
|
||||
android:windowSoftInputMode="adjustPan"
|
||||
android:exported="true">
|
||||
<intent-filter android:icon="@mipmap/ic_launcher" android:roundIcon="@mipmap/ic_launcher_round">
|
||||
<intent-filter
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:roundIcon="@mipmap/ic_launcher_round">
|
||||
<action android:name="org.telegram.passport.AUTHORIZE"/>
|
||||
<category android:name="android.intent.category.DEFAULT"/>
|
||||
</intent-filter>
|
||||
|
@ -325,7 +333,9 @@
|
|||
android:hardwareAccelerated="@bool/useHardwareAcceleration"
|
||||
android:windowSoftInputMode="adjustPan"
|
||||
android:exported="true">
|
||||
<intent-filter android:icon="@mipmap/ic_launcher" android:roundIcon="@mipmap/ic_launcher_round">
|
||||
<intent-filter
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:roundIcon="@mipmap/ic_launcher_round">
|
||||
<action android:name="android.appwidget.action.APPWIDGET_CONFIGURE"/>
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
@ -335,7 +345,9 @@
|
|||
android:hardwareAccelerated="@bool/useHardwareAcceleration"
|
||||
android:windowSoftInputMode="adjustPan"
|
||||
android:exported="true">
|
||||
<intent-filter android:icon="@mipmap/ic_launcher" android:roundIcon="@mipmap/ic_launcher_round">
|
||||
<intent-filter
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:roundIcon="@mipmap/ic_launcher_round">
|
||||
<action android:name="android.appwidget.action.APPWIDGET_CONFIGURE"/>
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
|
BIN
TMessagesProj/src/main/app_ic-playstore.png
Normal file
BIN
TMessagesProj/src/main/app_ic-playstore.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 96 KiB |
|
@ -27,6 +27,7 @@ import android.content.pm.PackageInfo;
|
|||
import android.content.pm.PackageManager;
|
||||
import android.content.pm.Signature;
|
||||
import android.content.res.AssetFileDescriptor;
|
||||
import android.content.res.AssetManager;
|
||||
import android.content.res.Configuration;
|
||||
import android.database.Cursor;
|
||||
import android.graphics.Bitmap;
|
||||
|
@ -35,6 +36,7 @@ import android.graphics.Canvas;
|
|||
import android.graphics.Color;
|
||||
import android.graphics.ColorMatrix;
|
||||
import android.graphics.Matrix;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.Point;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.RectF;
|
||||
|
@ -42,6 +44,9 @@ import android.graphics.Typeface;
|
|||
import android.graphics.drawable.BitmapDrawable;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.graphics.fonts.Font;
|
||||
import android.graphics.fonts.FontFamily;
|
||||
import android.graphics.fonts.SystemFonts;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
|
@ -73,6 +78,7 @@ import android.text.style.DynamicDrawableSpan;
|
|||
import android.text.style.URLSpan;
|
||||
import android.text.util.Linkify;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.util.Log;
|
||||
import android.util.Pair;
|
||||
import android.util.StateSet;
|
||||
import android.util.TypedValue;
|
||||
|
@ -95,7 +101,6 @@ import android.view.accessibility.AccessibilityEvent;
|
|||
import android.view.accessibility.AccessibilityManager;
|
||||
import android.view.animation.AccelerateInterpolator;
|
||||
import android.view.animation.DecelerateInterpolator;
|
||||
import android.view.animation.Interpolator;
|
||||
import android.view.animation.OvershootInterpolator;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.view.inputmethod.InputMethodSubtype;
|
||||
|
@ -114,7 +119,9 @@ import androidx.annotation.RequiresApi;
|
|||
import androidx.core.content.ContextCompat;
|
||||
import androidx.core.content.FileProvider;
|
||||
import androidx.core.graphics.ColorUtils;
|
||||
import androidx.core.graphics.TypefaceCompatUtil;
|
||||
import androidx.core.math.MathUtils;
|
||||
import androidx.core.provider.FontRequest;
|
||||
import androidx.core.widget.NestedScrollView;
|
||||
import androidx.dynamicanimation.animation.DynamicAnimation;
|
||||
import androidx.dynamicanimation.animation.SpringAnimation;
|
||||
|
@ -297,25 +304,15 @@ public class AndroidUtilities {
|
|||
public static Pattern LONG_BAD_CHARS_PATTERN = null;
|
||||
public static Pattern BAD_CHARS_MESSAGE_PATTERN = null;
|
||||
public static Pattern BAD_CHARS_MESSAGE_LONG_PATTERN = null;
|
||||
public static Pattern REMOVE_MULTIPLE_DIACRITICS = null;
|
||||
private static Pattern singleTagPatter = null;
|
||||
|
||||
public static String removeDiacritics(String str) {
|
||||
if (str == null) return null;
|
||||
if (REMOVE_MULTIPLE_DIACRITICS == null) return str;
|
||||
Matcher matcher = REMOVE_MULTIPLE_DIACRITICS.matcher(str);
|
||||
if (matcher == null) return str;
|
||||
return matcher.replaceAll("$1");
|
||||
}
|
||||
|
||||
static {
|
||||
try {
|
||||
final String GOOD_IRI_CHAR = "a-zA-Z0-9\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF";
|
||||
BAD_CHARS_PATTERN = Pattern.compile("[\u2500-\u25ff]");
|
||||
LONG_BAD_CHARS_PATTERN = Pattern.compile("[\u4e00-\u9fff]");
|
||||
BAD_CHARS_MESSAGE_LONG_PATTERN = Pattern.compile("[\u0300-\u036f\u2066-\u2067]");
|
||||
BAD_CHARS_MESSAGE_LONG_PATTERN = Pattern.compile("[\u0300-\u036f\u2066-\u2067]+");
|
||||
BAD_CHARS_MESSAGE_PATTERN = Pattern.compile("[\u2066-\u2067]+");
|
||||
REMOVE_MULTIPLE_DIACRITICS = Pattern.compile("([\\u0300-\\u036f]{1,2})[\\u0300-\\u036f]+");
|
||||
final Pattern IP_ADDRESS = Pattern.compile(
|
||||
"((25[0-5]|2[0-4][0-9]|[0-1][0-9]{2}|[1-9][0-9]|[1-9])\\.(25[0-5]|2[0-4]"
|
||||
+ "[0-9]|[0-1][0-9]{2}|[1-9][0-9]|[1-9]|0)\\.(25[0-5]|2[0-4][0-9]|[0-1]"
|
||||
|
@ -567,34 +564,6 @@ public class AndroidUtilities {
|
|||
return spannableStringBuilder;
|
||||
}
|
||||
|
||||
|
||||
public static SpannableStringBuilder replaceMultipleTags(String str, Runnable ...runnables) {
|
||||
SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder(str);
|
||||
for (int i = 0; i < runnables.length; ++i) {
|
||||
Runnable runnable = runnables[i];
|
||||
|
||||
int start = charSequenceIndexOf(spannableStringBuilder, "**");
|
||||
int end = charSequenceIndexOf(spannableStringBuilder, "**", start + 2);
|
||||
if (start < 0 || end < 0) break;
|
||||
|
||||
spannableStringBuilder.delete(start, start + 2);
|
||||
end = end - 2;
|
||||
spannableStringBuilder.delete(end, end + 2);
|
||||
spannableStringBuilder.setSpan(new ClickableSpan() {
|
||||
@Override
|
||||
public void updateDrawState(@NonNull TextPaint ds) {
|
||||
super.updateDrawState(ds);
|
||||
ds.setUnderlineText(false);
|
||||
}
|
||||
@Override
|
||||
public void onClick(@NonNull View widget) {
|
||||
if (runnable != null) runnable.run();
|
||||
}
|
||||
}, start, end, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
}
|
||||
return spannableStringBuilder;
|
||||
}
|
||||
|
||||
public static SpannableStringBuilder replaceSingleLink(String str, int color) {
|
||||
return replaceSingleLink(str, color, null);
|
||||
}
|
||||
|
@ -1833,7 +1802,7 @@ public class AndroidUtilities {
|
|||
calendar.set(Calendar.YEAR, Utilities.parseInt(date[0]));
|
||||
calendar.set(Calendar.MONTH, Utilities.parseInt(date[1]) - 1);
|
||||
calendar.set(Calendar.DAY_OF_MONTH, Utilities.parseInt(date[2]));
|
||||
return LocaleController.getInstance().getFormatterYearMax().format(calendar.getTime());
|
||||
return LocaleController.getInstance().formatterYearMax.format(calendar.getTime());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1871,17 +1840,13 @@ public class AndroidUtilities {
|
|||
}
|
||||
|
||||
public String getType() {
|
||||
if (type == 4) {
|
||||
return LocaleController.getString(R.string.ContactNote);
|
||||
} else if (type == 3) {
|
||||
return LocaleController.getString(R.string.ContactUrl);
|
||||
} else if (type == 5) {
|
||||
return LocaleController.getString(R.string.ContactBirthday);
|
||||
if (type == 5) {
|
||||
return LocaleController.getString("ContactBirthday", R.string.ContactBirthday);
|
||||
} else if (type == 6) {
|
||||
if ("ORG".equalsIgnoreCase(getRawType(true))) {
|
||||
return LocaleController.getString(R.string.ContactJob);
|
||||
return LocaleController.getString("ContactJob", R.string.ContactJob);
|
||||
} else {
|
||||
return LocaleController.getString(R.string.ContactJobTitle);
|
||||
return LocaleController.getString("ContactJobTitle", R.string.ContactJobTitle);
|
||||
}
|
||||
}
|
||||
int idx = fullData.indexOf(':');
|
||||
|
@ -3865,7 +3830,7 @@ public class AndroidUtilities {
|
|||
}
|
||||
}
|
||||
|
||||
public static boolean openForView(File f, String fileName, String mimeType, final Activity activity, Theme.ResourcesProvider resourcesProvider, boolean restrict) {
|
||||
public static boolean openForView(File f, String fileName, String mimeType, final Activity activity, Theme.ResourcesProvider resourcesProvider) {
|
||||
if (f != null && f.exists()) {
|
||||
String realMimeType = null;
|
||||
Intent intent = new Intent(Intent.ACTION_VIEW);
|
||||
|
@ -3874,10 +3839,6 @@ public class AndroidUtilities {
|
|||
int idx = fileName.lastIndexOf('.');
|
||||
if (idx != -1) {
|
||||
String ext = fileName.substring(idx + 1);
|
||||
int h = ext.toLowerCase().hashCode();
|
||||
if (restrict && (h == 0x17a1c || h == 0x3107ab || h == 0x19a1b || h == 0xe55 || h == 0x18417)) {
|
||||
return true;
|
||||
}
|
||||
realMimeType = myMime.getMimeTypeFromExtension(ext.toLowerCase());
|
||||
if (realMimeType == null) {
|
||||
realMimeType = mimeType;
|
||||
|
@ -3886,12 +3847,9 @@ public class AndroidUtilities {
|
|||
}
|
||||
}
|
||||
}
|
||||
if (realMimeType != null && realMimeType.equals("application/vnd.android.package-archive")) {
|
||||
if (restrict) return true;
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && !ApplicationLoader.applicationContext.getPackageManager().canRequestPackageInstalls()) {
|
||||
AlertsCreator.createApkRestrictedDialog(activity, resourcesProvider).show();
|
||||
return true;
|
||||
}
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && realMimeType != null && realMimeType.equals("application/vnd.android.package-archive") && !ApplicationLoader.applicationContext.getPackageManager().canRequestPackageInstalls()) {
|
||||
AlertsCreator.createApkRestrictedDialog(activity, resourcesProvider).show();
|
||||
return true;
|
||||
}
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||
intent.setDataAndType(FileProvider.getUriForFile(activity, ApplicationLoader.getApplicationId() + ".provider", f), realMimeType != null ? realMimeType : "text/plain");
|
||||
|
@ -3917,7 +3875,7 @@ public class AndroidUtilities {
|
|||
return false;
|
||||
}
|
||||
|
||||
public static boolean openForView(MessageObject message, Activity activity, Theme.ResourcesProvider resourcesProvider, boolean restrict) {
|
||||
public static boolean openForView(MessageObject message, Activity activity, Theme.ResourcesProvider resourcesProvider) {
|
||||
File f = null;
|
||||
if (message.messageOwner.attachPath != null && message.messageOwner.attachPath.length() != 0) {
|
||||
f = new File(message.messageOwner.attachPath);
|
||||
|
@ -3926,13 +3884,13 @@ public class AndroidUtilities {
|
|||
f = FileLoader.getInstance(message.currentAccount).getPathToMessage(message.messageOwner);
|
||||
}
|
||||
String mimeType = message.type == MessageObject.TYPE_FILE || message.type == MessageObject.TYPE_TEXT ? message.getMimeType() : null;
|
||||
return openForView(f, message.getFileName(), mimeType, activity, resourcesProvider, restrict);
|
||||
return openForView(f, message.getFileName(), mimeType, activity, resourcesProvider);
|
||||
}
|
||||
|
||||
public static boolean openForView(TLRPC.Document document, boolean forceCache, Activity activity) {
|
||||
String fileName = FileLoader.getAttachFileName(document);
|
||||
File f = FileLoader.getInstance(UserConfig.selectedAccount).getPathToAttach(document, true);
|
||||
return openForView(f, fileName, document.mime_type, activity, null, false);
|
||||
return openForView(f, fileName, document.mime_type, activity, null);
|
||||
}
|
||||
|
||||
public static SpannableStringBuilder formatSpannableSimple(CharSequence format, CharSequence... cs) {
|
||||
|
@ -4716,15 +4674,6 @@ public class AndroidUtilities {
|
|||
}
|
||||
}
|
||||
|
||||
public static void lerpCentered(RectF a, RectF b, float f, RectF to) {
|
||||
if (to == null) return;
|
||||
final float cx = lerp(a.centerX(), b.centerX(), f);
|
||||
final float cy = lerp(a.centerY(), b.centerY(), f);
|
||||
final float hw = lerp(a.width(), b.width(), Math.min(1, f)) / 2f;
|
||||
final float hh = lerp(a.height(), b.height(), Math.min(1, f)) / 2f;
|
||||
to.set(cx - hw, cy - hh, cx + hw, cy + hh);
|
||||
}
|
||||
|
||||
public static void lerp(int[] a, int[] b, float f, int[] to) {
|
||||
if (to == null) return;
|
||||
for (int i = 0; i < to.length; ++i) {
|
||||
|
@ -5891,95 +5840,4 @@ public class AndroidUtilities {
|
|||
} catch (Exception ignore) {}
|
||||
}
|
||||
|
||||
public static void applySpring(Animator anim, float stiffness, float damping) {
|
||||
applySpring(anim, stiffness, damping, 1);
|
||||
}
|
||||
|
||||
public static void applySpring(Animator anim, float stiffness, float damping, float mass) {
|
||||
final double delta = damping / (2.0 * Math.sqrt(stiffness * mass));
|
||||
final double undampedFrequency = Math.sqrt(stiffness / mass);
|
||||
final double omega_0 = Math.sqrt(stiffness / mass);
|
||||
final double zeta = damping / (2 * Math.sqrt(stiffness * mass));
|
||||
final double threshold = 0.0025;
|
||||
final double duration = Math.log(threshold) / (-zeta * omega_0);
|
||||
anim.setDuration((long) (duration * 1000L));
|
||||
anim.setInterpolator(new Interpolator() {
|
||||
@Override
|
||||
public float getInterpolation(float t) {
|
||||
if (delta < 1) {
|
||||
final double dampedFrequency = undampedFrequency * Math.sqrt(1 - delta * delta);
|
||||
return (float) (1 - Math.exp(-delta * undampedFrequency * t) *
|
||||
(Math.cos(dampedFrequency * t) + (delta * undampedFrequency / dampedFrequency) * Math.sin(dampedFrequency * t)));
|
||||
} else {
|
||||
final double a = -delta * undampedFrequency * t;
|
||||
return (float) (1 - (1 + a) * Math.exp(a));
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static boolean isWebAppLink(String url) {
|
||||
if (url == null) return false;
|
||||
try {
|
||||
Uri uri = Uri.parse(url);
|
||||
final String scheme = uri.getScheme();
|
||||
if (scheme == null) return false;
|
||||
final String path = uri.getPath();
|
||||
if (path == null) return false;
|
||||
switch (scheme) {
|
||||
case "http":
|
||||
case "https": {
|
||||
if (path.isEmpty()) return false;
|
||||
String host = uri.getHost().toLowerCase();
|
||||
Matcher prefixMatcher = LaunchActivity.PREFIX_T_ME_PATTERN.matcher(host);
|
||||
boolean isPrefix = prefixMatcher.find();
|
||||
if (host.equals("telegram.me") || host.equals("t.me") || host.equals("telegram.dog") || isPrefix) {
|
||||
ArrayList<String> segments = new ArrayList<>(uri.getPathSegments());
|
||||
if (segments.size() > 0 && segments.get(0).equals("s")) {
|
||||
segments.remove(0);
|
||||
}
|
||||
if (segments.size() > 0) {
|
||||
if (segments.size() >= 3 && "s".equals(segments.get(1))) {
|
||||
return false;
|
||||
} else if (segments.size() > 1) {
|
||||
final String segment = segments.get(1);
|
||||
if (TextUtils.isEmpty(segment)) return false;
|
||||
switch (segment) {
|
||||
case "joinchat":
|
||||
case "login":
|
||||
case "addstickers":
|
||||
case "addemoji":
|
||||
case "msg":
|
||||
case "share":
|
||||
case "confirmphone":
|
||||
case "setlanguage":
|
||||
case "addtheme":
|
||||
case "boost":
|
||||
case "c":
|
||||
case "contact":
|
||||
case "folder":
|
||||
case "addlist":
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
} else if (segments.size() == 1) {
|
||||
return !TextUtils.isEmpty(uri.getQueryParameter("startapp"));
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "tg": {
|
||||
if (url.startsWith("tg:resolve") || url.startsWith("tg://resolve")) {
|
||||
return !TextUtils.isEmpty(uri.getQueryParameter("appname"));
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
FileLog.e(e);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -30,7 +30,6 @@ import org.telegram.tgnet.ConnectionsManager;
|
|||
import org.telegram.tgnet.TLRPC;
|
||||
import org.telegram.ui.ActionBar.AlertDialog;
|
||||
import org.telegram.ui.PremiumPreviewFragment;
|
||||
import org.telegram.ui.Stars.StarsController;
|
||||
|
||||
import java.text.NumberFormat;
|
||||
import java.util.ArrayList;
|
||||
|
@ -274,137 +273,48 @@ public class BillingController implements PurchasesUpdatedListener, BillingClien
|
|||
}
|
||||
|
||||
if (!requestingTokens.contains(purchase.getPurchaseToken()) && purchase.getPurchaseState() == Purchase.PurchaseState.PURCHASED) {
|
||||
Pair<AccountInstance, TLRPC.InputStorePaymentPurpose> opayload = BillingUtilities.extractDeveloperPayload(purchase);
|
||||
if (opayload == null || opayload.first == null) {
|
||||
Pair<AccountInstance, TLRPC.InputStorePaymentPurpose> payload = BillingUtilities.extractDeveloperPayload(purchase);
|
||||
if (payload == null) {
|
||||
continue;
|
||||
}
|
||||
if (!purchase.isAcknowledged()) {
|
||||
requestingTokens.add(purchase.getPurchaseToken());
|
||||
|
||||
retrievePurpose(purchase, opayload, payload -> {
|
||||
TLRPC.TL_payments_assignPlayMarketTransaction req = new TLRPC.TL_payments_assignPlayMarketTransaction();
|
||||
req.receipt = new TLRPC.TL_dataJSON();
|
||||
req.receipt.data = purchase.getOriginalJson();
|
||||
req.purpose = payload.second;
|
||||
TLRPC.TL_payments_assignPlayMarketTransaction req = new TLRPC.TL_payments_assignPlayMarketTransaction();
|
||||
req.receipt = new TLRPC.TL_dataJSON();
|
||||
req.receipt.data = purchase.getOriginalJson();
|
||||
req.purpose = payload.second;
|
||||
|
||||
final AlertDialog progressDialog = new AlertDialog(ApplicationLoader.applicationContext, AlertDialog.ALERT_TYPE_SPINNER);
|
||||
AndroidUtilities.runOnUIThread(() -> progressDialog.showDelayed(500));
|
||||
final AlertDialog progressDialog = new AlertDialog(ApplicationLoader.applicationContext, AlertDialog.ALERT_TYPE_SPINNER);
|
||||
AndroidUtilities.runOnUIThread(() -> progressDialog.showDelayed(500));
|
||||
|
||||
AccountInstance acc = payload.first;
|
||||
acc.getConnectionsManager().sendRequest(req, (response, error) -> {
|
||||
AndroidUtilities.runOnUIThread(progressDialog::dismiss);
|
||||
AccountInstance acc = payload.first;
|
||||
acc.getConnectionsManager().sendRequest(req, (response, error) -> {
|
||||
AndroidUtilities.runOnUIThread(progressDialog::dismiss);
|
||||
|
||||
requestingTokens.remove(purchase.getPurchaseToken());
|
||||
requestingTokens.remove(purchase.getPurchaseToken());
|
||||
|
||||
if (response instanceof TLRPC.Updates) {
|
||||
acc.getMessagesController().processUpdates((TLRPC.Updates) response, false);
|
||||
if (response instanceof TLRPC.Updates) {
|
||||
acc.getMessagesController().processUpdates((TLRPC.Updates) response, false);
|
||||
|
||||
for (String productId : purchase.getProducts()) {
|
||||
Consumer<BillingResult> listener = resultListeners.remove(productId);
|
||||
if (listener != null) {
|
||||
listener.accept(billing);
|
||||
}
|
||||
for (String productId : purchase.getProducts()) {
|
||||
Consumer<BillingResult> listener = resultListeners.remove(productId);
|
||||
if (listener != null) {
|
||||
listener.accept(billing);
|
||||
}
|
||||
|
||||
consumeGiftPurchase(purchase, req.purpose);
|
||||
} else if (error != null) {
|
||||
if (onCanceled != null) {
|
||||
onCanceled.run();
|
||||
onCanceled = null;
|
||||
}
|
||||
NotificationCenter.getGlobalInstance().postNotificationNameOnUIThread(NotificationCenter.billingConfirmPurchaseError, req, error);
|
||||
}
|
||||
}, ConnectionsManager.RequestFlagFailOnServerErrors | ConnectionsManager.RequestFlagFailOnServerErrorsExceptFloodWait | ConnectionsManager.RequestFlagInvokeAfter);
|
||||
});
|
||||
} else {
|
||||
consumeGiftPurchase(purchase, opayload.second);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean retrievePurpose(Purchase purchase, Pair<AccountInstance, TLRPC.InputStorePaymentPurpose> payload, Utilities.Callback<Pair<AccountInstance, TLRPC.InputStorePaymentPurpose>> whenPayload) {
|
||||
if (payload == null || payload.first == null) {
|
||||
FileLog.d("retrievePurpose: payload or account is null");
|
||||
return false;
|
||||
}
|
||||
if (payload.second != null) {
|
||||
FileLog.d("retrievePurpose: already has purpose");
|
||||
whenPayload.run(payload);
|
||||
return true;
|
||||
}
|
||||
if (purchase == null || purchase.getProducts().isEmpty()) {
|
||||
FileLog.d("retrievePurpose: no products found for purpose!");
|
||||
whenPayload.run(payload);
|
||||
return false;
|
||||
} else {
|
||||
final int currentAccount = payload.first.getCurrentAccount();
|
||||
final String productId = purchase.getProducts().get(0);
|
||||
|
||||
if (productId == null) {
|
||||
FileLog.d("retrievePurpose: first product is null!");
|
||||
whenPayload.run(payload);
|
||||
return false;
|
||||
}
|
||||
|
||||
ArrayList<TLRPC.TL_starsTopupOption> options = StarsController.getInstance(currentAccount).getOptionsCached();
|
||||
if (options == null) {
|
||||
ConnectionsManager.getInstance(currentAccount).sendRequest(new TLRPC.TL_payments_getStarsTopupOptions(), (res, err) -> AndroidUtilities.runOnUIThread(() -> {
|
||||
ArrayList<TLRPC.TL_starsTopupOption> loadedOptions = new ArrayList<>();
|
||||
if (res instanceof TLRPC.Vector) {
|
||||
TLRPC.Vector vector = (TLRPC.Vector) res;
|
||||
for (Object object : vector.objects) {
|
||||
if (object instanceof TLRPC.TL_starsTopupOption) {
|
||||
TLRPC.TL_starsTopupOption option = (TLRPC.TL_starsTopupOption) object;
|
||||
loadedOptions.add(option);
|
||||
consumeGiftPurchase(purchase, req.purpose);
|
||||
} else if (error != null) {
|
||||
if (onCanceled != null) {
|
||||
onCanceled.run();
|
||||
onCanceled = null;
|
||||
}
|
||||
NotificationCenter.getGlobalInstance().postNotificationNameOnUIThread(NotificationCenter.billingConfirmPurchaseError, req, error);
|
||||
}
|
||||
} else if (err != null) {
|
||||
FileLog.d("retrievePopup: getStarsTopupOptions gives error! " + err.code + ": " + err.text);
|
||||
}
|
||||
|
||||
TLRPC.TL_starsTopupOption foundOption = null;
|
||||
for (int i = 0; i < loadedOptions.size(); ++i) {
|
||||
if (productId.equals(loadedOptions.get(i).store_product)) {
|
||||
foundOption = loadedOptions.get(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (foundOption != null) {
|
||||
TLRPC.TL_inputStorePaymentStars purpose = new TLRPC.TL_inputStorePaymentStars();
|
||||
purpose.amount = foundOption.amount;
|
||||
purpose.currency = foundOption.currency;
|
||||
purpose.stars = foundOption.stars;
|
||||
FileLog.d("retrievePurpose: found stars option of " + productId + " from stars loaded options!");
|
||||
whenPayload.run(new Pair<AccountInstance, TLRPC.InputStorePaymentPurpose>(payload.first, purpose));
|
||||
} else {
|
||||
FileLog.d("retrievePurpose: failed to find option of " + productId + " from stars loaded options");
|
||||
whenPayload.run(payload);
|
||||
}
|
||||
}));
|
||||
return true;
|
||||
} else {
|
||||
TLRPC.TL_starsTopupOption foundOption = null;
|
||||
for (int i = 0; i < options.size(); ++i) {
|
||||
if (productId.equals(options.get(i).store_product)) {
|
||||
foundOption = options.get(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (foundOption != null) {
|
||||
TLRPC.TL_inputStorePaymentStars purpose = new TLRPC.TL_inputStorePaymentStars();
|
||||
purpose.amount = foundOption.amount;
|
||||
purpose.currency = foundOption.currency;
|
||||
purpose.stars = foundOption.stars;
|
||||
FileLog.d("retrievePurpose: found stars option of " + productId + " from stars options!");
|
||||
whenPayload.run(new Pair<AccountInstance, TLRPC.InputStorePaymentPurpose>(payload.first, purpose));
|
||||
return true;
|
||||
}, ConnectionsManager.RequestFlagFailOnServerErrors | ConnectionsManager.RequestFlagFailOnServerErrorsExceptFloodWait | ConnectionsManager.RequestFlagInvokeAfter);
|
||||
} else {
|
||||
FileLog.d("retrievePurpose: failed to find option of " + productId + " from stars options");
|
||||
whenPayload.run(payload);
|
||||
return false;
|
||||
consumeGiftPurchase(purchase, payload.second);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,15 +18,18 @@ import java.util.Objects;
|
|||
|
||||
public class BuildVars {
|
||||
|
||||
public static boolean DEBUG_VERSION = BuildConfig.DEBUG_VERSION;
|
||||
public static boolean LOGS_ENABLED = BuildConfig.DEBUG_VERSION;
|
||||
public static boolean DEBUG_PRIVATE_VERSION = BuildConfig.DEBUG_PRIVATE_VERSION;
|
||||
// public static boolean DEBUG_VERSION = BuildConfig.DEBUG_VERSION;
|
||||
public static boolean DEBUG_VERSION = false;
|
||||
// public static boolean LOGS_ENABLED = BuildConfig.DEBUG_VERSION;
|
||||
public static boolean LOGS_ENABLED = false;
|
||||
// public static boolean DEBUG_PRIVATE_VERSION = BuildConfig.DEBUG_PRIVATE_VERSION;
|
||||
public static boolean DEBUG_PRIVATE_VERSION = false;
|
||||
public static boolean USE_CLOUD_STRINGS = true;
|
||||
public static boolean CHECK_UPDATES = true;
|
||||
public static boolean NO_SCOPED_STORAGE = Build.VERSION.SDK_INT <= 29;
|
||||
public static String BUILD_VERSION_STRING = BuildConfig.BUILD_VERSION_STRING;
|
||||
public static int APP_ID = 4;
|
||||
public static String APP_HASH = "014b35b6184100b085b0d0572f9b5103";
|
||||
public static int APP_ID = 21529892;
|
||||
public static String APP_HASH = "87764b05f5d207d44f4176313a2f4775";
|
||||
|
||||
// SafetyNet key for Google Identity SDK, set it to empty to disable
|
||||
public static String SAFETYNET_KEY = "AIzaSyDqt8P-7F7CPCseMkOiVRgb1LY8RN1bvH8";
|
||||
|
|
|
@ -42,7 +42,7 @@ public class ChatMessagesMetadataController {
|
|||
messageObject.reactionsLastCheckTime = currentTime;
|
||||
reactionsToCheck.add(messageObject);
|
||||
}
|
||||
if (chatActivity.getThreadMessage() != messageObject && messageObject.getId() > 0 && (messageObject.hasExtendedMediaPreview() || messageObject.hasPaidMediaPreview()) && (currentTime - messageObject.extendedMediaLastCheckTime) > 30000L) {
|
||||
if (chatActivity.getThreadMessage() != messageObject && messageObject.getId() > 0 && messageObject.hasExtendedMediaPreview() && (currentTime - messageObject.extendedMediaLastCheckTime) > 30000L) {
|
||||
messageObject.extendedMediaLastCheckTime = currentTime;
|
||||
extendedMediaToCheck.add(messageObject);
|
||||
}
|
||||
|
|
|
@ -379,50 +379,48 @@ public class ContactsController extends BaseController {
|
|||
}
|
||||
|
||||
public void checkAppAccount() {
|
||||
systemAccount = null;
|
||||
Utilities.globalQueue.postRunnable(() -> {
|
||||
AccountManager am = AccountManager.get(ApplicationLoader.applicationContext);
|
||||
try {
|
||||
Account[] accounts = am.getAccountsByType("org.telegram.messenger");
|
||||
for (int a = 0; a < accounts.length; a++) {
|
||||
Account acc = accounts[a];
|
||||
boolean found = false;
|
||||
for (int b = 0; b < UserConfig.MAX_ACCOUNT_COUNT; b++) {
|
||||
TLRPC.User user = UserConfig.getInstance(b).getCurrentUser();
|
||||
if (user != null) {
|
||||
if (acc.name.equals("" + user.id)) {
|
||||
if (b == currentAccount) {
|
||||
systemAccount = acc;
|
||||
}
|
||||
found = true;
|
||||
break;
|
||||
AccountManager am = AccountManager.get(ApplicationLoader.applicationContext);
|
||||
try {
|
||||
Account[] accounts = am.getAccountsByType("org.telegram.messenger");
|
||||
systemAccount = null;
|
||||
for (int a = 0; a < accounts.length; a++) {
|
||||
Account acc = accounts[a];
|
||||
boolean found = false;
|
||||
for (int b = 0; b < UserConfig.MAX_ACCOUNT_COUNT; b++) {
|
||||
TLRPC.User user = UserConfig.getInstance(b).getCurrentUser();
|
||||
if (user != null) {
|
||||
if (acc.name.equals("" + user.id)) {
|
||||
if (b == currentAccount) {
|
||||
systemAccount = acc;
|
||||
}
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
try {
|
||||
am.removeAccount(accounts[a], null, null);
|
||||
} catch (Exception ignore) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
} catch (Throwable ignore) {
|
||||
|
||||
}
|
||||
if (getUserConfig().isClientActivated()) {
|
||||
readContacts();
|
||||
if (systemAccount == null) {
|
||||
if (!found) {
|
||||
try {
|
||||
systemAccount = new Account("" + getUserConfig().getClientUserId(), "org.telegram.messenger");
|
||||
am.addAccountExplicitly(systemAccount, "", null);
|
||||
am.removeAccount(accounts[a], null, null);
|
||||
} catch (Exception ignore) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
} catch (Throwable ignore) {
|
||||
|
||||
}
|
||||
if (getUserConfig().isClientActivated()) {
|
||||
readContacts();
|
||||
if (systemAccount == null) {
|
||||
try {
|
||||
systemAccount = new Account("" + getUserConfig().getClientUserId(), "org.telegram.messenger");
|
||||
am.addAccountExplicitly(systemAccount, "", null);
|
||||
} catch (Exception ignore) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void deleteUnknownAppAccounts() {
|
||||
|
|
|
@ -23,7 +23,6 @@ import org.telegram.SQLite.SQLiteCursor;
|
|||
import org.telegram.SQLite.SQLitePreparedStatement;
|
||||
import org.telegram.tgnet.NativeByteBuffer;
|
||||
import org.telegram.tgnet.TLRPC;
|
||||
import org.telegram.tgnet.tl.TL_stories;
|
||||
import org.telegram.ui.Components.Bulletin;
|
||||
import org.telegram.ui.LaunchActivity;
|
||||
|
||||
|
@ -601,15 +600,6 @@ public class DownloadController extends BaseController implements NotificationCe
|
|||
}
|
||||
|
||||
public boolean canDownloadMedia(MessageObject messageObject) {
|
||||
if (messageObject.type == MessageObject.TYPE_STORY) {
|
||||
if (!SharedConfig.isAutoplayVideo()) return false;
|
||||
TLRPC.TL_messageMediaStory mediaStory = (TLRPC.TL_messageMediaStory) MessageObject.getMedia(messageObject);
|
||||
TL_stories.StoryItem storyItem = mediaStory.storyItem;
|
||||
if (storyItem == null || storyItem.media == null || storyItem.media.document == null || !storyItem.isPublic) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return canDownloadMedia(messageObject.messageOwner) == 1;
|
||||
}
|
||||
|
||||
|
@ -719,88 +709,6 @@ public class DownloadController extends BaseController implements NotificationCe
|
|||
}
|
||||
}
|
||||
|
||||
public int canDownloadMedia(TLRPC.Message message, TLRPC.MessageMedia media) {
|
||||
if (message == null || media instanceof TLRPC.TL_messageMediaStory) {
|
||||
return canPreloadStories() ? 2 : 0;
|
||||
}
|
||||
int type;
|
||||
boolean isVideo = false;
|
||||
if (MessageObject.isVideoDocument(media.document)) {
|
||||
isVideo = true;
|
||||
type = AUTODOWNLOAD_TYPE_VIDEO;
|
||||
} else if (MessageObject.isVoiceDocument(media.document)) {
|
||||
type = AUTODOWNLOAD_TYPE_AUDIO;
|
||||
} else if (media instanceof TLRPC.TL_messageMediaPhoto) {
|
||||
type = AUTODOWNLOAD_TYPE_PHOTO;
|
||||
} else if (media.document != null) {
|
||||
type = AUTODOWNLOAD_TYPE_DOCUMENT;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
int index;
|
||||
TLRPC.Peer peer = message.peer_id;
|
||||
if (peer != null) {
|
||||
if (peer.user_id != 0) {
|
||||
if (getContactsController().contactsDict.containsKey(peer.user_id)) {
|
||||
index = 0;
|
||||
} else {
|
||||
index = 1;
|
||||
}
|
||||
} else if (peer.chat_id != 0) {
|
||||
if (message.from_id instanceof TLRPC.TL_peerUser && getContactsController().contactsDict.containsKey(message.from_id.user_id)) {
|
||||
index = 0;
|
||||
} else {
|
||||
index = 2;
|
||||
}
|
||||
} else {
|
||||
TLRPC.Chat chat = message.peer_id.channel_id != 0 ? getMessagesController().getChat(message.peer_id.channel_id) : null;
|
||||
if (ChatObject.isChannel(chat) && chat.megagroup) {
|
||||
if (message.from_id instanceof TLRPC.TL_peerUser && getContactsController().contactsDict.containsKey(message.from_id.user_id)) {
|
||||
index = 0;
|
||||
} else {
|
||||
index = 2;
|
||||
}
|
||||
} else {
|
||||
index = 3;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
index = 1;
|
||||
}
|
||||
Preset preset;
|
||||
int networkType = ApplicationLoader.getAutodownloadNetworkType();
|
||||
if (networkType == StatsController.TYPE_WIFI) {
|
||||
if (!wifiPreset.enabled) {
|
||||
return 0;
|
||||
}
|
||||
preset = getCurrentWiFiPreset();
|
||||
|
||||
} else if (networkType == StatsController.TYPE_ROAMING) {
|
||||
if (!roamingPreset.enabled) {
|
||||
return 0;
|
||||
}
|
||||
preset = getCurrentRoamingPreset();
|
||||
} else {
|
||||
if (!mobilePreset.enabled) {
|
||||
return 0;
|
||||
}
|
||||
preset = getCurrentMobilePreset();
|
||||
}
|
||||
int mask = preset.mask[index];
|
||||
long maxSize;
|
||||
if (type == AUTODOWNLOAD_TYPE_AUDIO) {
|
||||
maxSize = Math.max(512 * 1024, preset.sizes[typeToIndex(type)]);
|
||||
} else {
|
||||
maxSize = preset.sizes[typeToIndex(type)];
|
||||
}
|
||||
long size = MessageObject.getMessageSize(message);
|
||||
if (isVideo && preset.preloadVideo && size > maxSize && maxSize > 2 * 1024 * 1024) {
|
||||
return (mask & type) != 0 ? 2 : 0;
|
||||
} else {
|
||||
return (type == AUTODOWNLOAD_TYPE_PHOTO || size != 0 && size <= maxSize) && (type == AUTODOWNLOAD_TYPE_AUDIO || (mask & type) != 0) ? 1 : 0;
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean canDownloadNextTrack() {
|
||||
int networkType = ApplicationLoader.getAutodownloadNetworkType();
|
||||
if (networkType == StatsController.TYPE_WIFI) {
|
||||
|
|
|
@ -41,7 +41,7 @@ public class FileRefController extends BaseController {
|
|||
private HashMap<String, ArrayList<Requester>> locationRequester = new HashMap<>();
|
||||
private HashMap<String, ArrayList<Requester>> parentRequester = new HashMap<>();
|
||||
private HashMap<String, CachedResult> responseCache = new HashMap<>();
|
||||
private HashMap<TLObject, Object[]> multiMediaCache = new HashMap<>();
|
||||
private HashMap<TLRPC.TL_messages_sendMultiMedia, Object[]> multiMediaCache = new HashMap<>();
|
||||
|
||||
private long lastCleanupTime = SystemClock.elapsedRealtime();
|
||||
|
||||
|
@ -91,9 +91,6 @@ public class FileRefController extends BaseController {
|
|||
} else if (parentObject instanceof MessageObject) {
|
||||
MessageObject messageObject = (MessageObject) parentObject;
|
||||
long channelId = messageObject.getChannelId();
|
||||
if (messageObject.type == MessageObject.TYPE_PAID_MEDIA && messageObject.messageOwner != null && messageObject.messageOwner.fwd_from != null && messageObject.messageOwner.fwd_from.from_id != null) {
|
||||
channelId = DialogObject.getPeerDialogId(messageObject.messageOwner.fwd_from.from_id);
|
||||
}
|
||||
return "message" + messageObject.getRealId() + "_" + channelId + "_" + messageObject.scheduled + "_" + messageObject.getQuickReplyId();
|
||||
} else if (parentObject instanceof TLRPC.Message) {
|
||||
TLRPC.Message message = (TLRPC.Message) parentObject;
|
||||
|
@ -158,16 +155,6 @@ public class FileRefController extends BaseController {
|
|||
sendErrorToObject(args, 0);
|
||||
return;
|
||||
}
|
||||
} else if (args[0] instanceof TLRPC.TL_inputMediaDocument) {
|
||||
TLRPC.TL_inputMediaDocument mediaDocument = (TLRPC.TL_inputMediaDocument) args[0];
|
||||
locationKey = "file_" + mediaDocument.id.id;
|
||||
location = new TLRPC.TL_inputDocumentFileLocation();
|
||||
location.id = mediaDocument.id.id;
|
||||
} else if (args[0] instanceof TLRPC.TL_inputMediaPhoto) {
|
||||
TLRPC.TL_inputMediaPhoto mediaPhoto = (TLRPC.TL_inputMediaPhoto) args[0];
|
||||
locationKey = "photo_" + mediaPhoto.id.id;
|
||||
location = new TLRPC.TL_inputPhotoFileLocation();
|
||||
location.id = mediaPhoto.id.id;
|
||||
} else if (args[0] instanceof TLRPC.TL_messages_sendMultiMedia) {
|
||||
TLRPC.TL_messages_sendMultiMedia req = (TLRPC.TL_messages_sendMultiMedia) args[0];
|
||||
ArrayList<Object> parentObjects = (ArrayList<Object>) parentObject;
|
||||
|
@ -193,40 +180,6 @@ public class FileRefController extends BaseController {
|
|||
locationKey = "photo_" + mediaPhoto.id.id;
|
||||
location = new TLRPC.TL_inputPhotoFileLocation();
|
||||
location.id = mediaPhoto.id.id;
|
||||
} else if (req.media instanceof TLRPC.TL_inputMediaPaidMedia) {
|
||||
TLRPC.TL_inputMediaPaidMedia paidMedia = (TLRPC.TL_inputMediaPaidMedia) req.media;
|
||||
if (parentObject instanceof ArrayList) {
|
||||
ArrayList<Object> parentObjects = (ArrayList<Object>) parentObject;
|
||||
multiMediaCache.put(req, args);
|
||||
for (int a = 0, size = paidMedia.extended_media.size(); a < size; a++) {
|
||||
TLRPC.InputMedia media = paidMedia.extended_media.get(a);
|
||||
parentObject = parentObjects.get(a);
|
||||
if (parentObject == null) {
|
||||
continue;
|
||||
}
|
||||
requestReference(parentObject, media, req);
|
||||
}
|
||||
return;
|
||||
} else if (paidMedia.extended_media.size() == 1) {
|
||||
TLRPC.InputMedia inputMedia = paidMedia.extended_media.get(0);
|
||||
if (inputMedia instanceof TLRPC.TL_inputMediaDocument) {
|
||||
TLRPC.TL_inputMediaDocument mediaDocument = (TLRPC.TL_inputMediaDocument) inputMedia;
|
||||
locationKey = "file_" + mediaDocument.id.id;
|
||||
location = new TLRPC.TL_inputDocumentFileLocation();
|
||||
location.id = mediaDocument.id.id;
|
||||
} else if (inputMedia instanceof TLRPC.TL_inputMediaPhoto) {
|
||||
TLRPC.TL_inputMediaPhoto mediaPhoto = (TLRPC.TL_inputMediaPhoto) inputMedia;
|
||||
locationKey = "photo_" + mediaPhoto.id.id;
|
||||
location = new TLRPC.TL_inputPhotoFileLocation();
|
||||
location.id = mediaPhoto.id.id;
|
||||
} else {
|
||||
sendErrorToObject(args, 0);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
sendErrorToObject(args, 0);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
sendErrorToObject(args, 0);
|
||||
return;
|
||||
|
@ -647,49 +600,6 @@ public class FileRefController extends BaseController {
|
|||
multiMediaCache.remove(multiMedia);
|
||||
AndroidUtilities.runOnUIThread(() -> getSendMessagesHelper().performSendMessageRequestMulti(multiMedia, (ArrayList<MessageObject>) objects[1], (ArrayList<String>) objects[2], null, (SendMessagesHelper.DelayedMessage) objects[4], (Boolean) objects[5]));
|
||||
}
|
||||
} else if (requester.args.length >= 2 && requester.args[1] instanceof TLRPC.TL_messages_sendMedia && ((TLRPC.TL_messages_sendMedia) requester.args[1]).media instanceof TLRPC.TL_inputMediaPaidMedia && (requester.args[0] instanceof TLRPC.TL_inputMediaPhoto || requester.args[0] instanceof TLRPC.TL_inputMediaDocument)) {
|
||||
TLRPC.TL_messages_sendMedia sendMedia = (TLRPC.TL_messages_sendMedia) requester.args[1];
|
||||
Object[] objects = multiMediaCache.get(sendMedia);
|
||||
if (objects == null) {
|
||||
return true;
|
||||
}
|
||||
|
||||
TLRPC.InputMedia inputMedia = null;
|
||||
if (requester.args[0] instanceof TLRPC.TL_inputMediaDocument) {
|
||||
TLRPC.TL_inputMediaDocument mediaDocument = (TLRPC.TL_inputMediaDocument) requester.args[0];
|
||||
inputMedia = mediaDocument;
|
||||
if (fromCache && isSameReference(mediaDocument.id.file_reference, file_reference)) {
|
||||
return false;
|
||||
}
|
||||
mediaDocument.id.file_reference = file_reference;
|
||||
} else if (requester.args[0] instanceof TLRPC.TL_inputMediaPhoto) {
|
||||
TLRPC.TL_inputMediaPhoto mediaPhoto = (TLRPC.TL_inputMediaPhoto) requester.args[0];
|
||||
inputMedia = mediaPhoto;
|
||||
if (fromCache && isSameReference(mediaPhoto.id.file_reference, file_reference)) {
|
||||
return false;
|
||||
}
|
||||
mediaPhoto.id.file_reference = file_reference;
|
||||
}
|
||||
|
||||
TLRPC.TL_inputMediaPaidMedia paidMedia = (TLRPC.TL_inputMediaPaidMedia) sendMedia.media;
|
||||
|
||||
int index = paidMedia.extended_media.indexOf(inputMedia);
|
||||
if (index < 0) {
|
||||
return true;
|
||||
}
|
||||
ArrayList<Object> parentObjects = (ArrayList<Object>) objects[3];
|
||||
parentObjects.set(index, null);
|
||||
|
||||
boolean done = true;
|
||||
for (int a = 0, size; a < parentObjects.size(); a++) {
|
||||
if (parentObjects.get(a) != null) {
|
||||
done = false;
|
||||
}
|
||||
}
|
||||
if (done) {
|
||||
multiMediaCache.remove(sendMedia);
|
||||
AndroidUtilities.runOnUIThread(() -> getSendMessagesHelper().performSendMessageRequestMulti(sendMedia, (ArrayList<MessageObject>) objects[1], (ArrayList<String>) objects[2], null, (SendMessagesHelper.DelayedMessage) objects[4], (Boolean) objects[5]));
|
||||
}
|
||||
} else if (requester.args[0] instanceof TLRPC.TL_messages_sendMedia) {
|
||||
TLRPC.TL_messages_sendMedia req = (TLRPC.TL_messages_sendMedia) requester.args[0];
|
||||
if (req.media instanceof TLRPC.TL_inputMediaDocument) {
|
||||
|
@ -819,14 +729,7 @@ public class FileRefController extends BaseController {
|
|||
multiMediaCache.remove(req);
|
||||
AndroidUtilities.runOnUIThread(() -> getSendMessagesHelper().performSendMessageRequestMulti(req, (ArrayList<MessageObject>) objects[1], (ArrayList<String>) objects[2], null, (SendMessagesHelper.DelayedMessage) objects[4], (Boolean) objects[5]));
|
||||
}
|
||||
} else if ((args[0] instanceof TLRPC.TL_inputMediaDocument || args[0] instanceof TLRPC.TL_inputMediaPhoto) && args[1] instanceof TLRPC.TL_messages_sendMedia) {
|
||||
TLRPC.TL_messages_sendMedia req = (TLRPC.TL_messages_sendMedia) args[1];
|
||||
Object[] objects = multiMediaCache.get(req);
|
||||
if (objects != null) {
|
||||
multiMediaCache.remove(req);
|
||||
AndroidUtilities.runOnUIThread(() -> getSendMessagesHelper().performSendMessageRequestMulti(req, (ArrayList<MessageObject>) objects[1], (ArrayList<String>) objects[2], null, (SendMessagesHelper.DelayedMessage) objects[4], (Boolean) objects[5]));
|
||||
}
|
||||
} else if (args[0] instanceof TLRPC.TL_messages_sendMedia && !(((TLRPC.TL_messages_sendMedia) args[0]).media instanceof TLRPC.TL_inputMediaPaidMedia) || args[0] instanceof TLRPC.TL_messages_editMessage) {
|
||||
} else if (args[0] instanceof TLRPC.TL_messages_sendMedia || args[0] instanceof TLRPC.TL_messages_editMessage) {
|
||||
AndroidUtilities.runOnUIThread(() -> getSendMessagesHelper().performSendMessageRequest((TLObject) args[0], (MessageObject) args[1], (String) args[2], (SendMessagesHelper.DelayedMessage) args[3], (Boolean) args[4], (SendMessagesHelper.DelayedMessage) args[5], null, null, (Boolean) args[6]));
|
||||
} else if (args[0] instanceof TLRPC.TL_messages_saveGif) {
|
||||
TLRPC.TL_messages_saveGif req = (TLRPC.TL_messages_saveGif) args[0];
|
||||
|
@ -914,32 +817,7 @@ public class FileRefController extends BaseController {
|
|||
if (!res.messages.isEmpty()) {
|
||||
for (int i = 0, size3 = res.messages.size(); i < size3; i++) {
|
||||
TLRPC.Message message = res.messages.get(i);
|
||||
if (message.media instanceof TLRPC.TL_messageMediaPaidMedia) {
|
||||
TLRPC.TL_messageMediaPaidMedia paidMedia = (TLRPC.TL_messageMediaPaidMedia) message.media;
|
||||
for (int j = 0; j < paidMedia.extended_media.size(); ++j) {
|
||||
TLRPC.MessageExtendedMedia extendedMedia = paidMedia.extended_media.get(j);
|
||||
if (extendedMedia instanceof TLRPC.TL_messageExtendedMedia) {
|
||||
TLRPC.MessageMedia media = ((TLRPC.TL_messageExtendedMedia) extendedMedia).media;
|
||||
if (media != null) {
|
||||
if (media.document != null) {
|
||||
result = getFileReference(media.document, requester.location, needReplacement, locationReplacement);
|
||||
} else if (media.game != null) {
|
||||
result = getFileReference(media.game.document, requester.location, needReplacement, locationReplacement);
|
||||
if (result == null) {
|
||||
result = getFileReference(media.game.photo, requester.location, needReplacement, locationReplacement);
|
||||
}
|
||||
} else if (media.photo != null) {
|
||||
result = getFileReference(media.photo, requester.location, needReplacement, locationReplacement);
|
||||
} else if (media.webpage != null) {
|
||||
result = getFileReference(media.webpage, requester.location, needReplacement, locationReplacement);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (result != null) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else if (message.media != null) {
|
||||
if (message.media != null) {
|
||||
if (message.media.document != null) {
|
||||
result = getFileReference(message.media.document, requester.location, needReplacement, locationReplacement);
|
||||
} else if (message.media.game != null) {
|
||||
|
@ -1520,21 +1398,6 @@ public class FileRefController extends BaseController {
|
|||
}
|
||||
|
||||
public static boolean isFileRefError(String error) {
|
||||
return (
|
||||
"FILEREF_EXPIRED".equals(error) ||
|
||||
"FILE_REFERENCE_EXPIRED".equals(error) ||
|
||||
"FILE_REFERENCE_EMPTY".equals(error) ||
|
||||
error != null && error.startsWith("FILE_REFERENCE_")
|
||||
);
|
||||
}
|
||||
|
||||
public static int getFileRefErrorIndex(String error) {
|
||||
if (error == null) return -1;
|
||||
if (!error.startsWith("FILE_REFERENCE_") || !error.endsWith("_EXPIRED")) return -1;
|
||||
try {
|
||||
return Integer.parseInt(error.substring("FILE_REFERENCE_".length(), error.length() - "_EXPIRED".length()));
|
||||
} catch (Exception e) {
|
||||
return -1;
|
||||
}
|
||||
return "FILEREF_EXPIRED".equals(error) || "FILE_REFERENCE_EXPIRED".equals(error) || "FILE_REFERENCE_EMPTY".equals(error) || error != null && error.startsWith("FILE_REFERENCE_");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1103,11 +1103,7 @@ public class ImageLoader {
|
|||
if ((isAnimatedAvatar(cacheImage.filter) || AUTOPLAY_FILTER.equals(cacheImage.filter)) && !(cacheImage.imageLocation.document instanceof TLRPC.TL_documentEncrypted) && !precache) {
|
||||
TLRPC.Document document = cacheImage.imageLocation.document instanceof TLRPC.Document ? cacheImage.imageLocation.document : null;
|
||||
long size = document != null ? cacheImage.size : cacheImage.imageLocation.currentSize;
|
||||
int cacheType = document != null ? 1 : 0;
|
||||
if (cacheImage.cacheType > 1) {
|
||||
cacheType = cacheImage.cacheType;
|
||||
}
|
||||
fileDrawable = new AnimatedFileDrawable(cacheImage.finalFilePath, fistFrame, notCreateStream ? 0 : size, cacheImage.priority, notCreateStream ? null : document, document == null && !notCreateStream ? cacheImage.imageLocation : null, cacheImage.parentObject, seekTo, cacheImage.currentAccount, false, 0, 0, cacheOptions, cacheType);
|
||||
fileDrawable = new AnimatedFileDrawable(cacheImage.finalFilePath, fistFrame, notCreateStream ? 0 : size, cacheImage.priority, notCreateStream ? null : document, document == null && !notCreateStream ? cacheImage.imageLocation : null, cacheImage.parentObject, seekTo, cacheImage.currentAccount, false, cacheOptions);
|
||||
fileDrawable.setIsWebmSticker(MessageObject.isWebM(document) || MessageObject.isVideoSticker(document) || isAnimatedAvatar(cacheImage.filter));
|
||||
} else {
|
||||
|
||||
|
@ -4285,17 +4281,6 @@ public class ImageLoader {
|
|||
if (message.media == null) {
|
||||
return;
|
||||
}
|
||||
if (message.media instanceof TLRPC.TL_messageMediaPaidMedia) {
|
||||
TLRPC.TL_messageMediaPaidMedia paidMedia = (TLRPC.TL_messageMediaPaidMedia) message.media;
|
||||
for (int i = 0; i < paidMedia.extended_media.size(); ++i) {
|
||||
TLRPC.MessageExtendedMedia emedia = paidMedia.extended_media.get(i);
|
||||
if (emedia instanceof TLRPC.TL_messageExtendedMedia) {
|
||||
saveMessageThumbs(message, ((TLRPC.TL_messageExtendedMedia) emedia).media);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
TLRPC.PhotoSize photoSize = findPhotoCachedSize(message);
|
||||
|
||||
if (photoSize != null && photoSize.bytes != null && photoSize.bytes.length != 0) {
|
||||
|
@ -4382,97 +4367,6 @@ public class ImageLoader {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
public static void saveMessageThumbs(TLRPC.Message message, TLRPC.MessageMedia media) {
|
||||
if (message == null || media == null) {
|
||||
return;
|
||||
}
|
||||
TLRPC.PhotoSize photoSize = findPhotoCachedSize(media);
|
||||
|
||||
if (photoSize != null && photoSize.bytes != null && photoSize.bytes.length != 0) {
|
||||
TLRPC.PhotoSize newPhotoSize;
|
||||
if (photoSize.location == null || photoSize.location instanceof TLRPC.TL_fileLocationUnavailable) {
|
||||
photoSize.location = new TLRPC.TL_fileLocationToBeDeprecated();
|
||||
photoSize.location.volume_id = Integer.MIN_VALUE;
|
||||
photoSize.location.local_id = SharedConfig.getLastLocalId();
|
||||
}
|
||||
if (photoSize.h <= 50 && photoSize.w <= 50) {
|
||||
newPhotoSize = new TLRPC.TL_photoStrippedSize();
|
||||
newPhotoSize.location = photoSize.location;
|
||||
newPhotoSize.bytes = photoSize.bytes;
|
||||
newPhotoSize.h = photoSize.h;
|
||||
newPhotoSize.w = photoSize.w;
|
||||
} else {
|
||||
File file = FileLoader.getInstance(UserConfig.selectedAccount).getPathToAttach(photoSize, true);
|
||||
boolean isEncrypted = false;
|
||||
if (MessageObject.shouldEncryptPhotoOrVideo(UserConfig.selectedAccount, message)) {
|
||||
file = new File(file.getAbsolutePath() + ".enc");
|
||||
isEncrypted = true;
|
||||
}
|
||||
if (!file.exists()) {
|
||||
try {
|
||||
if (isEncrypted) {
|
||||
File keyPath = new File(FileLoader.getInternalCacheDir(), file.getName() + ".key");
|
||||
RandomAccessFile keyFile = new RandomAccessFile(keyPath, "rws");
|
||||
long len = keyFile.length();
|
||||
byte[] encryptKey = new byte[32];
|
||||
byte[] encryptIv = new byte[16];
|
||||
if (len > 0 && len % 48 == 0) {
|
||||
keyFile.read(encryptKey, 0, 32);
|
||||
keyFile.read(encryptIv, 0, 16);
|
||||
} else {
|
||||
Utilities.random.nextBytes(encryptKey);
|
||||
Utilities.random.nextBytes(encryptIv);
|
||||
keyFile.write(encryptKey);
|
||||
keyFile.write(encryptIv);
|
||||
}
|
||||
keyFile.close();
|
||||
Utilities.aesCtrDecryptionByteArray(photoSize.bytes, encryptKey, encryptIv, 0, photoSize.bytes.length, 0);
|
||||
}
|
||||
RandomAccessFile writeFile = new RandomAccessFile(file, "rws");
|
||||
writeFile.write(photoSize.bytes);
|
||||
writeFile.close();
|
||||
} catch (Exception e) {
|
||||
FileLog.e(e);
|
||||
}
|
||||
}
|
||||
|
||||
newPhotoSize = new TLRPC.TL_photoSize_layer127();
|
||||
newPhotoSize.w = photoSize.w;
|
||||
newPhotoSize.h = photoSize.h;
|
||||
newPhotoSize.location = photoSize.location;
|
||||
newPhotoSize.size = photoSize.size;
|
||||
newPhotoSize.type = photoSize.type;
|
||||
}
|
||||
|
||||
if (media instanceof TLRPC.TL_messageMediaPhoto) {
|
||||
for (int a = 0, count = media.photo.sizes.size(); a < count; a++) {
|
||||
TLRPC.PhotoSize size = media.photo.sizes.get(a);
|
||||
if (size instanceof TLRPC.TL_photoCachedSize) {
|
||||
media.photo.sizes.set(a, newPhotoSize);
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else if (media instanceof TLRPC.TL_messageMediaDocument) {
|
||||
for (int a = 0, count = media.document.thumbs.size(); a < count; a++) {
|
||||
TLRPC.PhotoSize size = media.document.thumbs.get(a);
|
||||
if (size instanceof TLRPC.TL_photoCachedSize) {
|
||||
media.document.thumbs.set(a, newPhotoSize);
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else if (media instanceof TLRPC.TL_messageMediaWebPage) {
|
||||
for (int a = 0, count = media.webpage.photo.sizes.size(); a < count; a++) {
|
||||
TLRPC.PhotoSize size = media.webpage.photo.sizes.get(a);
|
||||
if (size instanceof TLRPC.TL_photoCachedSize) {
|
||||
media.webpage.photo.sizes.set(a, newPhotoSize);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static TLRPC.PhotoSize findPhotoCachedSize(TLRPC.Message message) {
|
||||
TLRPC.PhotoSize photoSize = null;
|
||||
if (message.media instanceof TLRPC.TL_messageMediaPhoto) {
|
||||
|
@ -4503,44 +4397,8 @@ public class ImageLoader {
|
|||
}
|
||||
}
|
||||
}
|
||||
} else if (message.media instanceof TLRPC.TL_messageMediaInvoice && !message.media.extended_media.isEmpty() && message.media.extended_media.get(0) instanceof TLRPC.TL_messageExtendedMediaPreview) {
|
||||
photoSize = ((TLRPC.TL_messageExtendedMediaPreview) message.media.extended_media.get(0)).thumb;
|
||||
}
|
||||
return photoSize;
|
||||
}
|
||||
|
||||
private static TLRPC.PhotoSize findPhotoCachedSize(TLRPC.MessageMedia media) {
|
||||
TLRPC.PhotoSize photoSize = null;
|
||||
if (media instanceof TLRPC.TL_messageMediaPhoto) {
|
||||
for (int a = 0, count = media.photo.sizes.size(); a < count; a++) {
|
||||
TLRPC.PhotoSize size = media.photo.sizes.get(a);
|
||||
if (size instanceof TLRPC.TL_photoCachedSize) {
|
||||
photoSize = size;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else if (media instanceof TLRPC.TL_messageMediaDocument) {
|
||||
if (media.document != null) {
|
||||
for (int a = 0, count = media.document.thumbs.size(); a < count; a++) {
|
||||
TLRPC.PhotoSize size = media.document.thumbs.get(a);
|
||||
if (size instanceof TLRPC.TL_photoCachedSize) {
|
||||
photoSize = size;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (media instanceof TLRPC.TL_messageMediaWebPage) {
|
||||
if (media.webpage.photo != null) {
|
||||
for (int a = 0, count = media.webpage.photo.sizes.size(); a < count; a++) {
|
||||
TLRPC.PhotoSize size = media.webpage.photo.sizes.get(a);
|
||||
if (size instanceof TLRPC.TL_photoCachedSize) {
|
||||
photoSize = size;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (media instanceof TLRPC.TL_messageMediaInvoice && !media.extended_media.isEmpty() && media.extended_media.get(0) instanceof TLRPC.TL_messageExtendedMediaPreview) {
|
||||
photoSize = ((TLRPC.TL_messageExtendedMediaPreview) media.extended_media.get(0)).thumb;
|
||||
} else if (message.media instanceof TLRPC.TL_messageMediaInvoice && message.media.extended_media instanceof TLRPC.TL_messageExtendedMediaPreview) {
|
||||
photoSize = ((TLRPC.TL_messageExtendedMediaPreview) message.media.extended_media).thumb;
|
||||
}
|
||||
return photoSize;
|
||||
}
|
||||
|
|
|
@ -352,7 +352,7 @@ public class ImageLocation {
|
|||
}
|
||||
|
||||
public static String getStrippedKey(Object parentObject, Object fullObject, Object strippedObject) {
|
||||
if (parentObject instanceof TLRPC.WebPage || parentObject instanceof MessageObject && ((MessageObject) parentObject).type == MessageObject.TYPE_PAID_MEDIA) {
|
||||
if (parentObject instanceof TLRPC.WebPage) {
|
||||
if (fullObject instanceof ImageLocation) {
|
||||
ImageLocation imageLocation = (ImageLocation) fullObject;
|
||||
if (imageLocation.document != null) {
|
||||
|
@ -391,7 +391,7 @@ public class ImageLocation {
|
|||
return secureDocument.secureFile.dc_id + "_" + secureDocument.secureFile.id;
|
||||
} else if (photoSize instanceof TLRPC.TL_photoStrippedSize || photoSize instanceof TLRPC.TL_photoPathSize) {
|
||||
if (photoSize.bytes.length > 0) {
|
||||
return getStrippedKey(parentObject, fullObject == null ? this : fullObject, photoSize);
|
||||
return getStrippedKey(parentObject, fullObject, photoSize);
|
||||
}
|
||||
} else if (location != null) {
|
||||
return location.volume_id + "_" + location.local_id;
|
||||
|
|
|
@ -18,26 +18,28 @@ import android.content.res.Configuration;
|
|||
import android.telephony.TelephonyManager;
|
||||
import android.text.TextUtils;
|
||||
import android.text.format.DateFormat;
|
||||
import android.util.Log;
|
||||
import android.util.Xml;
|
||||
|
||||
import androidx.annotation.StringRes;
|
||||
|
||||
import org.telegram.messenger.time.FastDateFormat;
|
||||
import org.telegram.ui.Stars.StarsController;
|
||||
import org.telegram.ui.Stars.StarsIntroActivity;
|
||||
import org.telegram.tgnet.ConnectionsManager;
|
||||
import org.telegram.tgnet.TLObject;
|
||||
import org.telegram.tgnet.TLRPC;
|
||||
import org.telegram.ui.RestrictedLanguagesSelectActivity;
|
||||
import org.xatirchi.utils.LanguageCode;
|
||||
import org.xmlpull.v1.XmlPullParser;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileReader;
|
||||
import java.io.FileWriter;
|
||||
import java.text.NumberFormat;
|
||||
import java.time.Instant;
|
||||
import java.time.ZoneId;
|
||||
import java.time.format.TextStyle;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Collection;
|
||||
|
@ -60,291 +62,26 @@ public class LocaleController {
|
|||
public static boolean isRTL = false;
|
||||
public static int nameDisplayOrder = 1;
|
||||
public static boolean is24HourFormat = false;
|
||||
|
||||
private volatile FastDateFormat formatterDay;
|
||||
public FastDateFormat getFormatterDay() {
|
||||
if (formatterDay == null) {
|
||||
synchronized (this) {
|
||||
if (formatterDay == null) {
|
||||
final Locale locale = currentLocale == null ? Locale.getDefault() : currentLocale;
|
||||
String lang = locale.getLanguage();
|
||||
if (lang == null) {
|
||||
lang = "en";
|
||||
}
|
||||
lang = lang.toLowerCase();
|
||||
formatterDay = createFormatter(lang.toLowerCase().equals("ar") || lang.toLowerCase().equals("ko") ? locale : Locale.US, is24HourFormat ? getStringInternal("formatterDay24H", R.string.formatterDay24H) : getStringInternal("formatterDay12H", R.string.formatterDay12H), is24HourFormat ? "HH:mm" : "h:mm a");
|
||||
}
|
||||
}
|
||||
}
|
||||
return formatterDay;
|
||||
}
|
||||
|
||||
private volatile FastDateFormat formatterConstDay;
|
||||
public FastDateFormat getFormatterConstDay() {
|
||||
if (formatterConstDay == null) {
|
||||
synchronized (this) {
|
||||
if (formatterConstDay == null) {
|
||||
final Locale locale = currentLocale == null ? Locale.getDefault() : currentLocale;
|
||||
String lang = locale.getLanguage();
|
||||
if (lang == null) {
|
||||
lang = "en";
|
||||
}
|
||||
lang = lang.toLowerCase();
|
||||
formatterConstDay = createFormatter(lang.toLowerCase().equals("ar") || lang.toLowerCase().equals("ko") ? locale : Locale.US, is24HourFormat ? "HH:mm" : "h:mm a", is24HourFormat ? "HH:mm" : "h:mm a");
|
||||
}
|
||||
}
|
||||
}
|
||||
return formatterConstDay;
|
||||
}
|
||||
|
||||
private volatile FastDateFormat formatterWeek;
|
||||
public FastDateFormat getFormatterWeek() {
|
||||
if (formatterWeek == null) {
|
||||
synchronized (this) {
|
||||
if (formatterWeek == null) {
|
||||
final Locale locale = currentLocale == null ? Locale.getDefault() : currentLocale;
|
||||
formatterWeek = createFormatter(locale, getStringInternal("formatterWeek", R.string.formatterWeek), "EEE");
|
||||
}
|
||||
}
|
||||
}
|
||||
return formatterWeek;
|
||||
}
|
||||
|
||||
private volatile FastDateFormat formatterWeekLong;
|
||||
public FastDateFormat getFormatterWeekLong() {
|
||||
if (formatterWeekLong == null) {
|
||||
synchronized (this) {
|
||||
if (formatterWeekLong == null) {
|
||||
final Locale locale = currentLocale == null ? Locale.getDefault() : currentLocale;
|
||||
formatterWeekLong = createFormatter(locale, getStringInternal("formatterWeekLong", R.string.formatterWeekLong), "EEEE");
|
||||
}
|
||||
}
|
||||
}
|
||||
return formatterWeekLong;
|
||||
}
|
||||
|
||||
private volatile FastDateFormat formatterDayMonth;
|
||||
public FastDateFormat getFormatterDayMonth() {
|
||||
if (formatterDayMonth == null) {
|
||||
synchronized (this) {
|
||||
if (formatterDayMonth == null) {
|
||||
final Locale locale = currentLocale == null ? Locale.getDefault() : currentLocale;
|
||||
formatterDayMonth = createFormatter(locale, getStringInternal("formatterMonth", R.string.formatterMonth), "dd MMM");
|
||||
}
|
||||
}
|
||||
}
|
||||
return formatterDayMonth;
|
||||
}
|
||||
|
||||
private volatile FastDateFormat formatterYear;
|
||||
public FastDateFormat getFormatterYear() {
|
||||
if (formatterYear == null) {
|
||||
synchronized (this) {
|
||||
if (formatterYear == null) {
|
||||
final Locale locale = currentLocale == null ? Locale.getDefault() : currentLocale;
|
||||
formatterYear = createFormatter(locale, getStringInternal("formatterYear", R.string.formatterYear), "dd.MM.yy");
|
||||
}
|
||||
}
|
||||
}
|
||||
return formatterYear;
|
||||
}
|
||||
|
||||
private volatile FastDateFormat formatterYearMax;
|
||||
public FastDateFormat getFormatterYearMax() {
|
||||
if (formatterYearMax == null) {
|
||||
synchronized (this) {
|
||||
if (formatterYearMax == null) {
|
||||
final Locale locale = currentLocale == null ? Locale.getDefault() : currentLocale;
|
||||
formatterYearMax = createFormatter(locale, getStringInternal("formatterYearMax", R.string.formatterYearMax), "dd.MM.yyyy");
|
||||
}
|
||||
}
|
||||
}
|
||||
return formatterYearMax;
|
||||
}
|
||||
|
||||
private volatile FastDateFormat formatterStats;
|
||||
public FastDateFormat getFormatterStats() {
|
||||
if (formatterStats == null) {
|
||||
synchronized (this) {
|
||||
if (formatterStats == null) {
|
||||
final Locale locale = currentLocale == null ? Locale.getDefault() : currentLocale;
|
||||
formatterStats = createFormatter(locale, is24HourFormat ? getStringInternal("formatterStats24H", R.string.formatterStats24H) : getStringInternal("formatterStats12H", R.string.formatterStats12H), is24HourFormat ? "MMM dd yyyy, HH:mm" : "MMM dd yyyy, h:mm a");
|
||||
}
|
||||
}
|
||||
}
|
||||
return formatterStats;
|
||||
}
|
||||
|
||||
private volatile FastDateFormat formatterBannedUntil;
|
||||
public FastDateFormat getFormatterBannedUntil() {
|
||||
if (formatterBannedUntil == null) {
|
||||
synchronized (this) {
|
||||
if (formatterBannedUntil == null) {
|
||||
final Locale locale = currentLocale == null ? Locale.getDefault() : currentLocale;
|
||||
formatterBannedUntil = createFormatter(locale, is24HourFormat ? getStringInternal("formatterBannedUntil24H", R.string.formatterBannedUntil24H) : getStringInternal("formatterBannedUntil12H", R.string.formatterBannedUntil12H), is24HourFormat ? "MMM dd yyyy, HH:mm" : "MMM dd yyyy, h:mm a");
|
||||
}
|
||||
}
|
||||
}
|
||||
return formatterBannedUntil;
|
||||
}
|
||||
|
||||
private volatile FastDateFormat formatterBannedUntilThisYear;
|
||||
public FastDateFormat getFormatterBannedUntilThisYear() {
|
||||
if (formatterBannedUntilThisYear == null) {
|
||||
synchronized (this) {
|
||||
if (formatterBannedUntilThisYear == null) {
|
||||
final Locale locale = currentLocale == null ? Locale.getDefault() : currentLocale;
|
||||
formatterBannedUntilThisYear = createFormatter(locale, is24HourFormat ? getStringInternal("formatterBannedUntilThisYear24H", R.string.formatterBannedUntilThisYear24H) : getStringInternal("formatterBannedUntilThisYear12H", R.string.formatterBannedUntilThisYear12H), is24HourFormat ? "MMM dd, HH:mm" : "MMM dd, h:mm a");
|
||||
}
|
||||
}
|
||||
}
|
||||
return formatterBannedUntilThisYear;
|
||||
}
|
||||
|
||||
private volatile FastDateFormat chatDate;
|
||||
public FastDateFormat getChatDate() {
|
||||
if (chatDate == null) {
|
||||
synchronized (this) {
|
||||
if (chatDate == null) {
|
||||
final Locale locale = currentLocale == null ? Locale.getDefault() : currentLocale;
|
||||
chatDate = createFormatter(locale, getStringInternal("chatDate", R.string.chatDate), "d MMMM");
|
||||
}
|
||||
}
|
||||
}
|
||||
return chatDate;
|
||||
}
|
||||
|
||||
private volatile FastDateFormat chatFullDate;
|
||||
public FastDateFormat getChatFullDate() {
|
||||
if (chatFullDate == null) {
|
||||
synchronized (this) {
|
||||
if (chatFullDate == null) {
|
||||
final Locale locale = currentLocale == null ? Locale.getDefault() : currentLocale;
|
||||
chatFullDate = createFormatter(locale, getStringInternal("chatFullDate", R.string.chatFullDate), "d MMMM yyyy");
|
||||
}
|
||||
}
|
||||
}
|
||||
return chatFullDate;
|
||||
}
|
||||
|
||||
private volatile FastDateFormat formatterScheduleDay;
|
||||
public FastDateFormat getFormatterScheduleDay() {
|
||||
if (formatterScheduleDay == null) {
|
||||
synchronized (this) {
|
||||
if (formatterScheduleDay == null) {
|
||||
final Locale locale = currentLocale == null ? Locale.getDefault() : currentLocale;
|
||||
formatterScheduleDay = createFormatter(locale, getStringInternal("formatDateSchedule", R.string.formatDateSchedule), "MMM d");
|
||||
}
|
||||
}
|
||||
}
|
||||
return formatterScheduleDay;
|
||||
}
|
||||
|
||||
private volatile FastDateFormat formatterScheduleYear;
|
||||
public FastDateFormat getFormatterScheduleYear() {
|
||||
if (formatterScheduleYear == null) {
|
||||
synchronized (this) {
|
||||
if (formatterScheduleYear == null) {
|
||||
final Locale locale = currentLocale == null ? Locale.getDefault() : currentLocale;
|
||||
formatterScheduleYear = createFormatter(locale, getStringInternal("formatDateScheduleYear", R.string.formatDateScheduleYear), "MMM d yyyy");
|
||||
}
|
||||
}
|
||||
}
|
||||
return formatterScheduleYear;
|
||||
}
|
||||
|
||||
private volatile FastDateFormat formatterMonthYear;
|
||||
public FastDateFormat getFormatterMonthYear() {
|
||||
if (formatterMonthYear == null) {
|
||||
synchronized (this) {
|
||||
if (formatterMonthYear == null) {
|
||||
final Locale locale = currentLocale == null ? Locale.getDefault() : currentLocale;
|
||||
formatterMonthYear = createFormatter(locale, getStringInternal("formatterMonthYear", R.string.formatterMonthYear), "MMM yyyy");
|
||||
}
|
||||
}
|
||||
}
|
||||
return formatterMonthYear;
|
||||
}
|
||||
|
||||
private volatile FastDateFormat formatterGiveawayCard;
|
||||
public FastDateFormat getFormatterGiveawayCard() {
|
||||
if (formatterGiveawayCard == null) {
|
||||
synchronized (this) {
|
||||
if (formatterGiveawayCard == null) {
|
||||
final Locale locale = currentLocale == null ? Locale.getDefault() : currentLocale;
|
||||
formatterGiveawayCard = createFormatter(locale, getStringInternal("formatterGiveawayCard", R.string.formatterGiveawayCard), "dd MMM yyyy");
|
||||
}
|
||||
}
|
||||
}
|
||||
return formatterGiveawayCard;
|
||||
}
|
||||
|
||||
private volatile FastDateFormat formatterBoostExpired;
|
||||
public FastDateFormat getFormatterBoostExpired() {
|
||||
if (formatterBoostExpired == null) {
|
||||
synchronized (this) {
|
||||
if (formatterBoostExpired == null) {
|
||||
final Locale locale = currentLocale == null ? Locale.getDefault() : currentLocale;
|
||||
formatterBoostExpired = createFormatter(locale, getStringInternal("formatterBoostExpired", R.string.formatterBoostExpired), "MMM dd, yyyy");
|
||||
}
|
||||
}
|
||||
}
|
||||
return formatterBoostExpired;
|
||||
}
|
||||
|
||||
private volatile FastDateFormat formatterGiveawayMonthDay;
|
||||
public FastDateFormat getFormatterGiveawayMonthDay() {
|
||||
if (formatterGiveawayMonthDay == null) {
|
||||
synchronized (this) {
|
||||
if (formatterGiveawayMonthDay == null) {
|
||||
final Locale locale = currentLocale == null ? Locale.getDefault() : currentLocale;
|
||||
formatterGiveawayMonthDay = createFormatter(locale, getStringInternal("formatterGiveawayMonthDay", R.string.formatterGiveawayMonthDay), "MMMM dd");
|
||||
}
|
||||
}
|
||||
}
|
||||
return formatterGiveawayMonthDay;
|
||||
}
|
||||
|
||||
private volatile FastDateFormat formatterGiveawayMonthDayYear;
|
||||
public FastDateFormat getFormatterGiveawayMonthDayYear() {
|
||||
if (formatterGiveawayMonthDayYear == null) {
|
||||
synchronized (this) {
|
||||
if (formatterGiveawayMonthDayYear == null) {
|
||||
final Locale locale = currentLocale == null ? Locale.getDefault() : currentLocale;
|
||||
formatterGiveawayMonthDayYear = createFormatter(locale, getStringInternal("formatterGiveawayMonthDayYear", R.string.formatterGiveawayMonthDayYear), "MMMM dd, yyyy");
|
||||
}
|
||||
}
|
||||
}
|
||||
return formatterGiveawayMonthDayYear;
|
||||
}
|
||||
|
||||
private final FastDateFormat[] formatterScheduleSend = new FastDateFormat[15];
|
||||
public FastDateFormat getFormatterScheduleSend(int n) {
|
||||
if (n < 0 || n >= formatterScheduleSend.length)
|
||||
return null;
|
||||
if (formatterScheduleSend[n] == null) {
|
||||
final Locale locale = currentLocale == null ? Locale.getDefault() : currentLocale;
|
||||
switch (n) {
|
||||
case 0: formatterScheduleSend[n] = createFormatter(locale, getStringInternal("SendTodayAt", R.string.SendTodayAt), "'Send today at' HH:mm"); break;
|
||||
case 1: formatterScheduleSend[n] = createFormatter(locale, getStringInternal("SendDayAt", R.string.SendDayAt), "'Send on' MMM d 'at' HH:mm"); break;
|
||||
case 2: formatterScheduleSend[n] = createFormatter(locale, getStringInternal("SendDayYearAt", R.string.SendDayYearAt), "'Send on' MMM d yyyy 'at' HH:mm"); break;
|
||||
case 3: formatterScheduleSend[n] = createFormatter(locale, getStringInternal("RemindTodayAt", R.string.RemindTodayAt), "'Remind today at' HH:mm"); break;
|
||||
case 4: formatterScheduleSend[n] = createFormatter(locale, getStringInternal("RemindDayAt", R.string.RemindDayAt), "'Remind on' MMM d 'at' HH:mm"); break;
|
||||
case 5: formatterScheduleSend[n] = createFormatter(locale, getStringInternal("RemindDayYearAt", R.string.RemindDayYearAt), "'Remind on' MMM d yyyy 'at' HH:mm"); break;
|
||||
case 6: formatterScheduleSend[n] = createFormatter(locale, getStringInternal("StartTodayAt", R.string.StartTodayAt), "'Start today at' HH:mm"); break;
|
||||
case 7: formatterScheduleSend[n] = createFormatter(locale, getStringInternal("StartDayAt", R.string.StartDayAt), "'Start on' MMM d 'at' HH:mm"); break;
|
||||
case 8: formatterScheduleSend[n] = createFormatter(locale, getStringInternal("StartDayYearAt", R.string.StartDayYearAt), "'Start on' MMM d yyyy 'at' HH:mm"); break;
|
||||
case 9: formatterScheduleSend[n] = createFormatter(locale, getStringInternal("StartShortTodayAt", R.string.StartShortTodayAt), "'Today,' HH:mm"); break;
|
||||
case 10: formatterScheduleSend[n] = createFormatter(locale, getStringInternal("StartShortDayAt", R.string.StartShortDayAt), "MMM d',' HH:mm"); break;
|
||||
case 11: formatterScheduleSend[n] = createFormatter(locale, getStringInternal("StartShortDayYearAt", R.string.StartShortDayYearAt), "MMM d yyyy, HH:mm"); break;
|
||||
case 12: formatterScheduleSend[n] = createFormatter(locale, getStringInternal("StartsTodayAt", R.string.StartsTodayAt), "'Starts today at' HH:mm"); break;
|
||||
case 13: formatterScheduleSend[n] = createFormatter(locale, getStringInternal("StartsDayAt", R.string.StartsDayAt), "'Starts on' MMM d 'at' HH:mm"); break;
|
||||
case 14: formatterScheduleSend[n] = createFormatter(locale, getStringInternal("StartsDayYearAt", R.string.StartsDayYearAt), "'Starts on' MMM d yyyy 'at' HH:mm"); break;
|
||||
}
|
||||
}
|
||||
return formatterScheduleSend[n];
|
||||
}
|
||||
|
||||
public FastDateFormat formatterDay;
|
||||
public FastDateFormat formatterConstDay;
|
||||
public FastDateFormat formatterWeek;
|
||||
public FastDateFormat formatterWeekLong;
|
||||
public FastDateFormat formatterDayMonth;
|
||||
public FastDateFormat formatterYear;
|
||||
public FastDateFormat formatterYearMax;
|
||||
public FastDateFormat formatterStats;
|
||||
public FastDateFormat formatterBannedUntil;
|
||||
public FastDateFormat formatterBannedUntilThisYear;
|
||||
public FastDateFormat chatDate;
|
||||
public FastDateFormat chatFullDate;
|
||||
public FastDateFormat formatterScheduleDay;
|
||||
public FastDateFormat formatterScheduleYear;
|
||||
public FastDateFormat formatterMonthYear;
|
||||
public FastDateFormat formatterGiveawayCard;
|
||||
public FastDateFormat formatterBoostExpired;
|
||||
public FastDateFormat formatterGiveawayMonthDay;
|
||||
public FastDateFormat formatterGiveawayMonthDayYear;
|
||||
public FastDateFormat[] formatterScheduleSend = new FastDateFormat[15];
|
||||
|
||||
private static HashMap<Integer, String> resourcesCacheMap = new HashMap<>();
|
||||
|
||||
|
@ -369,7 +106,7 @@ public class LocaleController {
|
|||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
ApplicationLoader.applicationHandler.post(() -> {
|
||||
if (!getFormatterDayMonth().getTimeZone().equals(TimeZone.getDefault())) {
|
||||
if (!formatterDayMonth.getTimeZone().equals(TimeZone.getDefault())) {
|
||||
LocaleController.getInstance().recreateFormatters();
|
||||
}
|
||||
});
|
||||
|
@ -1126,7 +863,7 @@ public class LocaleController {
|
|||
if (!file.exists()) {
|
||||
return new HashMap<>();
|
||||
}
|
||||
HashMap<String, String> stringMap = new HashMap<>(10_000);
|
||||
HashMap<String, String> stringMap = new HashMap<>();
|
||||
XmlPullParser parser = Xml.newPullParser();
|
||||
//AndroidUtilities.copyFile(file, new File(ApplicationLoader.applicationContext.getExternalFilesDir(null), "locale10.xml"));
|
||||
stream = new FileInputStream(file);
|
||||
|
@ -1194,6 +931,7 @@ public class LocaleController {
|
|||
}
|
||||
|
||||
public int applyLanguage(final LocaleInfo localeInfo, boolean override, boolean init, boolean fromFile, boolean force, final int currentAccount, Runnable onDone) {
|
||||
LanguageCode.INSTANCE.setLanguageCode(localeInfo.getLangCode());
|
||||
if (localeInfo == null) {
|
||||
return 0;
|
||||
}
|
||||
|
@ -1461,10 +1199,8 @@ public class LocaleController {
|
|||
value = BuildVars.USE_CLOUD_STRINGS ? getInstance().localeValues.get(key + "_other") : null;
|
||||
}
|
||||
if (value == null) {
|
||||
try {
|
||||
int resourceId = ApplicationLoader.applicationContext.getResources().getIdentifier(param, "string", ApplicationLoader.applicationContext.getPackageName());
|
||||
value = ApplicationLoader.applicationContext.getString(resourceId);
|
||||
} catch (Exception e2) {}
|
||||
int resourceId = ApplicationLoader.applicationContext.getResources().getIdentifier(param, "string", ApplicationLoader.applicationContext.getPackageName());
|
||||
value = ApplicationLoader.applicationContext.getString(resourceId);
|
||||
}
|
||||
if (value == null) {
|
||||
int resourceId = ApplicationLoader.applicationContext.getResources().getIdentifier(key + "_other", "string", ApplicationLoader.applicationContext.getPackageName());
|
||||
|
@ -1915,9 +1651,9 @@ public class LocaleController {
|
|||
|
||||
calendar.setTimeInMillis(date);
|
||||
if (checkYear && currentYear == calendar.get(Calendar.YEAR) || !checkYear && Math.abs(System.currentTimeMillis() - date) < 31536000000L) {
|
||||
return getInstance().getChatDate().format(date);
|
||||
return getInstance().chatDate.format(date);
|
||||
}
|
||||
return getInstance().getChatFullDate().format(date);
|
||||
return getInstance().chatFullDate.format(date);
|
||||
} catch (Exception e) {
|
||||
FileLog.e(e);
|
||||
}
|
||||
|
@ -1936,9 +1672,9 @@ public class LocaleController {
|
|||
|
||||
calendar.setTimeInMillis(date);
|
||||
if (!full && currentYear == calendar.get(Calendar.YEAR)) {
|
||||
return getInstance().getFormatterDayMonth().format(date);
|
||||
return getInstance().formatterDayMonth.format(date);
|
||||
}
|
||||
return getInstance().getFormatterDayMonth().format(date) + ", " + calendar.get(Calendar.YEAR);
|
||||
return getInstance().formatterDayMonth.format(date) + ", " + calendar.get(Calendar.YEAR);
|
||||
} catch (Exception e) {
|
||||
FileLog.e(e);
|
||||
}
|
||||
|
@ -1956,13 +1692,13 @@ public class LocaleController {
|
|||
int dateYear = rightNow.get(Calendar.YEAR);
|
||||
|
||||
if (dateDay == day && year == dateYear) {
|
||||
return getInstance().getFormatterDay().format(new Date(date));
|
||||
return getInstance().formatterDay.format(new Date(date));
|
||||
} else if (dateDay + 1 == day && year == dateYear) {
|
||||
return getString("Yesterday", R.string.Yesterday);
|
||||
} else if (Math.abs(System.currentTimeMillis() - date) < 31536000000L) {
|
||||
return getInstance().getFormatterDayMonth().format(new Date(date));
|
||||
return getInstance().formatterDayMonth.format(new Date(date));
|
||||
} else {
|
||||
return getInstance().getFormatterYear().format(new Date(date));
|
||||
return getInstance().formatterYear.format(new Date(date));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
FileLog.e(e);
|
||||
|
@ -1982,16 +1718,16 @@ public class LocaleController {
|
|||
|
||||
if (dateDay == day && year == dateYear) {
|
||||
if (shortFormat) {
|
||||
return LocaleController.formatString("TodayAtFormatted", R.string.TodayAtFormatted, getInstance().getFormatterDay().format(new Date(date)));
|
||||
return LocaleController.formatString("TodayAtFormatted", R.string.TodayAtFormatted, getInstance().formatterDay.format(new Date(date)));
|
||||
} else {
|
||||
return LocaleController.formatString("TodayAtFormattedWithToday", R.string.TodayAtFormattedWithToday, getInstance().getFormatterDay().format(new Date(date)));
|
||||
return LocaleController.formatString("TodayAtFormattedWithToday", R.string.TodayAtFormattedWithToday, getInstance().formatterDay.format(new Date(date)));
|
||||
}
|
||||
} else if (dateDay + 1 == day && year == dateYear) {
|
||||
return LocaleController.formatString("YesterdayAtFormatted", R.string.YesterdayAtFormatted, getInstance().getFormatterDay().format(new Date(date)));
|
||||
return LocaleController.formatString("YesterdayAtFormatted", R.string.YesterdayAtFormatted, getInstance().formatterDay.format(new Date(date)));
|
||||
} else if (Math.abs(System.currentTimeMillis() - date) < 31536000000L) {
|
||||
return LocaleController.formatString("formatDateAtTime", R.string.formatDateAtTime, getInstance().getFormatterDayMonth().format(new Date(date)), getInstance().getFormatterDay().format(new Date(date)));
|
||||
return LocaleController.formatString("formatDateAtTime", R.string.formatDateAtTime, getInstance().formatterDayMonth.format(new Date(date)), getInstance().formatterDay.format(new Date(date)));
|
||||
} else {
|
||||
return LocaleController.formatString("formatDateAtTime", R.string.formatDateAtTime, getInstance().getFormatterYear().format(new Date(date)), getInstance().getFormatterDay().format(new Date(date)));
|
||||
return LocaleController.formatString("formatDateAtTime", R.string.formatDateAtTime, getInstance().formatterYear.format(new Date(date)), getInstance().formatterDay.format(new Date(date)));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
FileLog.e(e);
|
||||
|
@ -2010,13 +1746,13 @@ public class LocaleController {
|
|||
int dateYear = rightNow.get(Calendar.YEAR);
|
||||
|
||||
if (dateDay == day && year == dateYear) {
|
||||
return LocaleController.formatString("TodayAtFormattedWithToday", R.string.TodayAtFormattedWithToday, getInstance().getFormatterDay().format(new Date(date)));
|
||||
return LocaleController.formatString("TodayAtFormattedWithToday", R.string.TodayAtFormattedWithToday, getInstance().formatterDay.format(new Date(date)));
|
||||
} else if (dateDay + 1 == day && year == dateYear) {
|
||||
return LocaleController.formatString("YesterdayAtFormatted", R.string.YesterdayAtFormatted, getInstance().getFormatterDay().format(new Date(date)));
|
||||
return LocaleController.formatString("YesterdayAtFormatted", R.string.YesterdayAtFormatted, getInstance().formatterDay.format(new Date(date)));
|
||||
} else if (Math.abs(System.currentTimeMillis() - date) < 31536000000L) {
|
||||
return LocaleController.formatString("formatDateAtTime", R.string.formatDateAtTime, getInstance().getFormatterDayMonth().format(new Date(date)), getInstance().getFormatterDay().format(new Date(date)));
|
||||
return LocaleController.formatString("formatDateAtTime", R.string.formatDateAtTime, getInstance().formatterDayMonth.format(new Date(date)), getInstance().formatterDay.format(new Date(date)));
|
||||
} else {
|
||||
return LocaleController.formatString("formatDateAtTime", R.string.formatDateAtTime, getInstance().getFormatterYear().format(new Date(date)), getInstance().getFormatterDay().format(new Date(date)));
|
||||
return LocaleController.formatString("formatDateAtTime", R.string.formatDateAtTime, getInstance().formatterYear.format(new Date(date)), getInstance().formatterDay.format(new Date(date)));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
FileLog.e(e);
|
||||
|
@ -2035,13 +1771,13 @@ public class LocaleController {
|
|||
int dateYear = rightNow.get(Calendar.YEAR);
|
||||
|
||||
if (dateDay == day && year == dateYear) {
|
||||
return LocaleController.formatString(R.string.PmReadTodayAt, getInstance().getFormatterDay().format(new Date(date)));
|
||||
return LocaleController.formatString(R.string.PmReadTodayAt, getInstance().formatterDay.format(new Date(date)));
|
||||
} else if (dateDay + 1 == day && year == dateYear) {
|
||||
return LocaleController.formatString(R.string.PmReadYesterdayAt, getInstance().getFormatterDay().format(new Date(date)));
|
||||
return LocaleController.formatString(R.string.PmReadYesterdayAt, getInstance().formatterDay.format(new Date(date)));
|
||||
} else if (Math.abs(System.currentTimeMillis() - date) < 31536000000L) {
|
||||
return LocaleController.formatString(R.string.PmReadDateTimeAt, getInstance().getFormatterDayMonth().format(new Date(date)), getInstance().getFormatterDay().format(new Date(date)));
|
||||
return LocaleController.formatString(R.string.PmReadDateTimeAt, getInstance().formatterDayMonth.format(new Date(date)), getInstance().formatterDay.format(new Date(date)));
|
||||
} else {
|
||||
return LocaleController.formatString(R.string.PmReadDateTimeAt, getInstance().getFormatterYear().format(new Date(date)), getInstance().getFormatterDay().format(new Date(date)));
|
||||
return LocaleController.formatString(R.string.PmReadDateTimeAt, getInstance().formatterYear.format(new Date(date)), getInstance().formatterDay.format(new Date(date)));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
FileLog.e(e);
|
||||
|
@ -2075,9 +1811,9 @@ public class LocaleController {
|
|||
} else if (dateDay + 1 == day && year == dateYear) {
|
||||
return LocaleController.getString(R.string.ShortYesterday);
|
||||
} else if (Math.abs(System.currentTimeMillis() - date) < 31536000000L) {
|
||||
return getInstance().getFormatterDayMonth().format(new Date(date));
|
||||
return getInstance().formatterDayMonth.format(new Date(date));
|
||||
} else {
|
||||
return LocaleController.formatString("formatDateAtTime", R.string.formatDateAtTime, getInstance().getFormatterYear().format(new Date(date)), getInstance().getFormatterDay().format(new Date(date)));
|
||||
return LocaleController.formatString("formatDateAtTime", R.string.formatDateAtTime, getInstance().formatterYear.format(new Date(date)), getInstance().formatterDay.format(new Date(date)));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
FileLog.e(e);
|
||||
|
@ -2102,13 +1838,13 @@ public class LocaleController {
|
|||
int minutesAgo = (int) ((timeInMillis - date) / (1000 * 60));
|
||||
return LocaleController.formatPluralString("MinutesAgo", minutesAgo, minutesAgo);
|
||||
} else if (dateDay == day && year == dateYear) {
|
||||
return LocaleController.formatString("TodayAtFormattedWithToday", R.string.TodayAtFormattedWithToday, getInstance().getFormatterDay().format(new Date(date)));
|
||||
return LocaleController.formatString("TodayAtFormattedWithToday", R.string.TodayAtFormattedWithToday, getInstance().formatterDay.format(new Date(date)));
|
||||
} else if (dateDay + 1 == day && year == dateYear) {
|
||||
return LocaleController.formatString("YesterdayAtFormatted", R.string.YesterdayAtFormatted, getInstance().getFormatterDay().format(new Date(date)));
|
||||
return LocaleController.formatString("YesterdayAtFormatted", R.string.YesterdayAtFormatted, getInstance().formatterDay.format(new Date(date)));
|
||||
} else if (Math.abs(System.currentTimeMillis() - date) < 31536000000L) {
|
||||
return LocaleController.formatString("formatDateAtTime", R.string.formatDateAtTime, getInstance().getFormatterDayMonth().format(new Date(date)), getInstance().getFormatterDay().format(new Date(date)));
|
||||
return LocaleController.formatString("formatDateAtTime", R.string.formatDateAtTime, getInstance().formatterDayMonth.format(new Date(date)), getInstance().formatterDay.format(new Date(date)));
|
||||
} else {
|
||||
return LocaleController.formatString("formatDateAtTime", R.string.formatDateAtTime, getInstance().getFormatterYear().format(new Date(date)), getInstance().getFormatterDay().format(new Date(date)));
|
||||
return LocaleController.formatString("formatDateAtTime", R.string.formatDateAtTime, getInstance().formatterYear.format(new Date(date)), getInstance().formatterDay.format(new Date(date)));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
FileLog.e(e);
|
||||
|
@ -2127,13 +1863,13 @@ public class LocaleController {
|
|||
int dateYear = rightNow.get(Calendar.YEAR);
|
||||
|
||||
if (dateDay == day && year == dateYear) {
|
||||
return getInstance().getFormatterDay().format(new Date(date));
|
||||
return getInstance().formatterDay.format(new Date(date));
|
||||
} else if (dateDay + 1 == day && year == dateYear) {
|
||||
return LocaleController.formatString("YesterdayAtFormatted", R.string.YesterdayAtFormatted, getInstance().getFormatterDay().format(new Date(date)));
|
||||
return LocaleController.formatString("YesterdayAtFormatted", R.string.YesterdayAtFormatted, getInstance().formatterDay.format(new Date(date)));
|
||||
} else if (Math.abs(System.currentTimeMillis() - date) < 31536000000L) {
|
||||
return LocaleController.formatString("formatDateAtTime", R.string.formatDateAtTime, getInstance().getChatDate().format(new Date(date)), getInstance().getFormatterDay().format(new Date(date)));
|
||||
return LocaleController.formatString("formatDateAtTime", R.string.formatDateAtTime, getInstance().chatDate.format(new Date(date)), getInstance().formatterDay.format(new Date(date)));
|
||||
} else {
|
||||
return LocaleController.formatString("formatDateAtTime", R.string.formatDateAtTime, getInstance().getChatFullDate().format(new Date(date)), getInstance().getFormatterDay().format(new Date(date)));
|
||||
return LocaleController.formatString("formatDateAtTime", R.string.formatDateAtTime, getInstance().chatFullDate.format(new Date(date)), getInstance().formatterDay.format(new Date(date)));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
FileLog.e(e);
|
||||
|
@ -2152,11 +1888,11 @@ public class LocaleController {
|
|||
int dateYear = rightNow.get(Calendar.YEAR);
|
||||
|
||||
if (dateDay == day && year == dateYear) {
|
||||
return LocaleController.formatString("TodayAtFormatted", R.string.TodayAtFormatted, getInstance().getFormatterDay().format(new Date(date)));
|
||||
return LocaleController.formatString("TodayAtFormatted", R.string.TodayAtFormatted, getInstance().formatterDay.format(new Date(date)));
|
||||
} else if (Math.abs(System.currentTimeMillis() - date) < 31536000000L) {
|
||||
return getInstance().getFormatterScheduleDay().format(new Date(date));
|
||||
return getInstance().formatterScheduleDay.format(new Date(date));
|
||||
} else {
|
||||
return getInstance().getChatFullDate().format(new Date(date));
|
||||
return getInstance().chatFullDate.format(new Date(date));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
FileLog.e(e);
|
||||
|
@ -2175,13 +1911,13 @@ public class LocaleController {
|
|||
int dateYear = rightNow.get(Calendar.YEAR);
|
||||
|
||||
if (dateDay == day && year == dateYear && useToday) {
|
||||
return LocaleController.formatString("TodayAtFormattedWithToday", R.string.TodayAtFormattedWithToday, getInstance().getFormatterDay().format(new Date(date)));
|
||||
return LocaleController.formatString("TodayAtFormattedWithToday", R.string.TodayAtFormattedWithToday, getInstance().formatterDay.format(new Date(date)));
|
||||
} else if (dateDay + 1 == day && year == dateYear && useToday) {
|
||||
return LocaleController.formatString("YesterdayAtFormatted", R.string.YesterdayAtFormatted, getInstance().getFormatterDay().format(new Date(date)));
|
||||
return LocaleController.formatString("YesterdayAtFormatted", R.string.YesterdayAtFormatted, getInstance().formatterDay.format(new Date(date)));
|
||||
} else if (Math.abs(System.currentTimeMillis() - date) < 31536000000L) {
|
||||
return LocaleController.formatString("formatDateAtTime", R.string.formatDateAtTime, getInstance().getChatDate().format(new Date(date)), getInstance().getFormatterDay().format(new Date(date)));
|
||||
return LocaleController.formatString("formatDateAtTime", R.string.formatDateAtTime, getInstance().chatDate.format(new Date(date)), getInstance().formatterDay.format(new Date(date)));
|
||||
} else {
|
||||
return LocaleController.formatString("formatDateAtTime", R.string.formatDateAtTime, getInstance().getChatFullDate().format(new Date(date)), getInstance().getFormatterDay().format(new Date(date)));
|
||||
return LocaleController.formatString("formatDateAtTime", R.string.formatDateAtTime, getInstance().chatFullDate.format(new Date(date)), getInstance().formatterDay.format(new Date(date)));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
FileLog.e(e);
|
||||
|
@ -2193,9 +1929,9 @@ public class LocaleController {
|
|||
try {
|
||||
date *= 1000;
|
||||
if (Math.abs(System.currentTimeMillis() - date) < 31536000000L) {
|
||||
return getInstance().getFormatterScheduleDay().format(new Date(date)) + ", " + getInstance().getFormatterDay().format(new Date(date));
|
||||
return getInstance().formatterScheduleDay.format(new Date(date)) + ", " + getInstance().formatterDay.format(new Date(date));
|
||||
} else {
|
||||
return getInstance().getFormatterScheduleYear().format(new Date(date)) + ", " + getInstance().getFormatterDay().format(new Date(date));
|
||||
return getInstance().formatterScheduleYear.format(new Date(date)) + ", " + getInstance().formatterDay.format(new Date(date));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
FileLog.e(e);
|
||||
|
@ -2220,14 +1956,14 @@ public class LocaleController {
|
|||
} else if (diff < 60) {
|
||||
return LocaleController.formatPluralString("UpdatedMinutes", diff);
|
||||
}
|
||||
return LocaleController.formatString("LocationUpdatedFormatted", R.string.LocationUpdatedFormatted, LocaleController.formatString("TodayAtFormatted", R.string.TodayAtFormatted, getInstance().getFormatterDay().format(new Date(date))));
|
||||
return LocaleController.formatString("LocationUpdatedFormatted", R.string.LocationUpdatedFormatted, LocaleController.formatString("TodayAtFormatted", R.string.TodayAtFormatted, getInstance().formatterDay.format(new Date(date))));
|
||||
} else if (dateDay + 1 == day && year == dateYear) {
|
||||
return LocaleController.formatString("LocationUpdatedFormatted", R.string.LocationUpdatedFormatted, LocaleController.formatString("YesterdayAtFormatted", R.string.YesterdayAtFormatted, getInstance().getFormatterDay().format(new Date(date))));
|
||||
return LocaleController.formatString("LocationUpdatedFormatted", R.string.LocationUpdatedFormatted, LocaleController.formatString("YesterdayAtFormatted", R.string.YesterdayAtFormatted, getInstance().formatterDay.format(new Date(date))));
|
||||
} else if (Math.abs(System.currentTimeMillis() - date) < 31536000000L) {
|
||||
String format = LocaleController.formatString("formatDateAtTime", R.string.formatDateAtTime, getInstance().getFormatterDayMonth().format(new Date(date)), getInstance().getFormatterDay().format(new Date(date)));
|
||||
String format = LocaleController.formatString("formatDateAtTime", R.string.formatDateAtTime, getInstance().formatterDayMonth.format(new Date(date)), getInstance().formatterDay.format(new Date(date)));
|
||||
return LocaleController.formatString("LocationUpdatedFormatted", R.string.LocationUpdatedFormatted, format);
|
||||
} else {
|
||||
String format = LocaleController.formatString("formatDateAtTime", R.string.formatDateAtTime, getInstance().getFormatterYear().format(new Date(date)), getInstance().getFormatterDay().format(new Date(date)));
|
||||
String format = LocaleController.formatString("formatDateAtTime", R.string.formatDateAtTime, getInstance().formatterYear.format(new Date(date)), getInstance().formatterDay.format(new Date(date)));
|
||||
return LocaleController.formatString("LocationUpdatedFormatted", R.string.LocationUpdatedFormatted, format);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
@ -2265,7 +2001,7 @@ public class LocaleController {
|
|||
int dateHour = rightNow.get(Calendar.HOUR_OF_DAY);
|
||||
|
||||
if (dateDay == day && year == dateYear) {
|
||||
return LocaleController.formatString("LastSeenFormatted", R.string.LastSeenFormatted, LocaleController.formatString("TodayAtFormatted", R.string.TodayAtFormatted, getInstance().getFormatterDay().format(new Date(date))));
|
||||
return LocaleController.formatString("LastSeenFormatted", R.string.LastSeenFormatted, LocaleController.formatString("TodayAtFormatted", R.string.TodayAtFormatted, getInstance().formatterDay.format(new Date(date))));
|
||||
/*int diff = (int) (ConnectionsManager.getInstance().getCurrentTime() - date) / 60;
|
||||
if (diff < 1) {
|
||||
return LocaleController.getString("LastSeenNow", R.string.LastSeenNow);
|
||||
|
@ -2278,17 +2014,17 @@ public class LocaleController {
|
|||
if (madeShorter != null) {
|
||||
madeShorter[0] = true;
|
||||
if (hour <= 6 && dateHour > 18 && is24HourFormat) {
|
||||
return LocaleController.formatString("LastSeenFormatted", R.string.LastSeenFormatted, getInstance().getFormatterDay().format(new Date(date)));
|
||||
return LocaleController.formatString("LastSeenFormatted", R.string.LastSeenFormatted, getInstance().formatterDay.format(new Date(date)));
|
||||
}
|
||||
return LocaleController.formatString("YesterdayAtFormatted", R.string.YesterdayAtFormatted, getInstance().getFormatterDay().format(new Date(date)));
|
||||
return LocaleController.formatString("YesterdayAtFormatted", R.string.YesterdayAtFormatted, getInstance().formatterDay.format(new Date(date)));
|
||||
} else {
|
||||
return LocaleController.formatString("LastSeenFormatted", R.string.LastSeenFormatted, LocaleController.formatString("YesterdayAtFormatted", R.string.YesterdayAtFormatted, getInstance().getFormatterDay().format(new Date(date))));
|
||||
return LocaleController.formatString("LastSeenFormatted", R.string.LastSeenFormatted, LocaleController.formatString("YesterdayAtFormatted", R.string.YesterdayAtFormatted, getInstance().formatterDay.format(new Date(date))));
|
||||
}
|
||||
} else if (Math.abs(System.currentTimeMillis() - date) < 31536000000L) {
|
||||
String format = LocaleController.formatString("formatDateAtTime", R.string.formatDateAtTime, getInstance().getFormatterDayMonth().format(new Date(date)), getInstance().getFormatterDay().format(new Date(date)));
|
||||
String format = LocaleController.formatString("formatDateAtTime", R.string.formatDateAtTime, getInstance().formatterDayMonth.format(new Date(date)), getInstance().formatterDay.format(new Date(date)));
|
||||
return LocaleController.formatString("LastSeenDateFormatted", R.string.LastSeenDateFormatted, format);
|
||||
} else {
|
||||
String format = LocaleController.formatString("formatDateAtTime", R.string.formatDateAtTime, getInstance().getFormatterYear().format(new Date(date)), getInstance().getFormatterDay().format(new Date(date)));
|
||||
String format = LocaleController.formatString("formatDateAtTime", R.string.formatDateAtTime, getInstance().formatterYear.format(new Date(date)), getInstance().formatterDay.format(new Date(date)));
|
||||
return LocaleController.formatString("LastSeenDateFormatted", R.string.LastSeenDateFormatted, format);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
@ -2326,28 +2062,40 @@ public class LocaleController {
|
|||
|| currentLocaleInfo != null && currentLocaleInfo.isRtl;
|
||||
nameDisplayOrder = lang.equals("ko") ? 2 : 1;
|
||||
|
||||
formatterBoostExpired = null;
|
||||
formatterGiveawayCard = null;
|
||||
formatterGiveawayMonthDay = null;
|
||||
formatterGiveawayMonthDayYear = null;
|
||||
formatterMonthYear = null;
|
||||
formatterDayMonth = null;
|
||||
formatterYear = null;
|
||||
formatterYearMax = null;
|
||||
chatDate = null;
|
||||
chatFullDate = null;
|
||||
formatterWeek = null;
|
||||
formatterWeekLong = null;
|
||||
formatterScheduleDay = null;
|
||||
formatterScheduleYear = null;
|
||||
formatterDay = null;
|
||||
formatterConstDay = null;
|
||||
formatterStats = null;
|
||||
formatterBannedUntil = null;
|
||||
formatterBannedUntilThisYear = null;
|
||||
for (int i = 0; i < formatterScheduleSend.length; ++i) {
|
||||
formatterScheduleSend[i] = null;
|
||||
}
|
||||
formatterBoostExpired = createFormatter(locale, getStringInternal("formatterBoostExpired", R.string.formatterBoostExpired), "MMM dd, yyyy");
|
||||
formatterGiveawayCard = createFormatter(locale, getStringInternal("formatterGiveawayCard", R.string.formatterGiveawayCard), "dd MMM yyyy");
|
||||
formatterGiveawayMonthDay = createFormatter(locale, getStringInternal("formatterGiveawayMonthDay", R.string.formatterGiveawayMonthDay), "MMMM dd");
|
||||
formatterGiveawayMonthDayYear = createFormatter(locale, getStringInternal("formatterGiveawayMonthDayYear", R.string.formatterGiveawayMonthDayYear), "MMMM dd, yyyy");
|
||||
formatterMonthYear = createFormatter(locale, getStringInternal("formatterMonthYear", R.string.formatterMonthYear), "MMM yyyy");
|
||||
formatterDayMonth = createFormatter(locale, getStringInternal("formatterMonth", R.string.formatterMonth), "dd MMM");
|
||||
formatterYear = createFormatter(locale, getStringInternal("formatterYear", R.string.formatterYear), "dd.MM.yy");
|
||||
formatterYearMax = createFormatter(locale, getStringInternal("formatterYearMax", R.string.formatterYearMax), "dd.MM.yyyy");
|
||||
chatDate = createFormatter(locale, getStringInternal("chatDate", R.string.chatDate), "d MMMM");
|
||||
chatFullDate = createFormatter(locale, getStringInternal("chatFullDate", R.string.chatFullDate), "d MMMM yyyy");
|
||||
formatterWeek = createFormatter(locale, getStringInternal("formatterWeek", R.string.formatterWeek), "EEE");
|
||||
formatterWeekLong = createFormatter(locale, getStringInternal("formatterWeekLong", R.string.formatterWeekLong), "EEEE");
|
||||
formatterScheduleDay = createFormatter(locale, getStringInternal("formatDateSchedule", R.string.formatDateSchedule), "MMM d");
|
||||
formatterScheduleYear = createFormatter(locale, getStringInternal("formatDateScheduleYear", R.string.formatDateScheduleYear), "MMM d yyyy");
|
||||
formatterDay = createFormatter(lang.toLowerCase().equals("ar") || lang.toLowerCase().equals("ko") ? locale : Locale.US, is24HourFormat ? getStringInternal("formatterDay24H", R.string.formatterDay24H) : getStringInternal("formatterDay12H", R.string.formatterDay12H), is24HourFormat ? "HH:mm" : "h:mm a");
|
||||
formatterConstDay = createFormatter(lang.toLowerCase().equals("ar") || lang.toLowerCase().equals("ko") ? locale : Locale.US, is24HourFormat ? "HH:mm" : "h:mm a", is24HourFormat ? "HH:mm" : "h:mm a");
|
||||
formatterStats = createFormatter(locale, is24HourFormat ? getStringInternal("formatterStats24H", R.string.formatterStats24H) : getStringInternal("formatterStats12H", R.string.formatterStats12H), is24HourFormat ? "MMM dd yyyy, HH:mm" : "MMM dd yyyy, h:mm a");
|
||||
formatterBannedUntil = createFormatter(locale, is24HourFormat ? getStringInternal("formatterBannedUntil24H", R.string.formatterBannedUntil24H) : getStringInternal("formatterBannedUntil12H", R.string.formatterBannedUntil12H), is24HourFormat ? "MMM dd yyyy, HH:mm" : "MMM dd yyyy, h:mm a");
|
||||
formatterBannedUntilThisYear = createFormatter(locale, is24HourFormat ? getStringInternal("formatterBannedUntilThisYear24H", R.string.formatterBannedUntilThisYear24H) : getStringInternal("formatterBannedUntilThisYear12H", R.string.formatterBannedUntilThisYear12H), is24HourFormat ? "MMM dd, HH:mm" : "MMM dd, h:mm a");
|
||||
formatterScheduleSend[0] = createFormatter(locale, getStringInternal("SendTodayAt", R.string.SendTodayAt), "'Send today at' HH:mm");
|
||||
formatterScheduleSend[1] = createFormatter(locale, getStringInternal("SendDayAt", R.string.SendDayAt), "'Send on' MMM d 'at' HH:mm");
|
||||
formatterScheduleSend[2] = createFormatter(locale, getStringInternal("SendDayYearAt", R.string.SendDayYearAt), "'Send on' MMM d yyyy 'at' HH:mm");
|
||||
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) {
|
||||
|
@ -2387,7 +2135,7 @@ public class LocaleController {
|
|||
} else if (type == 4) {
|
||||
num += 12;
|
||||
}
|
||||
return LocaleController.getInstance().getFormatterScheduleSend(num).format(calendar.getTimeInMillis());
|
||||
return LocaleController.getInstance().formatterScheduleSend[num].format(calendar.getTimeInMillis());
|
||||
}
|
||||
|
||||
public static String formatSectionDate(long date) {
|
||||
|
@ -2438,9 +2186,9 @@ public class LocaleController {
|
|||
int dateYear = rightNow.get(Calendar.YEAR);
|
||||
|
||||
if (year == dateYear) {
|
||||
return getInstance().getFormatterBannedUntilThisYear().format(new Date(date));
|
||||
return getInstance().formatterBannedUntilThisYear.format(new Date(date));
|
||||
} else {
|
||||
return getInstance().getFormatterBannedUntil().format(new Date(date));
|
||||
return getInstance().formatterBannedUntil.format(new Date(date));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
FileLog.e(e);
|
||||
|
@ -2452,7 +2200,7 @@ public class LocaleController {
|
|||
try {
|
||||
date *= 1000;
|
||||
if (Math.abs(System.currentTimeMillis() - date) >= 31536000000L) {
|
||||
return getInstance().getFormatterYear().format(new Date(date));
|
||||
return getInstance().formatterYear.format(new Date(date));
|
||||
} else {
|
||||
Calendar rightNow = Calendar.getInstance();
|
||||
int day = rightNow.get(Calendar.DAY_OF_YEAR);
|
||||
|
@ -2461,11 +2209,11 @@ public class LocaleController {
|
|||
|
||||
int dayDiff = dateDay - day;
|
||||
if (dayDiff == 0 || dayDiff == -1 && System.currentTimeMillis() - date < 60 * 60 * 8 * 1000) {
|
||||
return getInstance().getFormatterDay().format(new Date(date));
|
||||
return getInstance().formatterDay.format(new Date(date));
|
||||
} else if (dayDiff > -7 && dayDiff <= -1) {
|
||||
return getInstance().getFormatterWeek().format(new Date(date));
|
||||
return getInstance().formatterWeek.format(new Date(date));
|
||||
} else {
|
||||
return getInstance().getFormatterDayMonth().format(new Date(date));
|
||||
return getInstance().formatterDayMonth.format(new Date(date));
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
@ -2513,9 +2261,9 @@ public class LocaleController {
|
|||
date *= 1000;
|
||||
String format;
|
||||
if (Math.abs(System.currentTimeMillis() - date) < 31536000000L) {
|
||||
format = LocaleController.formatString("formatDateAtTime", R.string.formatDateAtTime, getInstance().getFormatterDayMonth().format(new Date(date)), getInstance().getFormatterDay().format(new Date(date)));
|
||||
format = LocaleController.formatString("formatDateAtTime", R.string.formatDateAtTime, getInstance().formatterDayMonth.format(new Date(date)), getInstance().formatterDay.format(new Date(date)));
|
||||
} else {
|
||||
format = LocaleController.formatString("formatDateAtTime", R.string.formatDateAtTime, getInstance().getFormatterYear().format(new Date(date)), getInstance().getFormatterDay().format(new Date(date)));
|
||||
format = LocaleController.formatString("formatDateAtTime", R.string.formatDateAtTime, getInstance().formatterYear.format(new Date(date)), getInstance().formatterDay.format(new Date(date)));
|
||||
}
|
||||
return formatString("ChannelOtherSubscriberJoined", R.string.ChannelOtherSubscriberJoined, format);
|
||||
} catch (Exception e) {
|
||||
|
@ -2528,7 +2276,7 @@ public class LocaleController {
|
|||
try {
|
||||
date *= 1000;
|
||||
Date dt = new Date(date);
|
||||
return String.format("%1$s, %2$s", getInstance().getFormatterYear().format(dt), getInstance().getFormatterDay().format(dt));
|
||||
return String.format("%1$s, %2$s", getInstance().formatterYear.format(dt), getInstance().formatterDay.format(dt));
|
||||
} catch (Exception e) {
|
||||
FileLog.e(e);
|
||||
}
|
||||
|
|
|
@ -30,7 +30,6 @@ import org.telegram.SQLite.SQLitePreparedStatement;
|
|||
import org.telegram.tgnet.NativeByteBuffer;
|
||||
import org.telegram.tgnet.TLObject;
|
||||
import org.telegram.tgnet.TLRPC;
|
||||
import org.telegram.tgnet.tl.TL_stories;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
@ -1005,30 +1004,6 @@ public class LocationController extends BaseController implements NotificationCe
|
|||
}
|
||||
|
||||
public static final int TYPE_BIZ = 1;
|
||||
public static final int TYPE_STORY = 2;
|
||||
|
||||
// google geocoder thinks that "unnamed road" is a street name
|
||||
public static String[] unnamedRoads = {
|
||||
"Unnamed Road",
|
||||
"Вulicya bez nazvi",
|
||||
"Нeizvestnaya doroga",
|
||||
"İsimsiz Yol",
|
||||
"Ceļš bez nosaukuma",
|
||||
"Kelias be pavadinimo",
|
||||
"Droga bez nazwy",
|
||||
"Cesta bez názvu",
|
||||
"Silnice bez názvu",
|
||||
"Drum fără nume",
|
||||
"Route sans nom",
|
||||
"Vía sin nombre",
|
||||
"Estrada sem nome",
|
||||
"Οdos xoris onomasia",
|
||||
"Rrugë pa emër",
|
||||
"Пat bez ime",
|
||||
"Нeimenovani put",
|
||||
"Strada senza nome",
|
||||
"Straße ohne Straßennamen"
|
||||
};
|
||||
|
||||
private static HashMap<LocationFetchCallback, Runnable> callbacks = new HashMap<>();
|
||||
public static void fetchLocationAddress(Location location, LocationFetchCallback callback) {
|
||||
|
@ -1049,42 +1024,22 @@ public class LocationController extends BaseController implements NotificationCe
|
|||
}
|
||||
|
||||
Locale locale;
|
||||
Locale englishLocale;
|
||||
try {
|
||||
locale = LocaleController.getInstance().getCurrentLocale();
|
||||
} catch (Exception ignore) {
|
||||
locale = LocaleController.getInstance().getSystemDefaultLocale();
|
||||
}
|
||||
if (locale.getLanguage().contains("en")) {
|
||||
englishLocale = locale;
|
||||
} else {
|
||||
englishLocale = Locale.US;
|
||||
}
|
||||
final Locale finalLocale = locale;
|
||||
Utilities.globalQueue.postRunnable(fetchLocationRunnable = () -> {
|
||||
String name, displayName, city, street, countryCode = null, locality = null, feature = null, engFeature = null;
|
||||
String engState = null, engCity = null;
|
||||
StringBuilder engStreet = new StringBuilder();
|
||||
String name, displayName, city, street, countryCode = null;
|
||||
boolean onlyCountry = true;
|
||||
TLRPC.TL_messageMediaVenue cityLocation = null;
|
||||
TL_stories.TL_geoPointAddress cityAddress = new TL_stories.TL_geoPointAddress();
|
||||
TLRPC.TL_messageMediaVenue streetLocation = null;
|
||||
TL_stories.TL_geoPointAddress streetAddress = new TL_stories.TL_geoPointAddress();
|
||||
try {
|
||||
Geocoder gcd = new Geocoder(ApplicationLoader.applicationContext, finalLocale);
|
||||
List<Address> addresses = gcd.getFromLocation(location.getLatitude(), location.getLongitude(), 1);
|
||||
List<Address> engAddresses = null;
|
||||
if (type == TYPE_STORY) {
|
||||
if (englishLocale == finalLocale) {
|
||||
engAddresses = addresses;
|
||||
} else {
|
||||
Geocoder gcd2 = new Geocoder(ApplicationLoader.applicationContext, englishLocale);
|
||||
engAddresses = gcd2.getFromLocation(location.getLatitude(), location.getLongitude(), 1);
|
||||
}
|
||||
}
|
||||
if (addresses.size() > 0) {
|
||||
Address address = addresses.get(0);
|
||||
Address engAddress = engAddresses != null && engAddresses.size() >= 1 ? engAddresses.get(0) : null;
|
||||
if (type == TYPE_BIZ) {
|
||||
ArrayList<String> parts = new ArrayList<>();
|
||||
|
||||
|
@ -1142,6 +1097,8 @@ public class LocationController extends BaseController implements NotificationCe
|
|||
StringBuilder cityBuilder = new StringBuilder();
|
||||
StringBuilder streetBuilder = new StringBuilder();
|
||||
|
||||
String locality = null;
|
||||
String feature = null;
|
||||
// String addressLine = null;
|
||||
// try {
|
||||
// addressLine = address.getAddressLine(0);
|
||||
|
@ -1162,30 +1119,15 @@ public class LocationController extends BaseController implements NotificationCe
|
|||
//// feature = parts[0].replace(",", "").trim();
|
||||
// }
|
||||
// }
|
||||
|
||||
if (TextUtils.isEmpty(locality)) {
|
||||
locality = address.getLocality();
|
||||
}
|
||||
if (TextUtils.isEmpty(locality)) {
|
||||
locality = address.getAdminArea();
|
||||
}
|
||||
if (TextUtils.isEmpty(locality)) {
|
||||
locality = address.getSubAdminArea();
|
||||
}
|
||||
if (engAddress != null) {
|
||||
if (TextUtils.isEmpty(engCity)) {
|
||||
engCity = engAddress.getLocality();
|
||||
}
|
||||
if (TextUtils.isEmpty(engCity)) {
|
||||
engCity = engAddress.getAdminArea();
|
||||
}
|
||||
if (TextUtils.isEmpty(engCity)) {
|
||||
engCity = engAddress.getSubAdminArea();
|
||||
}
|
||||
|
||||
engState = engAddress.getAdminArea();
|
||||
if (TextUtils.isEmpty(locality)) {
|
||||
locality = address.getAdminArea();
|
||||
}
|
||||
|
||||
if (TextUtils.isEmpty(feature) && !TextUtils.equals(address.getThoroughfare(), locality) && !TextUtils.equals(address.getThoroughfare(), address.getCountryName())) {
|
||||
feature = address.getThoroughfare();
|
||||
}
|
||||
|
@ -1203,41 +1145,6 @@ public class LocationController extends BaseController implements NotificationCe
|
|||
} else {
|
||||
streetBuilder = null;
|
||||
}
|
||||
|
||||
if (engAddress != null) {
|
||||
if (TextUtils.isEmpty(engFeature) && !TextUtils.equals(engAddress.getThoroughfare(), locality) && !TextUtils.equals(engAddress.getThoroughfare(), engAddress.getCountryName())) {
|
||||
engFeature = engAddress.getThoroughfare();
|
||||
}
|
||||
if (TextUtils.isEmpty(engFeature) && !TextUtils.equals(engAddress.getSubLocality(), locality) && !TextUtils.equals(engAddress.getSubLocality(), engAddress.getCountryName())) {
|
||||
engFeature = engAddress.getSubLocality();
|
||||
}
|
||||
if (TextUtils.isEmpty(engFeature) && !TextUtils.equals(engAddress.getLocality(), locality) && !TextUtils.equals(engAddress.getLocality(), engAddress.getCountryName())) {
|
||||
engFeature = engAddress.getLocality();
|
||||
}
|
||||
if (!TextUtils.isEmpty(engFeature) && !TextUtils.equals(engFeature, engState) && !TextUtils.equals(engFeature, engAddress.getCountryName())) {
|
||||
if (engStreet.length() > 0) {
|
||||
engStreet.append(", ");
|
||||
}
|
||||
engStreet.append(engFeature);
|
||||
} else {
|
||||
engStreet = null;
|
||||
}
|
||||
|
||||
if (!TextUtils.isEmpty(engStreet)) {
|
||||
boolean isUnnamed = false;
|
||||
for (int i = 0; i < unnamedRoads.length; ++i) {
|
||||
if (unnamedRoads[i].equalsIgnoreCase(engStreet.toString())) {
|
||||
isUnnamed = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (isUnnamed) {
|
||||
engStreet = null;
|
||||
streetBuilder = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!TextUtils.isEmpty(locality)) {
|
||||
if (cityBuilder.length() > 0) {
|
||||
cityBuilder.append(", ");
|
||||
|
@ -1368,19 +1275,6 @@ public class LocationController extends BaseController implements NotificationCe
|
|||
cityLocation.icon = onlyCountry ? "https://ss3.4sqi.net/img/categories_v2/building/government_capitolbuilding_64.png" : "https://ss3.4sqi.net/img/categories_v2/travel/hotel_64.png";
|
||||
cityLocation.emoji = countryCodeToEmoji(countryCode);
|
||||
cityLocation.address = onlyCountry ? LocaleController.getString("Country", R.string.Country) : LocaleController.getString("PassportCity", R.string.PassportCity);
|
||||
|
||||
cityLocation.geoAddress = cityAddress;
|
||||
cityAddress.country_iso2 = countryCode;
|
||||
if (!onlyCountry) {
|
||||
if (!TextUtils.isEmpty(engState)) {
|
||||
cityAddress.flags |= 1;
|
||||
cityAddress.state = engState;
|
||||
}
|
||||
if (!TextUtils.isEmpty(engCity)) {
|
||||
cityAddress.flags |= 2;
|
||||
cityAddress.city = engCity;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!TextUtils.isEmpty(street)) {
|
||||
streetLocation = new TLRPC.TL_messageMediaVenue();
|
||||
|
@ -1391,21 +1285,6 @@ public class LocationController extends BaseController implements NotificationCe
|
|||
streetLocation.title = street;
|
||||
streetLocation.icon = "pin";
|
||||
streetLocation.address = LocaleController.getString("PassportStreet1", R.string.PassportStreet1);
|
||||
|
||||
streetLocation.geoAddress = streetAddress;
|
||||
streetAddress.country_iso2 = countryCode;
|
||||
if (!TextUtils.isEmpty(engState)) {
|
||||
streetAddress.flags |= 1;
|
||||
streetAddress.state = engState;
|
||||
}
|
||||
if (!TextUtils.isEmpty(engCity)) {
|
||||
streetAddress.flags |= 2;
|
||||
streetAddress.city = engCity;
|
||||
}
|
||||
if (!TextUtils.isEmpty(engStreet)) {
|
||||
streetAddress.flags |= 4;
|
||||
streetAddress.street = engStreet.toString();
|
||||
}
|
||||
}
|
||||
if (cityLocation == null && streetLocation == null && location != null) {
|
||||
String ocean = detectOcean(location.getLongitude(), location.getLatitude());
|
||||
|
|
|
@ -50,7 +50,6 @@ import android.os.Build;
|
|||
import android.os.Environment;
|
||||
import android.os.PowerManager;
|
||||
import android.os.SystemClock;
|
||||
import android.provider.DocumentsContract;
|
||||
import android.provider.MediaStore;
|
||||
import android.provider.OpenableColumns;
|
||||
import android.telephony.PhoneStateListener;
|
||||
|
@ -65,8 +64,6 @@ import android.view.WindowManager;
|
|||
import android.webkit.MimeTypeMap;
|
||||
import android.widget.FrameLayout;
|
||||
|
||||
import androidx.core.content.FileProvider;
|
||||
|
||||
import com.google.android.exoplayer2.C;
|
||||
import com.google.android.exoplayer2.ExoPlayer;
|
||||
import com.google.android.exoplayer2.ui.AspectRatioFrameLayout;
|
||||
|
@ -460,7 +457,6 @@ public class MediaController implements AudioManager.OnAudioFocusChangeListener,
|
|||
public boolean isMuted;
|
||||
public boolean canDeleteAfter;
|
||||
public boolean hasSpoiler;
|
||||
public long starsAmount;
|
||||
public String emoji;
|
||||
|
||||
public int videoOrientation = -1;
|
||||
|
@ -518,7 +514,6 @@ public class MediaController implements AudioManager.OnAudioFocusChangeListener,
|
|||
public void copyFrom(MediaEditState state) {
|
||||
super.copyFrom(state);
|
||||
this.hasSpoiler = state instanceof PhotoEntry && ((PhotoEntry) state).hasSpoiler;
|
||||
this.starsAmount = state instanceof PhotoEntry ? ((PhotoEntry) state).starsAmount : 0;
|
||||
}
|
||||
|
||||
public PhotoEntry clone() {
|
||||
|
@ -527,7 +522,6 @@ public class MediaController implements AudioManager.OnAudioFocusChangeListener,
|
|||
photoEntry.isMuted = isMuted;
|
||||
photoEntry.canDeleteAfter = canDeleteAfter;
|
||||
photoEntry.hasSpoiler = hasSpoiler;
|
||||
photoEntry.starsAmount = starsAmount;
|
||||
photoEntry.isChatPreviewSpoilerRevealed = isChatPreviewSpoilerRevealed;
|
||||
photoEntry.isAttachSpoilerRevealed = isAttachSpoilerRevealed;
|
||||
photoEntry.emojiMarkup = emojiMarkup;
|
||||
|
@ -551,7 +545,6 @@ public class MediaController implements AudioManager.OnAudioFocusChangeListener,
|
|||
}
|
||||
}
|
||||
hasSpoiler = false;
|
||||
starsAmount = 0;
|
||||
super.reset();
|
||||
}
|
||||
|
||||
|
@ -4228,28 +4221,28 @@ public class MediaController implements AudioManager.OnAudioFocusChangeListener,
|
|||
}
|
||||
|
||||
private void stopRecordingInternal(final int send, boolean notify, int scheduleDate, boolean once) {
|
||||
if (send != 0 && recordingAudioFile != null) {
|
||||
if (send != 0) {
|
||||
final TLRPC.TL_document audioToSend = recordingAudio;
|
||||
final File recordingAudioFileToSend = recordingAudioFile;
|
||||
if (BuildVars.LOGS_ENABLED) {
|
||||
FileLog.d("stop recording internal filename " + (recordingAudioFileToSend == null ? "null" : recordingAudioFileToSend.getPath()));
|
||||
FileLog.d("stop recording internal filename " + recordingAudioFile.getPath());
|
||||
}
|
||||
fileEncodingQueue.postRunnable(() -> {
|
||||
stopRecord(false);
|
||||
if (BuildVars.LOGS_ENABLED) {
|
||||
FileLog.d("stop recording internal in queue " + (recordingAudioFileToSend == null ? "null" : recordingAudioFileToSend.exists() + " " + recordingAudioFileToSend.length()));
|
||||
FileLog.d("stop recording internal in queue " + recordingAudioFileToSend.exists() + " " + recordingAudioFileToSend.length());
|
||||
}
|
||||
AndroidUtilities.runOnUIThread(() -> {
|
||||
if (BuildVars.LOGS_ENABLED) {
|
||||
FileLog.d("stop recording internal " + (recordingAudioFileToSend == null ? "null" : recordingAudioFileToSend.exists() + " " + recordingAudioFileToSend.length() + " " + " recordTimeCount " + recordTimeCount + " writedFrames" + writedFrame));
|
||||
FileLog.d("stop recording internal " + recordingAudioFileToSend.exists() + " " + recordingAudioFileToSend.length() + " " + " recordTimeCount " + recordTimeCount + " writedFrames" + writedFrame);
|
||||
}
|
||||
boolean fileExist = recordingAudioFileToSend != null && recordingAudioFileToSend.exists();
|
||||
boolean fileExist = recordingAudioFileToSend.exists();
|
||||
if (!fileExist && BuildVars.DEBUG_VERSION) {
|
||||
FileLog.e(new RuntimeException("file not found :( recordTimeCount " + recordTimeCount + " writedFrames" + writedFrame));
|
||||
}
|
||||
MediaDataController.getInstance(recordingCurrentAccount).pushDraftVoiceMessage(recordDialogId, recordTopicId, null);
|
||||
audioToSend.date = ConnectionsManager.getInstance(recordingCurrentAccount).getCurrentTime();
|
||||
audioToSend.size = recordingAudioFileToSend == null ? 0 : (int) recordingAudioFileToSend.length();
|
||||
audioToSend.size = (int) recordingAudioFileToSend.length();
|
||||
TLRPC.TL_documentAttributeAudio attributeAudio = new TLRPC.TL_documentAttributeAudio();
|
||||
attributeAudio.voice = true;
|
||||
attributeAudio.waveform = getWaveform2(recordSamples, recordSamples.length);
|
||||
|
@ -4271,10 +4264,8 @@ public class MediaController implements AudioManager.OnAudioFocusChangeListener,
|
|||
NotificationCenter.getInstance(recordingCurrentAccount).postNotificationName(NotificationCenter.audioDidSent, recordingGuid, send == 2 ? audioToSend : null, send == 2 ? recordingAudioFileToSend.getAbsolutePath() : null);
|
||||
} else {
|
||||
NotificationCenter.getInstance(recordingCurrentAccount).postNotificationName(NotificationCenter.audioRecordTooShort, recordingGuid, false, (int) duration);
|
||||
if (recordingAudioFileToSend != null) {
|
||||
AutoDeleteMediaTask.unlockFile(recordingAudioFileToSend);
|
||||
recordingAudioFileToSend.delete();
|
||||
}
|
||||
AutoDeleteMediaTask.unlockFile(recordingAudioFileToSend);
|
||||
recordingAudioFileToSend.delete();
|
||||
}
|
||||
requestAudioFocus(false);
|
||||
});
|
||||
|
@ -4396,19 +4387,19 @@ public class MediaController implements AudioManager.OnAudioFocusChangeListener,
|
|||
path = null;
|
||||
}
|
||||
}
|
||||
if (TextUtils.isEmpty(path)) {
|
||||
// path = null;
|
||||
// TLRPC.Document document = message.getDocument();
|
||||
// if (!TextUtils.isEmpty(FileLoader.getDocumentFileName(document)) && !(message.messageOwner instanceof TLRPC.TL_message_secret) && FileLoader.canSaveAsFile(message)) {
|
||||
// String filename = FileLoader.getDocumentFileName(document);
|
||||
// File newDir = FileLoader.getDirectory(FileLoader.MEDIA_DIR_FILES);
|
||||
// if (newDir != null) {
|
||||
// path = new File(newDir, filename).getAbsolutePath();
|
||||
// }
|
||||
// }
|
||||
// if (path == null) {
|
||||
if (path == null || path.length() == 0) {
|
||||
path = null;
|
||||
TLRPC.Document document = message.getDocument();
|
||||
if (!TextUtils.isEmpty(FileLoader.getDocumentFileName(document)) && !(message.messageOwner instanceof TLRPC.TL_message_secret) && FileLoader.canSaveAsFile(message)) {
|
||||
String filename = FileLoader.getDocumentFileName(document);
|
||||
File newDir = FileLoader.getDirectory(FileLoader.MEDIA_DIR_FILES);
|
||||
if (newDir != null) {
|
||||
path = new File(newDir, filename).getAbsolutePath();
|
||||
}
|
||||
}
|
||||
if (path == null) {
|
||||
path = FileLoader.getInstance(currentAccount.getCurrentAccount()).getPathToMessage(message.messageOwner).toString();
|
||||
// }
|
||||
}
|
||||
}
|
||||
File sourceFile = new File(path);
|
||||
if (!sourceFile.exists()) {
|
||||
|
|
|
@ -7145,8 +7145,8 @@ public class MediaDataController extends BaseController {
|
|||
if (a == null && b == null) return true;
|
||||
if (a == null || b == null) return false;
|
||||
if (!TextUtils.equals(a, b)) return false;
|
||||
CharSequence[] A = new CharSequence[] { new SpannableStringBuilder(a) };
|
||||
CharSequence[] B = new CharSequence[] { new SpannableStringBuilder(b) };
|
||||
CharSequence[] A = new CharSequence[] { a };
|
||||
CharSequence[] B = new CharSequence[] { b };
|
||||
ArrayList<TLRPC.MessageEntity> ae = getInstance(UserConfig.selectedAccount).getEntities(A, true);
|
||||
ArrayList<TLRPC.MessageEntity> be = getInstance(UserConfig.selectedAccount).getEntities(B, true);
|
||||
return entitiesEqual(ae, be);
|
||||
|
@ -7185,9 +7185,8 @@ public class MediaDataController extends BaseController {
|
|||
if (allowEntity) {
|
||||
// check if it is inside a code block: do not convert __ ** || to styles inside code
|
||||
for (int i = 0; i < entities.size(); ++i) {
|
||||
final TLRPC.MessageEntity entity = entities.get(i);
|
||||
if (entity instanceof TLRPC.TL_messageEntityPre || entity instanceof TLRPC.TL_messageEntityCode) {
|
||||
if (AndroidUtilities.intersect1d(m.start() - offset, m.end() - offset, entity.offset, entity.offset + entity.length)) {
|
||||
if (entities.get(i) instanceof TLRPC.TL_messageEntityPre) {
|
||||
if (AndroidUtilities.intersect1d(m.start() - offset, m.end() - offset, entities.get(i).offset, entities.get(i).offset + entities.get(i).length)) {
|
||||
allowEntity = false;
|
||||
break;
|
||||
}
|
||||
|
@ -7292,11 +7291,11 @@ public class MediaDataController extends BaseController {
|
|||
return threads.get(threadId);
|
||||
}
|
||||
|
||||
public void saveDraft(long dialogId, int threadId, CharSequence message, ArrayList<TLRPC.MessageEntity> entities, TLRPC.Message replyToMessage, boolean noWebpage, long effectId) {
|
||||
saveDraft(dialogId, threadId, message, entities, replyToMessage, null, effectId, noWebpage, false);
|
||||
public void saveDraft(long dialogId, int threadId, CharSequence message, ArrayList<TLRPC.MessageEntity> entities, TLRPC.Message replyToMessage, boolean noWebpage) {
|
||||
saveDraft(dialogId, threadId, message, entities, replyToMessage, null, noWebpage, false);
|
||||
}
|
||||
|
||||
public void saveDraft(long dialogId, long threadId, CharSequence message, ArrayList<TLRPC.MessageEntity> entities, TLRPC.Message replyToMessage, ChatActivity.ReplyQuote quote, long effectId, boolean noWebpage, boolean clean) {
|
||||
public void saveDraft(long dialogId, long threadId, CharSequence message, ArrayList<TLRPC.MessageEntity> entities, TLRPC.Message replyToMessage, ChatActivity.ReplyQuote quote, boolean noWebpage, boolean clean) {
|
||||
TLRPC.DraftMessage draftMessage;
|
||||
if (getMessagesController().isForum(dialogId) && threadId == 0) {
|
||||
replyToMessage = null;
|
||||
|
@ -7309,10 +7308,6 @@ public class MediaDataController extends BaseController {
|
|||
draftMessage.date = (int) (System.currentTimeMillis() / 1000);
|
||||
draftMessage.message = message == null ? "" : message.toString();
|
||||
draftMessage.no_webpage = noWebpage;
|
||||
if (effectId != 0) {
|
||||
draftMessage.flags |= 128;
|
||||
draftMessage.effect = effectId;
|
||||
}
|
||||
if (replyToMessage != null) {
|
||||
draftMessage.reply_to = new TLRPC.TL_inputReplyToMessage();
|
||||
draftMessage.flags |= 16;
|
||||
|
@ -7355,14 +7350,12 @@ public class MediaDataController extends BaseController {
|
|||
sameDraft = (
|
||||
currentDraft.message.equals(draftMessage.message) &&
|
||||
replyToEquals(currentDraft.reply_to, draftMessage.reply_to) &&
|
||||
currentDraft.no_webpage == draftMessage.no_webpage &&
|
||||
currentDraft.effect == draftMessage.effect
|
||||
currentDraft.no_webpage == draftMessage.no_webpage
|
||||
);
|
||||
} else {
|
||||
sameDraft = (
|
||||
TextUtils.isEmpty(draftMessage.message) &&
|
||||
(draftMessage.reply_to == null || draftMessage.reply_to.reply_to_msg_id == 0) &&
|
||||
draftMessage.effect == 0
|
||||
(draftMessage.reply_to == null || draftMessage.reply_to.reply_to_msg_id == 0)
|
||||
);
|
||||
}
|
||||
if (sameDraft) {
|
||||
|
@ -7389,10 +7382,6 @@ public class MediaDataController extends BaseController {
|
|||
req.entities = draftMessage.entities;
|
||||
req.flags |= 8;
|
||||
}
|
||||
if ((draftMessage.flags & 128) != 0) {
|
||||
req.effect = draftMessage.effect;
|
||||
req.flags |= 128;
|
||||
}
|
||||
getConnectionsManager().sendRequest(req, (response, error) -> {
|
||||
|
||||
});
|
||||
|
@ -7707,7 +7696,7 @@ public class MediaDataController extends BaseController {
|
|||
draftMessage.reply_to.reply_to_msg_id = 0;
|
||||
}
|
||||
draftMessage.flags &= ~1;
|
||||
saveDraft(dialogId, threadId, draftMessage.message, draftMessage.entities, null, null, 0, draftMessage.no_webpage, true);
|
||||
saveDraft(dialogId, threadId, draftMessage.message, draftMessage.entities, null, null, draftMessage.no_webpage, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -15,12 +15,14 @@ import static org.telegram.messenger.MessagesController.LOAD_FORWARD;
|
|||
import static org.telegram.messenger.MessagesController.LOAD_FROM_UNREAD;
|
||||
|
||||
import android.appwidget.AppWidgetManager;
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.SystemClock;
|
||||
import android.text.SpannableStringBuilder;
|
||||
import android.text.Spanned;
|
||||
import android.text.TextUtils;
|
||||
import android.text.style.ForegroundColorSpan;
|
||||
import android.util.Log;
|
||||
import android.util.Pair;
|
||||
import android.util.SparseArray;
|
||||
import android.util.SparseIntArray;
|
||||
|
@ -28,6 +30,9 @@ import android.util.SparseIntArray;
|
|||
import androidx.annotation.UiThread;
|
||||
import androidx.collection.LongSparseArray;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
|
||||
import org.telegram.PhoneFormat.PhoneFormat;
|
||||
import org.telegram.SQLite.SQLiteCursor;
|
||||
import org.telegram.SQLite.SQLiteDatabase;
|
||||
|
@ -45,6 +50,9 @@ import org.telegram.ui.ChatActivity;
|
|||
import org.telegram.ui.Components.Reactions.ReactionsLayoutInBubble;
|
||||
import org.telegram.ui.DialogsActivity;
|
||||
import org.telegram.ui.EditWidgetActivity;
|
||||
import org.xatirchi.utils.DeletedMsg;
|
||||
import org.xatirchi.utils.EditMessage;
|
||||
import org.xatirchi.utils.WhoDeletedMsg;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
|
@ -64,6 +72,8 @@ import java.util.function.Consumer;
|
|||
|
||||
public class MessagesStorage extends BaseController {
|
||||
|
||||
private static final String TAG = "MessagesStorage";
|
||||
|
||||
private DispatchQueue storageQueue;
|
||||
private SQLiteDatabase database;
|
||||
private File cacheFile;
|
||||
|
@ -98,6 +108,7 @@ public class MessagesStorage extends BaseController {
|
|||
|
||||
private static volatile MessagesStorage[] Instance = new MessagesStorage[UserConfig.MAX_ACCOUNT_COUNT];
|
||||
private static final Object[] lockObjects = new Object[UserConfig.MAX_ACCOUNT_COUNT];
|
||||
|
||||
static {
|
||||
for (int i = 0; i < UserConfig.MAX_ACCOUNT_COUNT; i++) {
|
||||
lockObjects[i] = new Object();
|
||||
|
@ -437,7 +448,7 @@ public class MessagesStorage extends BaseController {
|
|||
return restored;
|
||||
}
|
||||
|
||||
public final static String[] DATABASE_TABLES = new String[] {
|
||||
public final static String[] DATABASE_TABLES = new String[]{
|
||||
"messages_holes",
|
||||
"media_holes_v2",
|
||||
"scheduled_messages_v2",
|
||||
|
@ -851,7 +862,7 @@ public class MessagesStorage extends BaseController {
|
|||
tryRecover = false;
|
||||
clearLoadingDialogsOffsets();
|
||||
AndroidUtilities.runOnUIThread(() -> {
|
||||
getNotificationCenter().postNotificationName(NotificationCenter.onDatabaseReset);
|
||||
getNotificationCenter().postNotificationName(NotificationCenter.onDatabaseReset);
|
||||
});
|
||||
FileLog.e(new Exception("database restored!!"));
|
||||
} else {
|
||||
|
@ -1724,11 +1735,11 @@ public class MessagesStorage extends BaseController {
|
|||
|
||||
NativeByteBuffer data2 = cursor.byteBufferValue(2);
|
||||
//if (data2 != null) {
|
||||
topic.topicStartMessage = TLRPC.Message.TLdeserialize(data2, data2.readInt32(false), false);
|
||||
if (data2 != null) {
|
||||
data2.reuse();
|
||||
}
|
||||
// }
|
||||
topic.topicStartMessage = TLRPC.Message.TLdeserialize(data2, data2.readInt32(false), false);
|
||||
if (data2 != null) {
|
||||
data2.reuse();
|
||||
}
|
||||
// }
|
||||
topic.unread_count = cursor.intValue(3);
|
||||
topic.read_inbox_max_id = cursor.intValue(4);
|
||||
topic.unread_mentions_count = cursor.intValue(5);
|
||||
|
@ -1772,9 +1783,9 @@ public class MessagesStorage extends BaseController {
|
|||
|
||||
try {
|
||||
if (message != null && message.reply_to != null && message.reply_to.reply_to_msg_id != 0 && (
|
||||
message.action instanceof TLRPC.TL_messageActionPinMessage ||
|
||||
message.action instanceof TLRPC.TL_messageActionPaymentSent ||
|
||||
message.action instanceof TLRPC.TL_messageActionGameScore
|
||||
message.action instanceof TLRPC.TL_messageActionPinMessage ||
|
||||
message.action instanceof TLRPC.TL_messageActionPaymentSent ||
|
||||
message.action instanceof TLRPC.TL_messageActionGameScore
|
||||
)) {
|
||||
if (!cursor2.isNull(2)) {
|
||||
NativeByteBuffer data2 = cursor2.byteBufferValue(2);
|
||||
|
@ -2056,7 +2067,7 @@ public class MessagesStorage extends BaseController {
|
|||
try {
|
||||
database.executeFast(String.format(Locale.US, "UPDATE topics SET read_outbox = max((SELECT read_outbox FROM topics WHERE did = %d AND topic_id = %d), %d) WHERE did = %d AND topic_id = %d", topicKey.dialogId, topicKey.topicId, value, topicKey.dialogId, topicKey.topicId)).stepThis().dispose();
|
||||
} catch (SQLiteException e) {
|
||||
checkSQLException(e);
|
||||
checkSQLException(e);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -2094,7 +2105,7 @@ public class MessagesStorage extends BaseController {
|
|||
getNotificationCenter().postNotificationName(NotificationCenter.didClearDatabase);
|
||||
getMediaDataController().loadAttachMenuBots(false, true);
|
||||
getNotificationCenter().postNotificationName(NotificationCenter.onDatabaseReset);
|
||||
|
||||
|
||||
getMessagesController().getStoriesController().cleanup();
|
||||
});
|
||||
}
|
||||
|
@ -4677,7 +4688,7 @@ public class MessagesStorage extends BaseController {
|
|||
SQLiteCursor cursor_groups = null;
|
||||
try {
|
||||
final long selfId = getUserConfig().getClientUserId();
|
||||
state = database.executeFast("SELECT m.data, m.replydata, m.group_id FROM messages_v2 m INNER JOIN tag_message_id t ON m.mid = t.mid WHERE m.uid = ? AND t.tag = ?" + (!TextUtils.isEmpty(query) ? " AND t.text LIKE '%' || ? || '%'" : "") + (topic_id != 0 ? " AND topic_id = ? " : "") + " ORDER BY m.mid DESC LIMIT ? OFFSET ?");
|
||||
state = database.executeFast("SELECT m.data, m.replydata, m.group_id FROM messages_v2 m INNER JOIN tag_message_id t ON m.mid = t.mid WHERE m.uid = ? AND t.tag = ?" + (!TextUtils.isEmpty(query) ? " AND t.text LIKE '%' || ? || '%'" : "") + (topic_id != 0 ? " AND topic_id = ? " : "") + " ORDER BY m.mid DESC LIMIT ? OFFSET ?");
|
||||
|
||||
ArrayList<TLRPC.User> users = new ArrayList<>();
|
||||
// ArrayList<TLRPC.User> encUsers = new ArrayList<>();
|
||||
|
@ -4709,7 +4720,7 @@ public class MessagesStorage extends BaseController {
|
|||
state.bindInteger(pointer++, limit);
|
||||
state.bindInteger(pointer++, offset);
|
||||
|
||||
cursor = state.query(new Object[] {});
|
||||
cursor = state.query(new Object[]{});
|
||||
state = null;
|
||||
|
||||
ArrayList<MessageObject> messageObjects = new ArrayList<>();
|
||||
|
@ -4869,6 +4880,7 @@ public class MessagesStorage extends BaseController {
|
|||
long topic_id;
|
||||
TLRPC.TL_messageReactions old;
|
||||
TLRPC.TL_messageReactions last;
|
||||
|
||||
public SavedReactionsUpdate(long selfId, TLRPC.Message oldMessage, TLRPC.Message newMessage) {
|
||||
topic_id = MessageObject.getSavedDialogId(selfId, newMessage);
|
||||
old = oldMessage.reactions;
|
||||
|
@ -5320,7 +5332,7 @@ public class MessagesStorage extends BaseController {
|
|||
cursor.dispose();
|
||||
cursor = null;
|
||||
|
||||
database.executeFast(String.format(Locale.US, "UPDATE topics SET unread_mentions = %d WHERE did = %d AND topic_id = %d",topicMentionsCount, dialogId, topicId)).stepThis().dispose();
|
||||
database.executeFast(String.format(Locale.US, "UPDATE topics SET unread_mentions = %d WHERE did = %d AND topic_id = %d", topicMentionsCount, dialogId, topicId)).stepThis().dispose();
|
||||
|
||||
getMessagesController().getTopicsController().updateMentionsUnread(dialogId, topicId, topicMentionsCount);
|
||||
}
|
||||
|
@ -6597,7 +6609,7 @@ public class MessagesStorage extends BaseController {
|
|||
} catch (Exception e) {
|
||||
checkSQLException(e);
|
||||
} finally {
|
||||
if (state != null) {
|
||||
if (state != null) {
|
||||
state.dispose();
|
||||
}
|
||||
}
|
||||
|
@ -7277,6 +7289,7 @@ public class MessagesStorage extends BaseController {
|
|||
return result[0];
|
||||
}
|
||||
|
||||
// XatirchiGetMessage
|
||||
public TLRPC.Message getMessage(long dialogId, long msgId) {
|
||||
CountDownLatch countDownLatch = new CountDownLatch(1);
|
||||
AtomicReference<TLRPC.Message> ref = new AtomicReference<>();
|
||||
|
@ -7981,7 +7994,6 @@ public class MessagesStorage extends BaseController {
|
|||
ArrayList<Long> usersToLoad = new ArrayList<>();
|
||||
ArrayList<Long> chatsToLoad = new ArrayList<>();
|
||||
ArrayList<Integer> encryptedChatIds = new ArrayList<>();
|
||||
ArrayList<TLRPC.Message> toDelete = new ArrayList<>();
|
||||
|
||||
cursor = database.queryFinalized("SELECT m.read_state, m.data, m.send_state, m.mid, m.date, r.random_id, m.uid, s.seq_in, s.seq_out, m.ttl FROM messages_v2 as m LEFT JOIN randoms_v2 as r ON r.mid = m.mid AND r.uid = m.uid LEFT JOIN messages_seq as s ON m.mid = s.mid WHERE (m.mid < 0 AND m.send_state = 1) OR (m.mid > 0 AND m.send_state = 3) ORDER BY m.mid DESC LIMIT " + count);
|
||||
while (cursor.next()) {
|
||||
|
@ -8002,11 +8014,7 @@ public class MessagesStorage extends BaseController {
|
|||
message.seq_in = cursor.intValue(7);
|
||||
message.seq_out = cursor.intValue(8);
|
||||
message.ttl = cursor.intValue(9);
|
||||
if (message.media instanceof TLRPC.TL_messageMediaPaidMedia) {
|
||||
toDelete.add(message); // TODO: actually send again
|
||||
} else {
|
||||
messages.add(message);
|
||||
}
|
||||
messages.add(message);
|
||||
messageHashMap.put(message.id, message);
|
||||
|
||||
if (DialogObject.isEncryptedDialog(message.dialog_id)) {
|
||||
|
@ -8035,12 +8043,6 @@ public class MessagesStorage extends BaseController {
|
|||
cursor.dispose();
|
||||
cursor = null;
|
||||
|
||||
if (!toDelete.isEmpty()) {
|
||||
for (TLRPC.Message msg : toDelete) {
|
||||
database.executeFast("DELETE FROM messages_v2 WHERE uid = " + msg.dialog_id + " AND mid = " + msg.id).stepThis().dispose();
|
||||
}
|
||||
}
|
||||
|
||||
cursor = database.queryFinalized("SELECT m.data, m.send_state, m.mid, m.date, r.random_id, m.uid, m.ttl FROM scheduled_messages_v2 as m LEFT JOIN randoms_v2 as r ON r.mid = m.mid AND r.uid = m.uid WHERE (m.mid < 0 AND m.send_state = 1) OR (m.mid > 0 AND m.send_state = 3) ORDER BY date ASC");
|
||||
while (cursor.next()) {
|
||||
NativeByteBuffer data = cursor.byteBufferValue(0);
|
||||
|
@ -8282,6 +8284,7 @@ public class MessagesStorage extends BaseController {
|
|||
});
|
||||
}
|
||||
|
||||
// XatirchiGetMesssages
|
||||
public Runnable getMessagesInternal(long dialogId, long mergeDialogId, int count, int max_id, int offset_date, int minDate, int classGuid, int load_type, int mode, long threadMessageId, int loadIndex, boolean processMessages, boolean isTopic, MessageLoaderLogger loaderLogger) {
|
||||
TLRPC.TL_messages_messages res = new TLRPC.TL_messages_messages();
|
||||
long currentUserId = getUserConfig().clientUserId;
|
||||
|
@ -9977,7 +9980,7 @@ public class MessagesStorage extends BaseController {
|
|||
|
||||
public boolean containsLocalDialog(long did) {
|
||||
CountDownLatch countDownLatch = new CountDownLatch(1);
|
||||
Boolean[] result = new Boolean[] { false };
|
||||
Boolean[] result = new Boolean[]{false};
|
||||
storageQueue.postRunnable(() -> {
|
||||
SQLiteCursor cursor = null;
|
||||
try {
|
||||
|
@ -10114,6 +10117,7 @@ public class MessagesStorage extends BaseController {
|
|||
});
|
||||
}
|
||||
|
||||
// XatirchiUpdate
|
||||
private void putChatsInternal(List<TLRPC.Chat> chats) throws Exception {
|
||||
if (chats == null || chats.isEmpty()) {
|
||||
return;
|
||||
|
@ -11274,7 +11278,7 @@ public class MessagesStorage extends BaseController {
|
|||
HashMap<TopicKey, ArrayList<Integer>> topicMentionsIdsMap = new HashMap<>();
|
||||
HashMap<TopicKey, Integer> topicsMentions = new HashMap<>();
|
||||
SparseArray<HashMap<TopicKey, Integer>> mediaCountsTopics = new SparseArray<>();
|
||||
HashMap<TopicKey,StringBuilder> mediaIdsMapTopics = new HashMap<>();
|
||||
HashMap<TopicKey, StringBuilder> mediaIdsMapTopics = new HashMap<>();
|
||||
HashMap<TopicKey, ArrayList<Integer>> messagesMediaIdsMapTopics = new HashMap<>();
|
||||
ArrayList<TLRPC.Message> createNewTopics = null;
|
||||
ArrayList<TLRPC.Message> changedSavedMessages = null;
|
||||
|
@ -12077,7 +12081,7 @@ public class MessagesStorage extends BaseController {
|
|||
if (old_unread_count == 0 && unread_count != 0) {
|
||||
newMessagesCounts.put(key, unread_count);
|
||||
}
|
||||
if (old_mentions_count == 0 && mentions_count != 0){
|
||||
if (old_mentions_count == 0 && mentions_count != 0) {
|
||||
newMentionsCounts.put(key, mentions_count);
|
||||
}
|
||||
}
|
||||
|
@ -12208,9 +12212,9 @@ public class MessagesStorage extends BaseController {
|
|||
}
|
||||
state_topics_update.requery();
|
||||
state_topics_update.bindInteger(1, newUnreadCount);
|
||||
state_topics_update.bindInteger(2, messageId);
|
||||
state_topics_update.bindInteger(3, newUnreadMentions);
|
||||
state_topics_update.bindInteger(4, newTotalMessagesCount);
|
||||
state_topics_update.bindInteger(2, messageId);
|
||||
state_topics_update.bindInteger(3, newUnreadMentions);
|
||||
state_topics_update.bindInteger(4, newTotalMessagesCount);
|
||||
state_topics_update.bindLong(5, topicKey.dialogId);
|
||||
state_topics_update.bindLong(6, topicKey.topicId);
|
||||
state_topics_update.step();
|
||||
|
@ -12219,7 +12223,7 @@ public class MessagesStorage extends BaseController {
|
|||
if (oldUnreadCount == 0 && newUnreadCount != 0) {
|
||||
newMessagesCounts.put(topicKey.dialogId, 1);
|
||||
}
|
||||
if (oldMentions == 0 && newUnreadMentions != 0){
|
||||
if (oldMentions == 0 && newUnreadMentions != 0) {
|
||||
newMentionsCounts.put(topicKey.dialogId, newUnreadMentions);
|
||||
}
|
||||
}
|
||||
|
@ -13083,7 +13087,53 @@ public class MessagesStorage extends BaseController {
|
|||
AndroidUtilities.runOnUIThread(() -> getNotificationCenter().postNotificationName(NotificationCenter.quickRepliesUpdated));
|
||||
}
|
||||
|
||||
// XatirchiDelete
|
||||
private ArrayList<Long> markMessagesAsDeletedInternal(long dialogId, ArrayList<Integer> messages, boolean deleteFiles, int mode, int threadMessageId) {
|
||||
|
||||
int deletedType = DeletedMsg.INSTANCE.getCheckType();
|
||||
|
||||
if (DeletedMsg.SIMPLE == deletedType) {
|
||||
|
||||
} else if (DeletedMsg.YOU == deletedType) {
|
||||
if (DeletedMsg.INSTANCE.getMyDelete()) {
|
||||
|
||||
} else {
|
||||
ArrayList<WhoDeletedMsg> deletedMsgs = DeletedMsg.INSTANCE.getAllIds();
|
||||
|
||||
for (Integer message : messages) {
|
||||
deletedMsgs.add(new WhoDeletedMsg(message, DeletedMsg.INSTANCE.getMyDelete()));
|
||||
}
|
||||
|
||||
DeletedMsg.INSTANCE.saveDeletedMessagesId(deletedMsgs);
|
||||
|
||||
messages.clear();
|
||||
}
|
||||
} else if (DeletedMsg.I == deletedType) {
|
||||
if (DeletedMsg.INSTANCE.getMyDelete()) {
|
||||
ArrayList<WhoDeletedMsg> deletedMsgs = DeletedMsg.INSTANCE.getAllIds();
|
||||
|
||||
for (Integer message : messages) {
|
||||
deletedMsgs.add(new WhoDeletedMsg(message, DeletedMsg.INSTANCE.getMyDelete()));
|
||||
}
|
||||
|
||||
DeletedMsg.INSTANCE.saveDeletedMessagesId(deletedMsgs);
|
||||
|
||||
messages.clear();
|
||||
} else {
|
||||
|
||||
}
|
||||
} else if (DeletedMsg.YOU_AND_I == deletedType) {
|
||||
ArrayList<WhoDeletedMsg> deletedMsgs = DeletedMsg.INSTANCE.getAllIds();
|
||||
|
||||
for (Integer message : messages) {
|
||||
deletedMsgs.add(new WhoDeletedMsg(message, DeletedMsg.INSTANCE.getMyDelete()));
|
||||
}
|
||||
|
||||
DeletedMsg.INSTANCE.saveDeletedMessagesId(deletedMsgs);
|
||||
|
||||
messages.clear();
|
||||
}
|
||||
|
||||
SQLiteCursor cursor = null;
|
||||
SQLitePreparedStatement state = null;
|
||||
try {
|
||||
|
@ -14256,7 +14306,7 @@ public class MessagesStorage extends BaseController {
|
|||
}
|
||||
state.bindInteger(pointer++, hole.type);
|
||||
state.bindInteger(pointer++, hole.start);
|
||||
state.bindInteger( pointer++, minId);
|
||||
state.bindInteger(pointer++, minId);
|
||||
state.step();
|
||||
state.requery();
|
||||
state.bindLong(1, did);
|
||||
|
@ -14523,7 +14573,7 @@ public class MessagesStorage extends BaseController {
|
|||
}
|
||||
|
||||
if (removeSavedPeerIdLater) {
|
||||
message.flags &=~ 268435456;
|
||||
message.flags &= ~268435456;
|
||||
message.saved_peer_id = null;
|
||||
}
|
||||
}
|
||||
|
@ -14634,6 +14684,7 @@ public class MessagesStorage extends BaseController {
|
|||
});
|
||||
}
|
||||
|
||||
// XatirchiUpdate
|
||||
// put messages in data base while load history
|
||||
public void putMessages(TLRPC.messages_Messages messages, long dialogId, int load_type, int max_id, boolean createDialog, int mode, long threadMessageId) {
|
||||
storageQueue.postRunnable(() -> {
|
||||
|
@ -14802,6 +14853,8 @@ public class MessagesStorage extends BaseController {
|
|||
if (data != null) {
|
||||
TLRPC.Message oldMessage = TLRPC.Message.TLdeserialize(data, data.readInt32(false), false);
|
||||
oldMessage.readAttachPath(data, getUserConfig().clientUserId);
|
||||
// XatirchiEditMessage
|
||||
message.message = EditMessage.INSTANCE.editMessage(oldMessage.message,message.message);
|
||||
data.reuse();
|
||||
if (reactionUpdates != null) {
|
||||
reactionUpdates.add(new SavedReactionsUpdate(selfId, oldMessage, message));
|
||||
|
@ -15027,7 +15080,7 @@ public class MessagesStorage extends BaseController {
|
|||
}
|
||||
|
||||
if (removeSavedPeerIdLater) {
|
||||
message.flags &=~ 268435456;
|
||||
message.flags &= ~268435456;
|
||||
message.saved_peer_id = null;
|
||||
}
|
||||
}
|
||||
|
@ -17208,6 +17261,7 @@ public class MessagesStorage extends BaseController {
|
|||
topicKey.topicId = topicId;
|
||||
return topicKey;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
|
|
|
@ -27,16 +27,16 @@ public class NotificationCenter {
|
|||
private static int totalEvents = 1;
|
||||
|
||||
public static final int didReceiveNewMessages = totalEvents++;
|
||||
public static final int updateInterfaces = totalEvents++;
|
||||
public static final int updateInterfaces = totalEvents++; //2
|
||||
public static final int dialogsNeedReload = totalEvents++;
|
||||
public static final int closeChats = totalEvents++;
|
||||
public static final int messagesDeleted = totalEvents++;
|
||||
public static final int messagesDeleted = totalEvents++; //5
|
||||
public static final int historyCleared = totalEvents++;
|
||||
public static final int messagesRead = totalEvents++;
|
||||
public static final int threadMessagesRead = totalEvents++;
|
||||
public static final int commentsRead = totalEvents++;
|
||||
public static final int changeRepliesCounter = totalEvents++;
|
||||
public static final int messagesDidLoad = totalEvents++;
|
||||
public static final int messagesDidLoad = totalEvents++; //11
|
||||
public static final int didLoadSponsoredMessages = totalEvents++;
|
||||
public static final int didLoadSendAsPeers = totalEvents++;
|
||||
public static final int updateDefaultSendAsPeer = totalEvents++;
|
||||
|
@ -71,7 +71,7 @@ public class NotificationCenter {
|
|||
public static final int mainUserInfoChanged = totalEvents++;
|
||||
public static final int privacyRulesUpdated = totalEvents++;
|
||||
public static final int updateMessageMedia = totalEvents++;
|
||||
public static final int replaceMessagesObjects = totalEvents++;
|
||||
public static final int replaceMessagesObjects = totalEvents++; //46
|
||||
public static final int didSetPasscode = totalEvents++;
|
||||
public static final int passcodeDismissed = totalEvents++;
|
||||
public static final int twoStepPasswordChanged = totalEvents++;
|
||||
|
@ -89,8 +89,8 @@ public class NotificationCenter {
|
|||
public static final int groupStickersDidLoad = totalEvents++;
|
||||
public static final int messagesReadContent = totalEvents++;
|
||||
public static final int botInfoDidLoad = totalEvents++;
|
||||
public static final int userInfoDidLoad = totalEvents++;
|
||||
public static final int pinnedInfoDidLoad = totalEvents++;
|
||||
public static final int userInfoDidLoad = totalEvents++; //64
|
||||
public static final int pinnedInfoDidLoad = totalEvents++; //65
|
||||
public static final int botKeyboardDidLoad = totalEvents++;
|
||||
public static final int chatSearchResultsAvailable = totalEvents++;
|
||||
public static final int hashtagSearchUpdated = totalEvents++;
|
||||
|
@ -114,7 +114,7 @@ public class NotificationCenter {
|
|||
public static final int openArticle = totalEvents++;
|
||||
public static final int articleClosed = totalEvents++;
|
||||
public static final int updateMentionsCount = totalEvents++;
|
||||
public static final int didUpdatePollResults = totalEvents++;
|
||||
public static final int didUpdatePollResults = totalEvents++; //89
|
||||
public static final int chatOnlineCountDidLoad = totalEvents++;
|
||||
public static final int videoLoadingStateChanged = totalEvents++;
|
||||
public static final int newPeopleNearbyAvailable = totalEvents++;
|
||||
|
@ -126,7 +126,7 @@ public class NotificationCenter {
|
|||
public static final int didUpdateReactions = totalEvents++;
|
||||
public static final int didUpdateExtendedMedia = totalEvents++;
|
||||
public static final int didVerifyMessagesStickers = totalEvents++;
|
||||
public static final int scheduledMessagesUpdated = totalEvents++;
|
||||
public static final int scheduledMessagesUpdated = totalEvents++; //101
|
||||
public static final int newSuggestionsAvailable = totalEvents++;
|
||||
public static final int didLoadChatInviter = totalEvents++;
|
||||
public static final int didLoadChatAdmins = totalEvents++;
|
||||
|
@ -161,7 +161,7 @@ public class NotificationCenter {
|
|||
public static final int httpFileDidLoad = totalEvents++;
|
||||
public static final int httpFileDidFailedLoad = totalEvents++;
|
||||
|
||||
public static final int didUpdateConnectionState = totalEvents++;
|
||||
public static final int didUpdateConnectionState = totalEvents++; //130
|
||||
|
||||
public static final int fileUploaded = totalEvents++;
|
||||
public static final int fileUploadFailed = totalEvents++;
|
||||
|
@ -253,9 +253,6 @@ public class NotificationCenter {
|
|||
public static final int starBalanceUpdated = totalEvents++;
|
||||
public static final int starTransactionsLoaded = totalEvents++;
|
||||
public static final int factCheckLoaded = totalEvents++;
|
||||
public static final int botStarsUpdated = totalEvents++;
|
||||
public static final int botStarsTransactionsLoaded = totalEvents++;
|
||||
public static final int channelStarsUpdated = totalEvents++;
|
||||
|
||||
//global
|
||||
public static final int pushMessagesUpdated = totalEvents++;
|
||||
|
@ -336,6 +333,7 @@ public class NotificationCenter {
|
|||
public static final int onReceivedChannelDifference = totalEvents++;
|
||||
public static final int storiesReadUpdated = totalEvents++;
|
||||
public static final int nearEarEvent = totalEvents++;
|
||||
public static final int forSetTextToTextView = totalEvents++;
|
||||
|
||||
public static boolean alreadyLogged;
|
||||
|
||||
|
|
|
@ -73,7 +73,6 @@ import org.telegram.ui.Components.AvatarDrawable;
|
|||
import org.telegram.ui.Components.spoilers.SpoilerEffect;
|
||||
import org.telegram.ui.LaunchActivity;
|
||||
import org.telegram.ui.PopupNotificationActivity;
|
||||
import org.telegram.ui.Stars.StarsIntroActivity;
|
||||
import org.telegram.ui.Stories.recorder.StoryEntry;
|
||||
|
||||
import java.io.File;
|
||||
|
@ -1785,7 +1784,7 @@ public class NotificationsController extends BaseController {
|
|||
} else if (messageObject.messageOwner.action instanceof TLRPC.TL_messageActionUserUpdatedPhoto) {
|
||||
return LocaleController.formatString("NotificationContactNewPhoto", R.string.NotificationContactNewPhoto, name);
|
||||
} else if (messageObject.messageOwner.action instanceof TLRPC.TL_messageActionLoginUnknownLocation) {
|
||||
String date = LocaleController.formatString("formatDateAtTime", R.string.formatDateAtTime, LocaleController.getInstance().getFormatterYear().format(((long) messageObject.messageOwner.date) * 1000), LocaleController.getInstance().getFormatterDay().format(((long) messageObject.messageOwner.date) * 1000));
|
||||
String date = LocaleController.formatString("formatDateAtTime", R.string.formatDateAtTime, LocaleController.getInstance().formatterYear.format(((long) messageObject.messageOwner.date) * 1000), LocaleController.getInstance().formatterDay.format(((long) messageObject.messageOwner.date) * 1000));
|
||||
return LocaleController.formatString("NotificationUnrecognizedDevice", R.string.NotificationUnrecognizedDevice, getUserConfig().getCurrentUser().first_name, date, messageObject.messageOwner.action.title, messageObject.messageOwner.action.address);
|
||||
} else if (messageObject.messageOwner.action instanceof TLRPC.TL_messageActionGameScore || messageObject.messageOwner.action instanceof TLRPC.TL_messageActionPaymentSent) {
|
||||
return messageObject.messageText.toString();
|
||||
|
@ -2151,21 +2150,6 @@ public class NotificationsController extends BaseController {
|
|||
} else {
|
||||
return LocaleController.getString("Message", R.string.Message);
|
||||
}
|
||||
} else if (messageObject.type == MessageObject.TYPE_PAID_MEDIA && MessageObject.getMedia(messageObject) instanceof TLRPC.TL_messageMediaPaidMedia) {
|
||||
TLRPC.TL_messageMediaPaidMedia paidMedia = (TLRPC.TL_messageMediaPaidMedia) MessageObject.getMedia(messageObject);
|
||||
final int count = paidMedia.extended_media.size();
|
||||
boolean video = false;
|
||||
for (int i = 0; i < count; ++i) {
|
||||
TLRPC.MessageExtendedMedia emedia = paidMedia.extended_media.get(i);
|
||||
if (emedia instanceof TLRPC.TL_messageExtendedMedia) {
|
||||
video = ((TLRPC.TL_messageExtendedMedia) emedia).media instanceof TLRPC.TL_messageMediaDocument &&
|
||||
MessageObject.isVideoDocument(((TLRPC.TL_messageExtendedMedia) emedia).media.document);
|
||||
} else if (emedia instanceof TLRPC.TL_messageExtendedMediaPreview) {
|
||||
video = (((TLRPC.TL_messageExtendedMediaPreview) emedia).flags & 4) != 0;
|
||||
}
|
||||
if (video) break;
|
||||
}
|
||||
return LocaleController.formatString(R.string.AttachPaidMedia, count == 1 ? LocaleController.getString(video ? R.string.AttachVideo : R.string.AttachPhoto) : LocaleController.formatPluralString(video ? "Media" : "Photos", count));
|
||||
} else if (messageObject.isVoiceOnce()) {
|
||||
return LocaleController.getString(R.string.AttachOnceAudio);
|
||||
} else if (messageObject.isRoundOnce()) {
|
||||
|
@ -2384,7 +2368,7 @@ public class NotificationsController extends BaseController {
|
|||
} else if (messageObject.messageOwner.action instanceof TLRPC.TL_messageActionUserUpdatedPhoto) {
|
||||
msg = LocaleController.formatString("NotificationContactNewPhoto", R.string.NotificationContactNewPhoto, name);
|
||||
} else if (messageObject.messageOwner.action instanceof TLRPC.TL_messageActionLoginUnknownLocation) {
|
||||
String date = LocaleController.formatString("formatDateAtTime", R.string.formatDateAtTime, LocaleController.getInstance().getFormatterYear().format(((long) messageObject.messageOwner.date) * 1000), LocaleController.getInstance().getFormatterDay().format(((long) messageObject.messageOwner.date) * 1000));
|
||||
String date = LocaleController.formatString("formatDateAtTime", R.string.formatDateAtTime, LocaleController.getInstance().formatterYear.format(((long) messageObject.messageOwner.date) * 1000), LocaleController.getInstance().formatterDay.format(((long) messageObject.messageOwner.date) * 1000));
|
||||
msg = LocaleController.formatString("NotificationUnrecognizedDevice", R.string.NotificationUnrecognizedDevice, getUserConfig().getCurrentUser().first_name, date, messageObject.messageOwner.action.title, messageObject.messageOwner.action.address);
|
||||
} else if (messageObject.messageOwner.action instanceof TLRPC.TL_messageActionGameScore || messageObject.messageOwner.action instanceof TLRPC.TL_messageActionPaymentSent) {
|
||||
msg = messageObject.messageText.toString();
|
||||
|
@ -2803,9 +2787,6 @@ public class NotificationsController extends BaseController {
|
|||
} else {
|
||||
msg = LocaleController.formatString("ChannelMessageNoText", R.string.ChannelMessageNoText, name);
|
||||
}
|
||||
} else if (messageObject.type == MessageObject.TYPE_PAID_MEDIA && MessageObject.getMedia(messageObject) instanceof TLRPC.TL_messageMediaPaidMedia) {
|
||||
TLRPC.TL_messageMediaPaidMedia paidMedia = (TLRPC.TL_messageMediaPaidMedia) MessageObject.getMedia(messageObject);
|
||||
msg = LocaleController.formatPluralString("NotificationChannelMessagePaidMedia", (int) paidMedia.stars_amount, chat.title);
|
||||
} else if (messageObject.messageOwner.media instanceof TLRPC.TL_messageMediaPhoto) {
|
||||
if (!shortMessage && Build.VERSION.SDK_INT >= 19 && !TextUtils.isEmpty(messageObject.messageOwner.message)) {
|
||||
msg = LocaleController.formatString("NotificationMessageText", R.string.NotificationMessageText, name, "\uD83D\uDDBC " + messageObject.messageOwner.message);
|
||||
|
@ -2881,9 +2862,6 @@ public class NotificationsController extends BaseController {
|
|||
} else {
|
||||
msg = LocaleController.formatString("NotificationMessageGroupNoText", R.string.NotificationMessageGroupNoText, name, chat.title);
|
||||
}
|
||||
} else if (messageObject.type == MessageObject.TYPE_PAID_MEDIA && MessageObject.getMedia(messageObject) instanceof TLRPC.TL_messageMediaPaidMedia) {
|
||||
TLRPC.TL_messageMediaPaidMedia paidMedia = (TLRPC.TL_messageMediaPaidMedia) MessageObject.getMedia(messageObject);
|
||||
msg = LocaleController.formatPluralString("NotificationChatMessagePaidMedia", (int) paidMedia.stars_amount, name, chat.title);
|
||||
} else if (messageObject.messageOwner.media instanceof TLRPC.TL_messageMediaPhoto) {
|
||||
if (!shortMessage && Build.VERSION.SDK_INT >= 19 && !TextUtils.isEmpty(messageObject.messageOwner.message)) {
|
||||
msg = LocaleController.formatString("NotificationMessageGroupText", R.string.NotificationMessageGroupText, name, chat.title, "\uD83D\uDDBC " + messageObject.messageOwner.message);
|
||||
|
@ -2958,9 +2936,6 @@ public class NotificationsController extends BaseController {
|
|||
}
|
||||
if (ChatObject.isChannel(chat) && !chat.megagroup) {
|
||||
msg = LocaleController.formatString("ChannelMessageNoText", R.string.ChannelMessageNoText, name);
|
||||
} else if (messageObject.type == MessageObject.TYPE_PAID_MEDIA && MessageObject.getMedia(messageObject) instanceof TLRPC.TL_messageMediaPaidMedia) {
|
||||
TLRPC.TL_messageMediaPaidMedia paidMedia = (TLRPC.TL_messageMediaPaidMedia) MessageObject.getMedia(messageObject);
|
||||
msg = LocaleController.formatPluralString("NotificationMessagePaidMedia", (int) paidMedia.stars_amount, name);
|
||||
} else {
|
||||
msg = LocaleController.formatString("NotificationMessageGroupNoText", R.string.NotificationMessageGroupNoText, name, chat.title);
|
||||
}
|
||||
|
|
|
@ -215,9 +215,6 @@ public class PushListenerController {
|
|||
countDownLatch.countDown();
|
||||
return;
|
||||
}
|
||||
if (BuildVars.LOGS_ENABLED) {
|
||||
FileLog.d(tag + " " + loc_key);
|
||||
}
|
||||
switch (loc_key) {
|
||||
case "DC_UPDATE": {
|
||||
int dc = custom.getInt("dc");
|
||||
|
@ -498,36 +495,6 @@ public class PushListenerController {
|
|||
message1 = args[1];
|
||||
break;
|
||||
}
|
||||
case "MESSAGE_PAID_MEDIA": {
|
||||
int stars = Integer.parseInt(args[1]);
|
||||
messageText = LocaleController.formatPluralString("NotificationMessagePaidMedia", stars, args[0]);
|
||||
message1 = LocaleController.formatPluralString("NotificationPaidMedia", stars);
|
||||
break;
|
||||
}
|
||||
case "CHANNEL_MESSAGE_PAID_MEDIA": {
|
||||
int stars = Integer.parseInt(args[1]);
|
||||
messageText = LocaleController.formatPluralString("NotificationChannelMessagePaidMedia", stars, args[0]);
|
||||
message1 = LocaleController.formatPluralString("NotificationPaidMedia", stars);
|
||||
break;
|
||||
}
|
||||
case "CHAT_MESSAGE_PAID_MEDIA": {
|
||||
int stars = Integer.parseInt(args[2]);
|
||||
messageText = LocaleController.formatPluralString("NotificationChatMessagePaidMedia", stars, args[0], args[1]);
|
||||
message1 = LocaleController.formatPluralString("NotificationPaidMedia", stars);
|
||||
break;
|
||||
}
|
||||
case "PINNED_PAID_MEDIA": {
|
||||
int stars = Integer.parseInt(args[1]);
|
||||
messageText = LocaleController.formatPluralString("NotificationPinnedPaidMedia", stars, args[0]);
|
||||
message1 = LocaleController.formatPluralString("NotificationPinnedPaidMedia", stars, args[0]);
|
||||
break;
|
||||
}
|
||||
case "CHAT_REACT_PAID_MEDIA": {
|
||||
int stars = Integer.parseInt(args[1]);
|
||||
messageText = LocaleController.formatPluralString("NotificationPinnedPaidMedia", stars, args[0]);
|
||||
message1 = LocaleController.formatPluralString("NotificationPinnedPaidMedia", stars, args[0]);
|
||||
break;
|
||||
}
|
||||
case "MESSAGE_NOTEXT": {
|
||||
messageText = LocaleController.formatString("NotificationMessageNoText", R.string.NotificationMessageNoText, args[0]);
|
||||
message1 = LocaleController.getString("Message", R.string.Message);
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -313,7 +313,6 @@ public class SharedConfig {
|
|||
public static int emojiInteractionsHintCount;
|
||||
public static int dayNightThemeSwitchHintCount;
|
||||
public static int callEncryptionHintDisplayedCount;
|
||||
public static boolean botTabs3DEffect;
|
||||
|
||||
public static TLRPC.TL_help_appUpdate pendingAppUpdate;
|
||||
public static int pendingAppUpdateBuildVersion;
|
||||
|
@ -647,13 +646,12 @@ public class SharedConfig {
|
|||
dayNightWallpaperSwitchHint = preferences.getInt("dayNightWallpaperSwitchHint", 0);
|
||||
bigCameraForRound = preferences.getBoolean("bigCameraForRound", false);
|
||||
useNewBlur = preferences.getBoolean("useNewBlur", true);
|
||||
useCamera2Force = !preferences.contains("useCamera2Force_2") ? null : preferences.getBoolean("useCamera2Force_2", false);
|
||||
useCamera2Force = !preferences.contains("useCamera2Force") ? null : preferences.getBoolean("useCamera2Force", false);
|
||||
useSurfaceInStories = preferences.getBoolean("useSurfaceInStories", Build.VERSION.SDK_INT >= 30);
|
||||
payByInvoice = preferences.getBoolean("payByInvoice", false);
|
||||
photoViewerBlur = preferences.getBoolean("photoViewerBlur", true);
|
||||
multipleReactionsPromoShowed = preferences.getBoolean("multipleReactionsPromoShowed", false);
|
||||
callEncryptionHintDisplayedCount = preferences.getInt("callEncryptionHintDisplayedCount", 0);
|
||||
botTabs3DEffect = preferences.getBoolean("botTabs3DEffect", true);
|
||||
|
||||
loadDebugConfig(preferences);
|
||||
|
||||
|
@ -1083,13 +1081,6 @@ public class SharedConfig {
|
|||
editor.apply();
|
||||
}
|
||||
|
||||
public static void setBotTabs3DEffect(boolean value) {
|
||||
SharedPreferences preferences = MessagesController.getGlobalMainSettings();
|
||||
SharedPreferences.Editor editor = preferences.edit();
|
||||
editor.putBoolean("botTabs3DEffect", botTabs3DEffect = value);
|
||||
editor.apply();
|
||||
}
|
||||
|
||||
public static void toggleLoopStickers() {
|
||||
LiteMode.toggleFlag(LiteMode.FLAG_ANIMATED_STICKERS_CHAT);
|
||||
}
|
||||
|
@ -1766,7 +1757,7 @@ public class SharedConfig {
|
|||
public static void toggleUseCamera2(int currentAccount) {
|
||||
ApplicationLoader.applicationContext.getSharedPreferences("mainconfig", Activity.MODE_PRIVATE)
|
||||
.edit()
|
||||
.putBoolean("useCamera2Force_2", useCamera2Force = !isUsingCamera2(currentAccount))
|
||||
.putBoolean("useCamera2", useCamera2Force = !isUsingCamera2(currentAccount))
|
||||
.apply();
|
||||
}
|
||||
|
||||
|
|
|
@ -4,7 +4,6 @@ import android.content.Context;
|
|||
import android.content.res.Resources;
|
||||
import android.icu.text.Collator;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.inputmethod.InputMethodInfo;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.view.inputmethod.InputMethodSubtype;
|
||||
|
@ -241,7 +240,6 @@ public class TranslateController extends BaseController {
|
|||
synchronized (this) {
|
||||
if (hidden) {
|
||||
hideTranslateDialogs.add(dialogId);
|
||||
translatingDialogs.remove(dialogId);
|
||||
} else {
|
||||
hideTranslateDialogs.remove(dialogId);
|
||||
}
|
||||
|
@ -277,7 +275,6 @@ public class TranslateController extends BaseController {
|
|||
synchronized (this) {
|
||||
if (hide) {
|
||||
hideTranslateDialogs.add(dialogId);
|
||||
translatingDialogs.remove(dialogId);
|
||||
} else {
|
||||
hideTranslateDialogs.remove(dialogId);
|
||||
}
|
||||
|
@ -501,10 +498,6 @@ public class TranslateController extends BaseController {
|
|||
return;
|
||||
}
|
||||
|
||||
if (isTranslateDialogHidden(dialogId)) {
|
||||
return;
|
||||
}
|
||||
|
||||
final String language = getDialogTranslateTo(dialogId);
|
||||
MessageObject potentialReplyMessageObject;
|
||||
if (!keepReply && (messageObject.messageOwner.translatedText == null || !language.equals(messageObject.messageOwner.translatedToLanguage)) && (potentialReplyMessageObject = findReplyMessageObject(dialogId, messageObject.getId())) != null) {
|
||||
|
@ -832,9 +825,6 @@ public class TranslateController extends BaseController {
|
|||
toggleTranslatingDialog(dialogId, false);
|
||||
NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.showBulletin, Bulletin.TYPE_ERROR, LocaleController.getString("TranslationFailedAlert2", R.string.TranslationFailedAlert2));
|
||||
} else {
|
||||
if (err != null && "QUOTA_EXCEEDED".equals(err.text)) {
|
||||
NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.showBulletin, Bulletin.TYPE_ERROR, LocaleController.getString(R.string.TranslationFailedAlert1));
|
||||
}
|
||||
for (int i = 0; i < callbacks.size(); ++i) {
|
||||
callbacks.get(i).run(ids.get(i), null, pendingTranslation1.language);
|
||||
}
|
||||
|
|
|
@ -28,8 +28,8 @@ import java.util.List;
|
|||
public class UserConfig extends BaseController {
|
||||
|
||||
public static int selectedAccount;
|
||||
public final static int MAX_ACCOUNT_DEFAULT_COUNT = 3;
|
||||
public final static int MAX_ACCOUNT_COUNT = 4;
|
||||
public final static int MAX_ACCOUNT_DEFAULT_COUNT = 4;
|
||||
public final static int MAX_ACCOUNT_COUNT = 5;
|
||||
|
||||
private final Object sync = new Object();
|
||||
private volatile boolean configLoaded;
|
||||
|
|
|
@ -473,10 +473,6 @@ public class Utilities {
|
|||
return Math.max(Math.min(value, maxValue), minValue);
|
||||
}
|
||||
|
||||
public static float clamp01(float value) {
|
||||
return clamp(value, 1f, 0f);
|
||||
}
|
||||
|
||||
public static double clamp(double value, double maxValue, double minValue) {
|
||||
if (Double.isNaN(value)) {
|
||||
return minValue;
|
||||
|
|
|
@ -11,6 +11,7 @@ package org.telegram.messenger;
|
|||
import android.graphics.Bitmap;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Matrix;
|
||||
import android.graphics.RectF;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
|
||||
|
@ -21,7 +22,6 @@ import org.telegram.tgnet.TLRPC;
|
|||
import org.telegram.tgnet.tl.TL_stories;
|
||||
import org.telegram.ui.Components.AnimatedFileDrawable;
|
||||
import org.telegram.ui.Components.Paint.PaintTypeface;
|
||||
import org.telegram.ui.Components.Paint.Views.LinkPreview;
|
||||
import org.telegram.ui.Components.PhotoFilterView;
|
||||
import org.telegram.ui.Components.Point;
|
||||
import org.telegram.ui.Components.Reactions.ReactionsLayoutInBubble;
|
||||
|
@ -126,7 +126,6 @@ public class VideoEditedInfo {
|
|||
public static final byte TYPE_REACTION = 4;
|
||||
public static final byte TYPE_ROUND = 5;
|
||||
public static final byte TYPE_MESSAGE = 6;
|
||||
public static final byte TYPE_LINK = 7;
|
||||
|
||||
public byte type;
|
||||
public byte subType;
|
||||
|
@ -174,7 +173,7 @@ public class VideoEditedInfo {
|
|||
public boolean firstSeek;
|
||||
|
||||
public TL_stories.MediaArea mediaArea;
|
||||
public TLRPC.MessageMedia media;
|
||||
public TLRPC.MessageMedia mediaGeo;
|
||||
public float density;
|
||||
|
||||
public long roundOffset;
|
||||
|
@ -185,8 +184,6 @@ public class VideoEditedInfo {
|
|||
public int W, H;
|
||||
public ReactionsLayoutInBubble.VisibleReaction visibleReaction;
|
||||
|
||||
public LinkPreview.WebPagePreview linkSettings;
|
||||
|
||||
public MediaEntity() {
|
||||
|
||||
}
|
||||
|
@ -232,28 +229,27 @@ public class VideoEditedInfo {
|
|||
if (type == TYPE_LOCATION) {
|
||||
density = data.readFloat(exception);
|
||||
mediaArea = TL_stories.MediaArea.TLdeserialize(data, data.readInt32(exception), exception);
|
||||
media = TLRPC.MessageMedia.TLdeserialize(data, data.readInt32(exception), exception);
|
||||
mediaGeo = TLRPC.MessageMedia.TLdeserialize(data, data.readInt32(exception), exception);
|
||||
if (data.remaining() > 0) {
|
||||
int magic = data.readInt32(exception);
|
||||
if (magic == 0xdeadbeef) {
|
||||
String emoji = data.readString(exception);
|
||||
if (media instanceof TLRPC.TL_messageMediaVenue) {
|
||||
((TLRPC.TL_messageMediaVenue) media).emoji = emoji;
|
||||
if (mediaGeo instanceof TLRPC.TL_messageMediaVenue) {
|
||||
((TLRPC.TL_messageMediaVenue) mediaGeo).emoji = emoji;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (type == TYPE_LINK) {
|
||||
density = data.readFloat(exception);
|
||||
}
|
||||
if (type == TYPE_REACTION) {
|
||||
mediaArea = TL_stories.MediaArea.TLdeserialize(data, data.readInt32(exception), exception);
|
||||
linkSettings = LinkPreview.WebPagePreview.TLdeserialize(data, data.readInt32(exception), exception);
|
||||
} else if (type == TYPE_REACTION) {
|
||||
mediaArea = TL_stories.MediaArea.TLdeserialize(data, data.readInt32(exception), exception);
|
||||
} else if (type == TYPE_ROUND) {
|
||||
}
|
||||
if (type == TYPE_ROUND) {
|
||||
roundOffset = data.readInt64(exception);
|
||||
roundLeft = data.readInt64(exception);
|
||||
roundRight = data.readInt64(exception);
|
||||
roundDuration = data.readInt64(exception);
|
||||
} else if (type == TYPE_PHOTO) {
|
||||
}
|
||||
if (type == TYPE_PHOTO) {
|
||||
segmentedPath = data.readString(exception);
|
||||
}
|
||||
}
|
||||
|
@ -292,34 +288,33 @@ public class VideoEditedInfo {
|
|||
if (type == TYPE_LOCATION) {
|
||||
data.writeFloat(density);
|
||||
mediaArea.serializeToStream(data);
|
||||
if (media.provider == null) {
|
||||
media.provider = "";
|
||||
if (mediaGeo.provider == null) {
|
||||
mediaGeo.provider = "";
|
||||
}
|
||||
if (media.venue_id == null) {
|
||||
media.venue_id = "";
|
||||
if (mediaGeo.venue_id == null) {
|
||||
mediaGeo.venue_id = "";
|
||||
}
|
||||
if (media.venue_type == null) {
|
||||
media.venue_type = "";
|
||||
if (mediaGeo.venue_type == null) {
|
||||
mediaGeo.venue_type = "";
|
||||
}
|
||||
media.serializeToStream(data);
|
||||
if (media instanceof TLRPC.TL_messageMediaVenue && ((TLRPC.TL_messageMediaVenue) media).emoji != null) {
|
||||
mediaGeo.serializeToStream(data);
|
||||
if (mediaGeo instanceof TLRPC.TL_messageMediaVenue && ((TLRPC.TL_messageMediaVenue) mediaGeo).emoji != null) {
|
||||
data.writeInt32(0xdeadbeef);
|
||||
data.writeString(((TLRPC.TL_messageMediaVenue) media).emoji);
|
||||
data.writeString(((TLRPC.TL_messageMediaVenue) mediaGeo).emoji);
|
||||
} else {
|
||||
data.writeInt32(TLRPC.TL_null.constructor);
|
||||
}
|
||||
} else if (type == TYPE_LINK) {
|
||||
data.writeFloat(density);
|
||||
}
|
||||
if (type == TYPE_REACTION) {
|
||||
mediaArea.serializeToStream(data);
|
||||
linkSettings.serializeToStream(data);
|
||||
} else if (type == TYPE_REACTION) {
|
||||
mediaArea.serializeToStream(data);
|
||||
} else if (type == TYPE_ROUND) {
|
||||
}
|
||||
if (type == TYPE_ROUND) {
|
||||
data.writeInt64(roundOffset);
|
||||
data.writeInt64(roundLeft);
|
||||
data.writeInt64(roundRight);
|
||||
data.writeInt64(roundDuration);
|
||||
} else if (type == TYPE_PHOTO) {
|
||||
}
|
||||
if (type == TYPE_PHOTO) {
|
||||
data.writeString(segmentedPath);
|
||||
}
|
||||
}
|
||||
|
@ -364,7 +359,7 @@ public class VideoEditedInfo {
|
|||
entity.animatedFileDrawable = animatedFileDrawable;
|
||||
entity.roundRadiusCanvas = roundRadiusCanvas;
|
||||
entity.mediaArea = mediaArea;
|
||||
entity.media = media;
|
||||
entity.mediaGeo = mediaGeo;
|
||||
entity.density = density;
|
||||
entity.W = W;
|
||||
entity.H = H;
|
||||
|
@ -373,7 +368,6 @@ public class VideoEditedInfo {
|
|||
entity.roundDuration = roundDuration;
|
||||
entity.roundLeft = roundLeft;
|
||||
entity.roundRight = roundRight;
|
||||
entity.linkSettings = linkSettings;
|
||||
return entity;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,7 +13,6 @@ import android.app.PendingIntent;
|
|||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.pm.ResolveInfo;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.net.Uri;
|
||||
|
@ -49,7 +48,6 @@ import org.telegram.ui.LaunchActivity;
|
|||
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.regex.Matcher;
|
||||
|
||||
|
@ -239,26 +237,20 @@ public class Browser {
|
|||
}
|
||||
|
||||
public static void openUrl(final Context context, Uri uri, final boolean allowCustom, boolean tryTelegraph) {
|
||||
openUrl(context, uri, allowCustom, tryTelegraph, false, null, null);
|
||||
openUrl(context, uri, allowCustom, tryTelegraph, false, null);
|
||||
}
|
||||
|
||||
public static void openUrl(final Context context, Uri uri, final boolean allowCustom, boolean tryTelegraph, Progress inCaseLoading) {
|
||||
openUrl(context, uri, allowCustom, tryTelegraph, false, inCaseLoading, null);
|
||||
openUrl(context, uri, allowCustom, tryTelegraph, false, inCaseLoading);
|
||||
}
|
||||
|
||||
public static void openUrl(final Context context, Uri uri, boolean _allowCustom, boolean tryTelegraph, boolean forceNotInternalForApps, Progress inCaseLoading, String browser) {
|
||||
public static void openUrl(final Context context, Uri uri, final boolean allowCustom, boolean tryTelegraph, boolean forceNotInternalForApps, Progress inCaseLoading) {
|
||||
if (context == null || uri == null) {
|
||||
return;
|
||||
}
|
||||
final int currentAccount = UserConfig.selectedAccount;
|
||||
boolean[] forceBrowser = new boolean[]{false};
|
||||
boolean internalUri = isInternalUri(uri, forceBrowser);
|
||||
String browserPackage = getBrowserPackageName(browser);
|
||||
if (browserPackage != null) {
|
||||
tryTelegraph = false;
|
||||
_allowCustom = false;
|
||||
}
|
||||
final boolean allowCustom = _allowCustom;
|
||||
if (tryTelegraph) {
|
||||
try {
|
||||
String host = AndroidUtilities.getHostAuthority(uri);
|
||||
|
@ -421,25 +413,13 @@ public class Browser {
|
|||
ComponentName componentName = new ComponentName(context.getPackageName(), LaunchActivity.class.getName());
|
||||
intent.setComponent(componentName);
|
||||
}
|
||||
if (!TextUtils.isEmpty(browserPackage)) {
|
||||
intent.setPackage(browserPackage);
|
||||
}
|
||||
intent.putExtra(android.provider.Browser.EXTRA_CREATE_NEW_TAB, true);
|
||||
intent.putExtra(android.provider.Browser.EXTRA_APPLICATION_ID, context.getPackageName());
|
||||
if (internalUri && context instanceof LaunchActivity) {
|
||||
intent.putExtra(LaunchActivity.EXTRA_FORCE_NOT_INTERNAL_APPS, forceNotInternalForApps);
|
||||
((LaunchActivity) context).onNewIntent(intent, inCaseLoading);
|
||||
} else {
|
||||
try {
|
||||
context.startActivity(intent);
|
||||
} catch (Exception e2) {
|
||||
if (browserPackage != null) {
|
||||
intent.setPackage(browserPackage = null);
|
||||
context.startActivity(intent);
|
||||
} else {
|
||||
FileLog.e(e2);
|
||||
}
|
||||
}
|
||||
context.startActivity(intent);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
FileLog.e(e);
|
||||
|
@ -555,47 +535,7 @@ public class Browser {
|
|||
return false;
|
||||
}
|
||||
|
||||
public static String getBrowserPackageName(String browser) {
|
||||
if (browser == null) return null;
|
||||
switch (browser) {
|
||||
case "google-chrome":
|
||||
case "chrome":
|
||||
return "com.android.chrome";
|
||||
case "mozilla-firefox":
|
||||
case "firefox":
|
||||
return "org.mozilla.firefox";
|
||||
case "microsoft-edge":
|
||||
case "edge":
|
||||
return "com.microsoft.emmx";
|
||||
case "opera":
|
||||
return "com.opera.browser";
|
||||
case "opera-mini":
|
||||
return "com.opera.mini.native";
|
||||
case "brave":
|
||||
case "brave-browser":
|
||||
return "com.brave.browser";
|
||||
case "duckduckgo":
|
||||
case "duckduckgo-browser":
|
||||
return "com.duckduckgo.mobile.android";
|
||||
case "samsung":
|
||||
case "samsung-browser":
|
||||
return "com.sec.android.app.sbrowser";
|
||||
case "vivaldi":
|
||||
case "vivaldi-browser":
|
||||
return "com.vivaldi.browser";
|
||||
case "kiwi":
|
||||
case "kiwi-browser":
|
||||
return "com.kiwibrowser.browser";
|
||||
case "uc":
|
||||
case "uc-browser":
|
||||
return "com.UCMobile.intl";
|
||||
case "tor":
|
||||
case "tor-browser":
|
||||
return "org.torproject.torbrowser";
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
// © ChatGPT. All puns reserved. 🤖📜
|
||||
public static String replaceHostname(Uri originalUri, String newHostname) {
|
||||
String scheme = originalUri.getScheme();
|
||||
String userInfo = originalUri.getUserInfo();
|
||||
|
|
|
@ -62,6 +62,7 @@ public class BillingUtilities {
|
|||
serializedData.cleanup();
|
||||
if (
|
||||
paymentPurpose instanceof TLRPC.TL_inputStorePaymentPremiumGiftCode ||
|
||||
paymentPurpose instanceof TLRPC.TL_inputStorePaymentStars ||
|
||||
paymentPurpose instanceof TLRPC.TL_inputStorePaymentPremiumGiveaway
|
||||
) {
|
||||
remPaymentPurpose = paymentPurpose;
|
||||
|
@ -106,7 +107,7 @@ public class BillingUtilities {
|
|||
purpose = TLRPC.InputStorePaymentPurpose.TLdeserialize(data, data.readInt32(true), true);
|
||||
data.cleanup();
|
||||
} catch (Exception e) {
|
||||
FileLog.e("Billing: Extract payload, no remPaymentPurpose; failed to get purpose", e);
|
||||
FileLog.e(e);
|
||||
purpose = null;
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -68,7 +68,6 @@ import org.telegram.ui.Components.CubicBezierInterpolator;
|
|||
import org.telegram.ui.Components.EditTextEffects;
|
||||
import org.telegram.ui.Components.FilterShaders;
|
||||
import org.telegram.ui.Components.Paint.Views.EditTextOutline;
|
||||
import org.telegram.ui.Components.Paint.Views.LinkPreview;
|
||||
import org.telegram.ui.Components.Paint.Views.LocationMarker;
|
||||
import org.telegram.ui.Components.Paint.Views.PaintTextOptionsView;
|
||||
import org.telegram.ui.Components.RLottieDrawable;
|
||||
|
@ -1211,8 +1210,6 @@ public class TextureRenderer {
|
|||
initTextEntity(entity);
|
||||
} else if (entity.type == VideoEditedInfo.MediaEntity.TYPE_LOCATION) {
|
||||
initLocationEntity(entity);
|
||||
} else if (entity.type == VideoEditedInfo.MediaEntity.TYPE_LINK) {
|
||||
initLinkEntity(entity);
|
||||
}
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
|
@ -1342,7 +1339,7 @@ public class TextureRenderer {
|
|||
}
|
||||
|
||||
private void initLocationEntity(VideoEditedInfo.MediaEntity entity) {
|
||||
LocationMarker marker = new LocationMarker(ApplicationLoader.applicationContext, entity.density, 0);
|
||||
LocationMarker marker = new LocationMarker(ApplicationLoader.applicationContext, entity.density);
|
||||
marker.setText(entity.text);
|
||||
marker.setType(entity.subType, entity.color);
|
||||
marker.setMaxWidth(entity.viewWidth);
|
||||
|
@ -1394,25 +1391,6 @@ public class TextureRenderer {
|
|||
}
|
||||
}
|
||||
|
||||
private void initLinkEntity(VideoEditedInfo.MediaEntity entity) {
|
||||
LinkPreview marker = new LinkPreview(ApplicationLoader.applicationContext, entity.density);
|
||||
marker.setVideoTexture();
|
||||
marker.set(UserConfig.selectedAccount, entity.linkSettings);
|
||||
marker.setType(entity.subType, entity.color);
|
||||
marker.setMaxWidth(entity.viewWidth + marker.padx + marker.padx);
|
||||
marker.measure(View.MeasureSpec.makeMeasureSpec(entity.viewWidth, View.MeasureSpec.EXACTLY), View.MeasureSpec.makeMeasureSpec(entity.viewHeight, View.MeasureSpec.EXACTLY));
|
||||
marker.layout(0, 0, entity.viewWidth, entity.viewHeight);
|
||||
float scale = entity.width * transformedWidth / entity.viewWidth;
|
||||
int w = (int) (entity.viewWidth * scale), h = (int) (entity.viewHeight * scale), pad = 8;
|
||||
entity.bitmap = Bitmap.createBitmap(w + pad + pad, h + pad + pad, Bitmap.Config.ARGB_8888);
|
||||
Canvas canvas = new Canvas(entity.bitmap);
|
||||
canvas.translate(pad, pad);
|
||||
canvas.scale(scale, scale);
|
||||
marker.draw(canvas);
|
||||
entity.additionalWidth = (2 * pad) * scale / transformedWidth;
|
||||
entity.additionalHeight = (2 * pad) * scale / transformedHeight;
|
||||
}
|
||||
|
||||
private void initStickerEntity(VideoEditedInfo.MediaEntity entity) {
|
||||
entity.W = (int) (entity.width * transformedWidth);
|
||||
entity.H = (int) (entity.height * transformedHeight);
|
||||
|
|
|
@ -780,7 +780,6 @@ public class VoIPService extends Service implements SensorEventListener, AudioMa
|
|||
return START_NOT_STICKY;
|
||||
}
|
||||
sharedInstance = this;
|
||||
FileLog.e("(4) set sharedInstance = this");
|
||||
synchronized (sync) {
|
||||
if (setModeRunnable != null) {
|
||||
Utilities.globalQueue.cancelRunnable(setModeRunnable);
|
||||
|
@ -832,7 +831,6 @@ public class VoIPService extends Service implements SensorEventListener, AudioMa
|
|||
setAudioOutput(0);
|
||||
}
|
||||
callIShouldHavePutIntoIntent = null;
|
||||
FileLog.e("(3) set VoIPService.callIShouldHavePutIntoIntent = null");
|
||||
if (USE_CONNECTION_SERVICE) {
|
||||
acknowledgeCall(false);
|
||||
showNotification();
|
||||
|
@ -1002,7 +1000,6 @@ public class VoIPService extends Service implements SensorEventListener, AudioMa
|
|||
req1.peer.access_hash = privateCall.access_hash;
|
||||
req1.peer.id = privateCall.id;
|
||||
req1.reason = new TLRPC.TL_phoneCallDiscardReasonMissed();
|
||||
FileLog.e("discardCall " + req1.reason);
|
||||
ConnectionsManager.getInstance(currentAccount).sendRequest(req1, (response1, error1) -> {
|
||||
if (BuildVars.LOGS_ENABLED) {
|
||||
if (error1 != null) {
|
||||
|
@ -1040,13 +1037,6 @@ public class VoIPService extends Service implements SensorEventListener, AudioMa
|
|||
}
|
||||
|
||||
private void acknowledgeCall(final boolean startRinging) {
|
||||
if (privateCall == null) {
|
||||
if (BuildVars.LOGS_ENABLED) {
|
||||
FileLog.w("Call is null, wtf");
|
||||
}
|
||||
stopSelf();
|
||||
return;
|
||||
}
|
||||
if (privateCall instanceof TLRPC.TL_phoneCallDiscarded) {
|
||||
if (BuildVars.LOGS_ENABLED) {
|
||||
FileLog.w("Call " + privateCall.id + " was discarded before the service started, stopping");
|
||||
|
@ -3130,7 +3120,6 @@ public class VoIPService extends Service implements SensorEventListener, AudioMa
|
|||
}
|
||||
super.onDestroy();
|
||||
sharedInstance = null;
|
||||
FileLog.e("(5) set sharedInstance = null");
|
||||
Arrays.fill(mySource, 0);
|
||||
cancelGroupCheckShortPoll();
|
||||
AndroidUtilities.runOnUIThread(() -> NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.didEndCall));
|
||||
|
@ -3396,7 +3385,6 @@ public class VoIPService extends Service implements SensorEventListener, AudioMa
|
|||
req.reason = new TLRPC.TL_phoneCallDiscardReasonHangup();
|
||||
break;
|
||||
}
|
||||
FileLog.e("discardCall " + req.reason);
|
||||
ConnectionsManager.getInstance(currentAccount).sendRequest(req, (response, error) -> {
|
||||
if (error != null) {
|
||||
if (BuildVars.LOGS_ENABLED) {
|
||||
|
@ -4256,7 +4244,6 @@ public class VoIPService extends Service implements SensorEventListener, AudioMa
|
|||
req.duration = (int) (getCallDuration() / 1000);
|
||||
req.connection_id = tgVoip[CAPTURE_DEVICE_CAMERA] != null ? tgVoip[CAPTURE_DEVICE_CAMERA].getPreferredRelayId() : 0;
|
||||
req.reason = new TLRPC.TL_phoneCallDiscardReasonDisconnect();
|
||||
FileLog.e("discardCall " + req.reason);
|
||||
ConnectionsManager.getInstance(currentAccount).sendRequest(req, (response, error1) -> {
|
||||
if (error1 != null) {
|
||||
if (BuildVars.LOGS_ENABLED) {
|
||||
|
|
|
@ -11,10 +11,10 @@ import android.text.SpannableString;
|
|||
import android.text.Spanned;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Base64;
|
||||
import android.util.Log;
|
||||
import android.util.LongSparseArray;
|
||||
import android.util.SparseIntArray;
|
||||
|
||||
import com.google.android.exoplayer2.util.Log;
|
||||
import com.google.android.gms.tasks.Task;
|
||||
import com.google.android.play.core.integrity.IntegrityManager;
|
||||
import com.google.android.play.core.integrity.IntegrityManagerFactory;
|
||||
|
@ -53,6 +53,7 @@ import org.telegram.ui.DialogsActivity;
|
|||
import org.telegram.ui.LaunchActivity;
|
||||
import org.telegram.ui.LoginActivity;
|
||||
import org.telegram.ui.PremiumPreviewFragment;
|
||||
import org.xatirchi.utils.GhostVariable;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
|
@ -85,6 +86,8 @@ import javax.net.ssl.SSLException;
|
|||
|
||||
public class ConnectionsManager extends BaseController {
|
||||
|
||||
private static final String TAG = "ConnectionsManager";
|
||||
|
||||
public final static int ConnectionTypeGeneric = 1;
|
||||
public final static int ConnectionTypeDownload = 2;
|
||||
public final static int ConnectionTypeUpload = 4;
|
||||
|
@ -192,8 +195,9 @@ public class ConnectionsManager extends BaseController {
|
|||
private static HashMap<String, ResolvedDomain> dnsCache = new HashMap<>();
|
||||
|
||||
private static int lastClassGuid = 1;
|
||||
|
||||
|
||||
private static final ConnectionsManager[] Instance = new ConnectionsManager[UserConfig.MAX_ACCOUNT_COUNT];
|
||||
|
||||
public static ConnectionsManager getInstance(int num) {
|
||||
ConnectionsManager localInstance = Instance[num];
|
||||
if (localInstance == null) {
|
||||
|
@ -344,9 +348,48 @@ public class ConnectionsManager extends BaseController {
|
|||
|
||||
public int sendRequest(final TLObject object, final RequestDelegate onComplete, final RequestDelegateTimestamp onCompleteTimestamp, final QuickAckDelegate onQuickAck, final WriteToSocketDelegate onWriteToSocket, final int flags, final int datacenterId, final int connectionType, final boolean immediate) {
|
||||
final int requestToken = lastRequestToken.getAndIncrement();
|
||||
Utilities.stageQueue.postRunnable(() -> {
|
||||
sendRequestInternal(object, onComplete, onCompleteTimestamp, onQuickAck, onWriteToSocket, flags, datacenterId, connectionType, immediate, requestToken);
|
||||
});
|
||||
try {
|
||||
// if (object.getClass().toString().contains("TL_messages_getMessagesReactions")) {
|
||||
// Log.d(TAG, "sendRequest1: " + object.getClass());
|
||||
// }
|
||||
// else if (object.getClass().toString().contains("TL_messages_getSavedHistory")) {
|
||||
// Log.d(TAG, "sendRequest1: " + object.getClass());
|
||||
// }
|
||||
// else if (object.getClass().toString().contains("TL_messages_getSearchCounters")) {
|
||||
// Log.d(TAG, "sendRequest1: " + object.getClass());
|
||||
// }
|
||||
// else if (object.getClass().toString().contains("TL_messages_getQuickReplies")) {
|
||||
// Log.d(TAG, "sendRequest1: " + object.getClass());
|
||||
// }
|
||||
// else if (object.getClass().toString().contains("TL_users_getFullUser")) {
|
||||
// Log.d(TAG, "sendRequest1: " + object.getClass());
|
||||
// }
|
||||
// else if (object.getClass().toString().contains("TL_messages_getSavedDialogs")) {
|
||||
// Log.d(TAG, "sendRequest1: " + object.getClass());
|
||||
// }
|
||||
// else if (object.getClass().toString().contains("TL_messages_getScheduledHistory")) {
|
||||
// Log.d(TAG, "sendRequest1: " + object.getClass());
|
||||
// }
|
||||
// else if (object.getClass().toString().contains("TL_messages_getArchivedStickers")) {
|
||||
// Log.d(TAG, "sendRequest1: " + object.getClass());
|
||||
// }
|
||||
// else if (object.getClass().toString().contains("TL_messages_getEmojiStickers")) {
|
||||
// Log.d(TAG, "sendRequest1: " + object.getClass());
|
||||
// }
|
||||
// if (object.getClass().toString().contains("TL_account_updateStatus")) {
|
||||
// Log.d(TAG, "sendRequest1: " + object.getClass());
|
||||
// } else
|
||||
if (GhostVariable.INSTANCE.getGhostMode() && object.getClass().toString().contains("TL_messages_readHistory")) {
|
||||
Log.d(TAG, "sendRequest1: " + object.getClass());
|
||||
} else {
|
||||
Utilities.stageQueue.postRunnable(() -> {
|
||||
sendRequestInternal(object, onComplete, onCompleteTimestamp, onQuickAck, onWriteToSocket, flags, datacenterId, connectionType, immediate, requestToken);
|
||||
});
|
||||
Log.d(TAG, "sendRequest2: " + object.getClass());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
return requestToken;
|
||||
}
|
||||
|
||||
|
@ -427,11 +470,13 @@ public class ConnectionsManager extends BaseController {
|
|||
}
|
||||
|
||||
private final ConcurrentHashMap<Integer, RequestCallbacks> requestCallbacks = new ConcurrentHashMap<>();
|
||||
|
||||
private static class RequestCallbacks {
|
||||
public RequestDelegateInternal onComplete;
|
||||
public QuickAckDelegate onQuickAck;
|
||||
public WriteToSocketDelegate onWriteToSocket;
|
||||
public Runnable onCancelled;
|
||||
|
||||
public RequestCallbacks(RequestDelegateInternal onComplete, QuickAckDelegate onQuickAck, WriteToSocketDelegate onWriteToSocket) {
|
||||
this.onComplete = onComplete;
|
||||
this.onQuickAck = onQuickAck;
|
||||
|
@ -910,37 +955,69 @@ public class ConnectionsManager extends BaseController {
|
|||
}
|
||||
|
||||
public static native void native_switchBackend(int currentAccount, boolean restart);
|
||||
|
||||
public static native int native_isTestBackend(int currentAccount);
|
||||
|
||||
public static native void native_pauseNetwork(int currentAccount);
|
||||
|
||||
public static native void native_setIpStrategy(int currentAccount, byte value);
|
||||
|
||||
public static native void native_updateDcSettings(int currentAccount);
|
||||
|
||||
public static native void native_setNetworkAvailable(int currentAccount, boolean value, int networkType, boolean slow);
|
||||
|
||||
public static native void native_resumeNetwork(int currentAccount, boolean partial);
|
||||
|
||||
public static native long native_getCurrentTimeMillis(int currentAccount);
|
||||
|
||||
public static native int native_getCurrentTime(int currentAccount);
|
||||
|
||||
public static native int native_getCurrentDatacenterId(int currentAccount);
|
||||
|
||||
public static native int native_getTimeDifference(int currentAccount);
|
||||
|
||||
public static native void native_sendRequest(int currentAccount, long object, int flags, int datacenterId, int connectionType, boolean immediate, int requestToken);
|
||||
|
||||
public static native void native_cancelRequest(int currentAccount, int token, boolean notifyServer);
|
||||
|
||||
public static native void native_cleanUp(int currentAccount, boolean resetKeys);
|
||||
|
||||
public static native void native_cancelRequestsForGuid(int currentAccount, int guid);
|
||||
|
||||
public static native void native_bindRequestToGuid(int currentAccount, int requestToken, int guid);
|
||||
|
||||
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, long 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, String packageId, int timezoneOffset, long userId, boolean userPremium, boolean enablePushConnection, boolean hasNetwork, int networkType, int performanceClass);
|
||||
|
||||
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);
|
||||
|
||||
public static native void native_setSystemLangCode(int currentAccount, String langCode);
|
||||
|
||||
public static native void native_seSystemLangCode(int currentAccount, String langCode);
|
||||
|
||||
public static native void native_setJava(boolean useJavaByteBuffers);
|
||||
|
||||
public static native void native_setPushConnectionEnabled(int currentAccount, boolean value);
|
||||
|
||||
public static native void native_applyDnsConfig(int currentAccount, long address, String phone, int date);
|
||||
|
||||
public static native long native_checkProxy(int currentAccount, String address, int port, String username, String password, String secret, RequestTimeDelegate requestTimeDelegate);
|
||||
|
||||
public static native void native_onHostNameResolved(String host, long address, String ip);
|
||||
|
||||
public static native void native_discardConnection(int currentAccount, int datacenterId, int connectionType);
|
||||
|
||||
public static native void native_failNotRunningRequest(int currentAccount, int token);
|
||||
|
||||
public static native void native_receivedIntegrityCheckClassic(int currentAccount, int requestToken, String nonce, String token);
|
||||
|
||||
public static native boolean native_isGoodPrime(byte[] prime, int g);
|
||||
|
@ -1471,6 +1548,7 @@ public class ConnectionsManager extends BaseController {
|
|||
}
|
||||
|
||||
public static long lastPremiumFloodWaitShown = 0;
|
||||
|
||||
public static void onPremiumFloodWait(final int currentAccount, final int requestToken, boolean isUpload) {
|
||||
AndroidUtilities.runOnUIThread(() -> {
|
||||
if (UserConfig.selectedAccount != currentAccount) {
|
||||
|
@ -1498,41 +1576,33 @@ public class ConnectionsManager extends BaseController {
|
|||
});
|
||||
}
|
||||
|
||||
public static void onIntegrityCheckClassic(final int currentAccount, final int requestToken, final String project, final String nonce) {
|
||||
public static void onIntegrityCheckClassic(final int currentAccount, final int requestToken, final String nonce) {
|
||||
AndroidUtilities.runOnUIThread(() -> {
|
||||
long start = System.currentTimeMillis();
|
||||
FileLog.d("account"+currentAccount+": server requests integrity classic check with project = "+project+" nonce = " + nonce);
|
||||
FileLog.d("account" + currentAccount + ": server requests integrity classic check with nonce = " + nonce);
|
||||
IntegrityManager integrityManager = IntegrityManagerFactory.create(ApplicationLoader.applicationContext);
|
||||
final long project_id;
|
||||
try {
|
||||
project_id = Long.parseLong(project);
|
||||
} catch (Exception e) {
|
||||
FileLog.d("account"+currentAccount+": integrity check failes to parse project id");
|
||||
native_receivedIntegrityCheckClassic(currentAccount, requestToken, nonce, "PLAYINTEGRITY_FAILED_EXCEPTION_NOPROJECT");
|
||||
return;
|
||||
}
|
||||
Task<IntegrityTokenResponse> integrityTokenResponse = integrityManager.requestIntegrityToken(IntegrityTokenRequest.builder().setNonce(nonce).setCloudProjectNumber(project_id).build());
|
||||
Task<IntegrityTokenResponse> integrityTokenResponse = integrityManager.requestIntegrityToken(IntegrityTokenRequest.builder().setNonce(nonce).setCloudProjectNumber(760348033671L).build());
|
||||
integrityTokenResponse
|
||||
.addOnSuccessListener(r -> {
|
||||
final String token = r.token();
|
||||
.addOnSuccessListener(r -> {
|
||||
final String token = r.token();
|
||||
|
||||
if (token == null) {
|
||||
FileLog.e("account"+currentAccount+": integrity check gave null token in " + (System.currentTimeMillis() - start) + "ms");
|
||||
native_receivedIntegrityCheckClassic(currentAccount, requestToken, nonce, "PLAYINTEGRITY_FAILED_EXCEPTION_NULL");
|
||||
return;
|
||||
}
|
||||
if (token == null) {
|
||||
FileLog.e("account" + currentAccount + ": integrity check gave null token in " + (System.currentTimeMillis() - start) + "ms");
|
||||
native_receivedIntegrityCheckClassic(currentAccount, requestToken, nonce, "PLAYINTEGRITY_FAILED_EXCEPTION_NULL");
|
||||
return;
|
||||
}
|
||||
|
||||
FileLog.d("account"+currentAccount+": integrity check successfully gave token: " + token + " in " + (System.currentTimeMillis() - start) + "ms");
|
||||
try {
|
||||
native_receivedIntegrityCheckClassic(currentAccount, requestToken, nonce, token);
|
||||
} catch (Exception e) {
|
||||
FileLog.e("receivedIntegrityCheckClassic failed", e);
|
||||
}
|
||||
})
|
||||
.addOnFailureListener(e -> {
|
||||
FileLog.e("account"+currentAccount+": integrity check failed to give a token in " + (System.currentTimeMillis() - start) + "ms", e);
|
||||
native_receivedIntegrityCheckClassic(currentAccount, requestToken, nonce, "PLAYINTEGRITY_FAILED_EXCEPTION_" + LoginActivity.errorString(e));
|
||||
});
|
||||
FileLog.d("account" + currentAccount + ": integrity check successfully gave token: " + token + " in " + (System.currentTimeMillis() - start) + "ms");
|
||||
try {
|
||||
native_receivedIntegrityCheckClassic(currentAccount, requestToken, nonce, token);
|
||||
} catch (Exception e) {
|
||||
FileLog.e("receivedIntegrityCheckClassic failed", e);
|
||||
}
|
||||
})
|
||||
.addOnFailureListener(e -> {
|
||||
FileLog.e("account" + currentAccount + ": integrity check failed to give a token in " + (System.currentTimeMillis() - start) + "ms", e);
|
||||
native_receivedIntegrityCheckClassic(currentAccount, requestToken, nonce, "PLAYINTEGRITY_FAILED_EXCEPTION_" + LoginActivity.errorString(e));
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,7 +26,6 @@ import org.telegram.messenger.MessageObject;
|
|||
import org.telegram.messenger.MessagesController;
|
||||
import org.telegram.messenger.SvgHelper;
|
||||
import org.telegram.messenger.Utilities;
|
||||
import org.telegram.tgnet.tl.TL_stats;
|
||||
import org.telegram.tgnet.tl.TL_stories;
|
||||
import org.telegram.ui.Stories.MessageMediaStoryFull;
|
||||
import org.telegram.ui.Stories.MessageMediaStoryFull_old;
|
||||
|
@ -78,7 +77,7 @@ public class TLRPC {
|
|||
public static final int MESSAGE_FLAG_HAS_BOT_ID = 0x00000800;
|
||||
public static final int MESSAGE_FLAG_EDITED = 0x00008000;
|
||||
|
||||
public static final int LAYER = 183;
|
||||
public static final int LAYER = 181;
|
||||
|
||||
|
||||
public static abstract class EmailVerifyPurpose extends TLObject {
|
||||
|
@ -414,7 +413,6 @@ public class TLRPC {
|
|||
public ArrayList<MessageEntity> entities = new ArrayList<>();
|
||||
public InputMedia media;
|
||||
public int date;
|
||||
public long effect;
|
||||
|
||||
public static DraftMessage TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) {
|
||||
DraftMessage result = null;
|
||||
|
@ -428,9 +426,6 @@ public class TLRPC {
|
|||
case TL_draftMessage_layer165.constructor:
|
||||
result = new TL_draftMessage_layer165();
|
||||
break;
|
||||
case TL_draftMessage_layer181.constructor:
|
||||
result = new TL_draftMessage_layer181();
|
||||
break;
|
||||
case TL_draftMessage.constructor:
|
||||
result = new TL_draftMessage();
|
||||
break;
|
||||
|
@ -475,70 +470,6 @@ public class TLRPC {
|
|||
}
|
||||
|
||||
public static class TL_draftMessage extends DraftMessage {
|
||||
public static final int constructor = 0x2d65321f;
|
||||
|
||||
public void readParams(AbstractSerializedData stream, boolean exception) {
|
||||
flags = stream.readInt32(exception);
|
||||
no_webpage = (flags & 2) != 0;
|
||||
invert_media = (flags & 64) != 0;
|
||||
if ((flags & 16) != 0) {
|
||||
reply_to = InputReplyTo.TLdeserialize(stream, stream.readInt32(exception), exception);
|
||||
}
|
||||
message = stream.readString(exception);
|
||||
if ((flags & 8) != 0) {
|
||||
int magic = stream.readInt32(exception);
|
||||
if (magic != 0x1cb5c415) {
|
||||
if (exception) {
|
||||
throw new RuntimeException(String.format("wrong Vector magic, got %x", magic));
|
||||
}
|
||||
return;
|
||||
}
|
||||
int count = stream.readInt32(exception);
|
||||
for (int a = 0; a < count; a++) {
|
||||
MessageEntity object = MessageEntity.TLdeserialize(stream, stream.readInt32(exception), exception);
|
||||
if (object == null) {
|
||||
return;
|
||||
}
|
||||
entities.add(object);
|
||||
}
|
||||
}
|
||||
if ((flags & 32) != 0) {
|
||||
media = InputMedia.TLdeserialize(stream, stream.readInt32(exception), exception);
|
||||
}
|
||||
date = stream.readInt32(exception);
|
||||
if ((flags & 128) != 0) {
|
||||
effect = stream.readInt64(exception);
|
||||
}
|
||||
}
|
||||
|
||||
public void serializeToStream(AbstractSerializedData stream) {
|
||||
stream.writeInt32(constructor);
|
||||
flags = no_webpage ? (flags | 2) : (flags &~ 2);
|
||||
flags = invert_media ? (flags | 64) : (flags &~ 64);
|
||||
stream.writeInt32(flags);
|
||||
if ((flags & 16) != 0) {
|
||||
reply_to.serializeToStream(stream);
|
||||
}
|
||||
stream.writeString(message);
|
||||
if ((flags & 8) != 0) {
|
||||
stream.writeInt32(0x1cb5c415);
|
||||
int count = entities.size();
|
||||
stream.writeInt32(count);
|
||||
for (int a = 0; a < count; a++) {
|
||||
entities.get(a).serializeToStream(stream);
|
||||
}
|
||||
}
|
||||
if ((flags & 32) != 0) {
|
||||
media.serializeToStream(stream);
|
||||
}
|
||||
stream.writeInt32(date);
|
||||
if ((flags & 128) != 0) {
|
||||
stream.writeInt64(effect);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static class TL_draftMessage_layer181 extends TL_draftMessage {
|
||||
public static final int constructor = 0x3fccf7ef;
|
||||
|
||||
public void readParams(AbstractSerializedData stream, boolean exception) {
|
||||
|
@ -7051,7 +6982,6 @@ public class TLRPC {
|
|||
public String email_pattern;
|
||||
public int next_phone_login_date;
|
||||
public byte[] nonce;
|
||||
public long play_integrity_project_id;
|
||||
public byte[] play_integrity_nonce;
|
||||
public String receipt;
|
||||
public int push_timeout;
|
||||
|
@ -7087,7 +7017,7 @@ public class TLRPC {
|
|||
case 0xd9565c39:
|
||||
result = new TL_auth_sentCodeTypeFragmentSms();
|
||||
break;
|
||||
case 0x9fd736:
|
||||
case 0x13c90f17:
|
||||
result = new TL_auth_sentCodeTypeFirebaseSms();
|
||||
break;
|
||||
case 0xa416ac81:
|
||||
|
@ -7246,7 +7176,7 @@ public class TLRPC {
|
|||
}
|
||||
|
||||
public static class TL_auth_sentCodeTypeFirebaseSms extends auth_SentCodeType {
|
||||
public static final int constructor = 0x9fd736;
|
||||
public static final int constructor = 0x13c90f17;
|
||||
|
||||
|
||||
public void readParams(AbstractSerializedData stream, boolean exception) {
|
||||
|
@ -7255,7 +7185,6 @@ public class TLRPC {
|
|||
nonce = stream.readByteArray(exception);
|
||||
}
|
||||
if ((flags & 4) != 0) {
|
||||
play_integrity_project_id = stream.readInt64(exception);
|
||||
play_integrity_nonce = stream.readByteArray(exception);
|
||||
}
|
||||
if ((flags & 2) != 0) {
|
||||
|
@ -8352,9 +8281,6 @@ public class TLRPC {
|
|||
}
|
||||
|
||||
public static class MessageExtendedMedia extends TLObject {
|
||||
|
||||
public String attachPath; // custom
|
||||
public float downloadProgress, uploadProgress; // custom
|
||||
|
||||
public static MessageExtendedMedia TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) {
|
||||
MessageExtendedMedia result = null;
|
||||
|
@ -8456,8 +8382,7 @@ public class TLRPC {
|
|||
total_amount = stream.readInt64(exception);
|
||||
start_param = stream.readString(exception);
|
||||
if ((flags & 16) != 0) {
|
||||
extended_media.clear();
|
||||
extended_media.add(MessageExtendedMedia.TLdeserialize(stream, stream.readInt32(exception), exception));
|
||||
extended_media = MessageExtendedMedia.TLdeserialize(stream, stream.readInt32(exception), exception);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -8478,7 +8403,7 @@ public class TLRPC {
|
|||
stream.writeInt64(total_amount);
|
||||
stream.writeString(start_param);
|
||||
if ((flags & 16) != 0) {
|
||||
extended_media.get(0).serializeToStream(stream);
|
||||
extended_media.serializeToStream(stream);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -8549,7 +8474,6 @@ public class TLRPC {
|
|||
public String emoji; //custom
|
||||
public long query_id; //custom
|
||||
public String result_id; //custom
|
||||
public TL_stories.TL_geoPointAddress geoAddress; //custom
|
||||
|
||||
public void readParams(AbstractSerializedData stream, boolean exception) {
|
||||
geo = GeoPoint.TLdeserialize(stream, stream.readInt32(exception), exception);
|
||||
|
@ -13053,8 +12977,6 @@ public class TLRPC {
|
|||
public int boosts_unrestrict;
|
||||
public StickerSet emojiset;
|
||||
public boolean can_view_revenue;
|
||||
public boolean can_view_stars_revenue;
|
||||
public boolean paid_media_allowed;
|
||||
public long inviterId; //custom
|
||||
public int invitesCount; //custom
|
||||
|
||||
|
@ -15688,8 +15610,6 @@ public class TLRPC {
|
|||
view_forum_as_messages = (flags2 & 64) != 0;
|
||||
restricted_sponsored = (flags2 & 2048) != 0;
|
||||
can_view_revenue = (flags2 & 4096) != 0;
|
||||
can_view_stars_revenue = (flags2 & 32768) != 0;
|
||||
paid_media_allowed = (flags2 & 16384) != 0;
|
||||
id = stream.readInt64(exception);
|
||||
about = stream.readString(exception);
|
||||
if ((flags & 1) != 0) {
|
||||
|
@ -15850,8 +15770,6 @@ public class TLRPC {
|
|||
flags2 = view_forum_as_messages ? (flags2 | 64) : (flags2 &~ 64);
|
||||
flags2 = restricted_sponsored ? (flags2 | 2048) : (flags2 &~ 2048);
|
||||
flags2 = can_view_revenue ? (flags2 | 4096) : (flags2 &~ 4096);
|
||||
flags2 = paid_media_allowed ? (flags2 | 16384) : (flags2 &~ 16384);
|
||||
flags2 = can_view_stars_revenue ? (flags2 | 32768) : (flags2 &~ 32768);
|
||||
stream.writeInt32(flags2);
|
||||
stream.writeInt64(id);
|
||||
stream.writeString(about);
|
||||
|
@ -15999,7 +15917,6 @@ public class TLRPC {
|
|||
view_forum_as_messages = (flags2 & 64) != 0;
|
||||
restricted_sponsored = (flags2 & 2048) != 0;
|
||||
can_view_revenue = (flags2 & 4096) != 0;
|
||||
can_view_stars_revenue = (flags2 & 32768) != 0;
|
||||
id = stream.readInt64(exception);
|
||||
about = stream.readString(exception);
|
||||
if ((flags & 1) != 0) {
|
||||
|
@ -16157,7 +16074,6 @@ public class TLRPC {
|
|||
flags2 = view_forum_as_messages ? (flags2 | 64) : (flags2 &~ 64);
|
||||
flags2 = restricted_sponsored ? (flags2 | 2048) : (flags2 &~ 2048);
|
||||
flags2 = can_view_revenue ? (flags2 | 4096) : (flags2 &~ 4096);
|
||||
flags2 = can_view_stars_revenue ? (flags2 | 32768) : (flags2 &~ 32768);
|
||||
stream.writeInt32(flags2);
|
||||
stream.writeInt64(id);
|
||||
stream.writeString(about);
|
||||
|
@ -33763,9 +33679,6 @@ public class TLRPC {
|
|||
case 0xc21b8849:
|
||||
result = new TL_inputMediaWebPage();
|
||||
break;
|
||||
case TL_inputMediaPaidMedia.constructor:
|
||||
result = new TL_inputMediaPaidMedia();
|
||||
break;
|
||||
}
|
||||
if (result == null && exception) {
|
||||
throw new RuntimeException(String.format("can't parse magic %x in InputMedia", constructor));
|
||||
|
@ -34220,43 +34133,6 @@ public class TLRPC {
|
|||
}
|
||||
}
|
||||
|
||||
public static class TL_inputMediaPaidMedia extends InputMedia {
|
||||
public static final int constructor = 0xaa661fc3;
|
||||
|
||||
public long stars_amount;
|
||||
public ArrayList<InputMedia> extended_media = new ArrayList<>();
|
||||
|
||||
public void readParams(AbstractSerializedData stream, boolean exception) {
|
||||
stars_amount = stream.readInt64(exception);
|
||||
int magic = stream.readInt32(exception);
|
||||
if (magic != 0x1cb5c415) {
|
||||
if (exception) {
|
||||
throw new RuntimeException(String.format("wrong Vector magic, got %x", magic));
|
||||
}
|
||||
return;
|
||||
}
|
||||
int count = stream.readInt32(exception);
|
||||
for (int a = 0; a < count; a++) {
|
||||
InputMedia object = InputMedia.TLdeserialize(stream, stream.readInt32(exception), exception);
|
||||
if (object == null) {
|
||||
return;
|
||||
}
|
||||
extended_media.add(object);
|
||||
}
|
||||
}
|
||||
|
||||
public void serializeToStream(AbstractSerializedData stream) {
|
||||
stream.writeInt32(constructor);
|
||||
stream.writeInt64(stars_amount);
|
||||
stream.writeInt32(0x1cb5c415);
|
||||
int count = extended_media.size();
|
||||
stream.writeInt32(count);
|
||||
for (int a = 0; a < count; a++) {
|
||||
extended_media.get(a).serializeToStream(stream);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static class TL_inputMediaPhoto extends InputMedia {
|
||||
public static final int constructor = 0xb3ba0635;
|
||||
|
||||
|
@ -35809,9 +35685,6 @@ public class TLRPC {
|
|||
case TL_updateStarsBalance.constructor:
|
||||
result = new TL_updateStarsBalance();
|
||||
break;
|
||||
case TL_updateStarsRevenueStatus.constructor:
|
||||
result = new TL_updateStarsRevenueStatus();
|
||||
break;
|
||||
}
|
||||
if (result == null && ApplicationLoader.applicationLoaderInstance != null) {
|
||||
result = ApplicationLoader.applicationLoaderInstance.parseTLUpdate(constructor);
|
||||
|
@ -35890,42 +35763,23 @@ public class TLRPC {
|
|||
}
|
||||
|
||||
public static class TL_updateMessageExtendedMedia extends Update {
|
||||
public static final int constructor = 0xd5a41724;
|
||||
public static final int constructor = 0x5a73a98c;
|
||||
|
||||
public Peer peer;
|
||||
public int msg_id;
|
||||
public ArrayList<MessageExtendedMedia> extended_media = new ArrayList<>();
|
||||
public MessageExtendedMedia extended_media;
|
||||
|
||||
public void readParams(AbstractSerializedData stream, boolean exception) {
|
||||
peer = Peer.TLdeserialize(stream, stream.readInt32(exception), exception);
|
||||
msg_id = stream.readInt32(exception);
|
||||
int magic = stream.readInt32(exception);
|
||||
if (magic != 0x1cb5c415) {
|
||||
if (exception) {
|
||||
throw new RuntimeException(String.format("wrong Vector magic, got %x", magic));
|
||||
}
|
||||
return;
|
||||
}
|
||||
int count = stream.readInt32(exception);
|
||||
for (int a = 0; a < count; a++) {
|
||||
MessageExtendedMedia object = MessageExtendedMedia.TLdeserialize(stream, stream.readInt32(exception), exception);
|
||||
if (object == null) {
|
||||
return;
|
||||
}
|
||||
extended_media.add(object);
|
||||
}
|
||||
extended_media = MessageExtendedMedia.TLdeserialize(stream, stream.readInt32(exception), exception);
|
||||
}
|
||||
|
||||
public void serializeToStream(AbstractSerializedData stream) {
|
||||
stream.writeInt32(constructor);
|
||||
peer.serializeToStream(stream);
|
||||
stream.writeInt32(msg_id);
|
||||
stream.writeInt32(0x1cb5c415);
|
||||
int count = extended_media.size();
|
||||
stream.writeInt32(count);
|
||||
for (int a = 0; a < count; a++) {
|
||||
extended_media.get(a).serializeToStream(stream);
|
||||
}
|
||||
extended_media.serializeToStream(stream);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -62217,7 +62071,7 @@ public class TLRPC {
|
|||
}
|
||||
|
||||
public static class TL_messages_saveDraft extends TLObject {
|
||||
public static final int constructor = 0xd372c5ce;
|
||||
public static final int constructor = 0x7ff3b806;
|
||||
|
||||
public int flags;
|
||||
public boolean no_webpage;
|
||||
|
@ -62227,7 +62081,6 @@ public class TLRPC {
|
|||
public String message;
|
||||
public ArrayList<MessageEntity> entities = new ArrayList<>();
|
||||
public InputMedia media;
|
||||
public long effect;
|
||||
|
||||
public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) {
|
||||
return Bool.TLdeserialize(stream, constructor, exception);
|
||||
|
@ -62254,9 +62107,6 @@ public class TLRPC {
|
|||
if ((flags & 32) != 0) {
|
||||
media.serializeToStream(stream);
|
||||
}
|
||||
if ((flags & 128) != 0) {
|
||||
stream.writeInt64(effect);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -67048,6 +66898,7 @@ public class TLRPC {
|
|||
public int ttl_seconds;
|
||||
public int proximity_notification_radius;
|
||||
public boolean nopremium;
|
||||
public MessageExtendedMedia extended_media;
|
||||
public boolean spoiler;
|
||||
public int id;
|
||||
public TL_stories.StoryItem storyItem;
|
||||
|
@ -67060,8 +66911,6 @@ public class TLRPC {
|
|||
public boolean video;
|
||||
public boolean round;
|
||||
public boolean voice;
|
||||
public long stars_amount;
|
||||
public ArrayList<MessageExtendedMedia> extended_media = new ArrayList<>();
|
||||
|
||||
public static MessageMedia TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) {
|
||||
MessageMedia result = null;
|
||||
|
@ -67144,9 +66993,6 @@ public class TLRPC {
|
|||
case TL_messageMediaGiveaway_layer167.constructor:
|
||||
result = new TL_messageMediaGiveaway_layer167();
|
||||
break;
|
||||
case TL_messageMediaPaidMedia.constructor:
|
||||
result = new TL_messageMediaPaidMedia();
|
||||
break;
|
||||
case 0xb5223b0f:
|
||||
result = new TL_messageMediaPhoto_layer74();
|
||||
break;
|
||||
|
@ -67644,7 +67490,6 @@ public class TLRPC {
|
|||
public int send_state = 0; //custom
|
||||
public int fwd_msg_id = 0; //custom
|
||||
public String attachPath = ""; //custom
|
||||
public ArrayList<String> attachPaths; //custom
|
||||
public HashMap<String, String> params; //custom
|
||||
public long random_id; //custom
|
||||
public int local_id = 0; //custom
|
||||
|
@ -67858,16 +67703,6 @@ public class TLRPC {
|
|||
if ((flags & MESSAGE_FLAG_FWD) != 0 && id < 0) {
|
||||
fwd_msg_id = stream.readInt32(false);
|
||||
}
|
||||
// if (media instanceof TLRPC.TL_messageMediaPaidMedia && stream.remaining() > 0) {
|
||||
// TLRPC.TL_messageMediaPaidMedia paidMedia = (TLRPC.TL_messageMediaPaidMedia) media;
|
||||
// final int size = stream.readInt32(false);
|
||||
// for (int i = 0; i < size; ++i) {
|
||||
// final String attachPath = stream.readString(false);
|
||||
// if (i < paidMedia.extended_media.size()) {
|
||||
// paidMedia.extended_media.get(i).attachPath = attachPath;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
protected void writeAttachPath(AbstractSerializedData stream) {
|
||||
|
@ -67899,15 +67734,6 @@ public class TLRPC {
|
|||
if ((flags & MESSAGE_FLAG_FWD) != 0 && id < 0) {
|
||||
stream.writeInt32(fwd_msg_id);
|
||||
}
|
||||
// if (media instanceof TLRPC.TL_messageMediaPaidMedia) {
|
||||
// TLRPC.TL_messageMediaPaidMedia paidMedia = (TLRPC.TL_messageMediaPaidMedia) media;
|
||||
// stream.writeInt32(paidMedia.extended_media.size());
|
||||
// for (int i = 0; i < paidMedia.extended_media.size(); ++i) {
|
||||
// TLRPC.MessageExtendedMedia emedia = paidMedia.extended_media.get(i);
|
||||
// String attachPath = emedia.attachPath == null ? "" : emedia.attachPath;
|
||||
// stream.writeString(attachPath);
|
||||
// }
|
||||
// }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -73546,10 +73372,8 @@ public class TLRPC {
|
|||
}
|
||||
|
||||
public static class TL_webViewResultUrl extends TLObject {
|
||||
public static final int constructor = 0x4d22ff98;
|
||||
public static final int constructor = 0xc14557c;
|
||||
|
||||
public int flags;
|
||||
public boolean fullsize;
|
||||
public long query_id;
|
||||
public String url;
|
||||
|
||||
|
@ -73567,21 +73391,13 @@ public class TLRPC {
|
|||
}
|
||||
|
||||
public void readParams(AbstractSerializedData stream, boolean exception) {
|
||||
flags = stream.readInt32(exception);
|
||||
fullsize = (flags & 2) != 0;
|
||||
if ((flags & 1) != 0) {
|
||||
query_id = stream.readInt64(exception);
|
||||
}
|
||||
query_id = stream.readInt64(exception);
|
||||
url = stream.readString(exception);
|
||||
}
|
||||
|
||||
public void serializeToStream(AbstractSerializedData stream) {
|
||||
stream.writeInt32(constructor);
|
||||
flags = fullsize ? flags | 2 : flags &~ 2;
|
||||
stream.writeInt32(flags);
|
||||
if ((flags & 1) != 0) {
|
||||
stream.writeInt64(query_id);
|
||||
}
|
||||
stream.writeInt64(query_id);
|
||||
stream.writeString(url);
|
||||
}
|
||||
}
|
||||
|
@ -73592,7 +73408,6 @@ public class TLRPC {
|
|||
public int flags;
|
||||
public boolean from_bot_menu;
|
||||
public boolean silent;
|
||||
public boolean compact;
|
||||
public InputPeer peer;
|
||||
public InputUser bot;
|
||||
public String url;
|
||||
|
@ -73610,7 +73425,6 @@ public class TLRPC {
|
|||
stream.writeInt32(constructor);
|
||||
flags = from_bot_menu ? (flags | 16) : (flags &~ 16);
|
||||
flags = silent ? (flags | 32) : (flags &~ 32);
|
||||
flags = compact ? (flags | 128) : (flags &~ 128);
|
||||
stream.writeInt32(flags);
|
||||
peer.serializeToStream(stream);
|
||||
bot.serializeToStream(stream);
|
||||
|
@ -73682,11 +73496,10 @@ public class TLRPC {
|
|||
}
|
||||
|
||||
public static class TL_messages_requestAppWebView extends TLObject {
|
||||
public static final int constructor = 0x53618bce;
|
||||
public static final int constructor = 0x8c5a3b3c;
|
||||
|
||||
public int flags;
|
||||
public boolean write_allowed;
|
||||
public boolean compact;
|
||||
public InputPeer peer;
|
||||
public InputBotApp app;
|
||||
public String start_param;
|
||||
|
@ -73694,13 +73507,12 @@ public class TLRPC {
|
|||
public String platform;
|
||||
|
||||
public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) {
|
||||
return TL_webViewResultUrl.TLdeserialize(stream, constructor, exception);
|
||||
return TL_appWebViewResultUrl.TLdeserialize(stream, constructor, exception);
|
||||
}
|
||||
|
||||
public void serializeToStream(AbstractSerializedData stream) {
|
||||
stream.writeInt32(constructor);
|
||||
flags = write_allowed ? (flags | 1) : (flags &~ 1);
|
||||
flags = compact ? (flags | 128) : (flags &~ 128);
|
||||
stream.writeInt32(flags);
|
||||
peer.serializeToStream(stream);
|
||||
app.serializeToStream(stream);
|
||||
|
@ -73715,12 +73527,11 @@ public class TLRPC {
|
|||
}
|
||||
|
||||
public static class TL_messages_requestSimpleWebView extends TLObject {
|
||||
public static final int constructor = 0x413a3e73;
|
||||
public static final int constructor = 0x1a46500a;
|
||||
|
||||
public int flags;
|
||||
public boolean from_switch_webview;
|
||||
public boolean from_side_menu;
|
||||
public boolean compact;
|
||||
public InputUser bot;
|
||||
public String url;
|
||||
public String start_param;
|
||||
|
@ -73728,14 +73539,13 @@ public class TLRPC {
|
|||
public String platform;
|
||||
|
||||
public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) {
|
||||
return TL_webViewResultUrl.TLdeserialize(stream, constructor, exception);
|
||||
return TL_simpleWebViewResultUrl.TLdeserialize(stream, constructor, exception);
|
||||
}
|
||||
|
||||
public void serializeToStream(AbstractSerializedData stream) {
|
||||
stream.writeInt32(constructor);
|
||||
flags = from_switch_webview ? (flags | 2) : (flags &~ 2);
|
||||
flags = from_side_menu ? (flags | 4) : (flags &~ 4);
|
||||
flags = compact ? (flags | 128) : (flags &~ 128);
|
||||
stream.writeInt32(flags);
|
||||
bot.serializeToStream(stream);
|
||||
if ((flags & 8) != 0) {
|
||||
|
@ -76561,24 +76371,6 @@ public class TLRPC {
|
|||
stream.writeInt64(balance);
|
||||
}
|
||||
}
|
||||
|
||||
public static class TL_updateStarsRevenueStatus extends Update {
|
||||
public static final int constructor = 0xa584b019;
|
||||
|
||||
public Peer peer;
|
||||
public TL_starsRevenueStatus status;
|
||||
|
||||
public void readParams(AbstractSerializedData stream, boolean exception) {
|
||||
peer = Peer.TLdeserialize(stream, stream.readInt32(exception), exception);
|
||||
status = TL_starsRevenueStatus.TLdeserialize(stream, stream.readInt32(exception), exception);
|
||||
}
|
||||
|
||||
public void serializeToStream(AbstractSerializedData stream) {
|
||||
stream.writeInt32(constructor);
|
||||
peer.serializeToStream(stream);
|
||||
status.serializeToStream(stream);
|
||||
}
|
||||
}
|
||||
|
||||
public static class TL_updateSavedDialogPinned extends Update {
|
||||
public static final int constructor = 0xaeaf9e74;
|
||||
|
@ -77564,38 +77356,6 @@ public class TLRPC {
|
|||
}
|
||||
}
|
||||
|
||||
public static class TL_messageMediaPaidMedia extends MessageMedia {
|
||||
public static final int constructor = 0xa8852491;
|
||||
|
||||
public void readParams(AbstractSerializedData stream, boolean exception) {
|
||||
stars_amount = stream.readInt64(exception);
|
||||
int magic = stream.readInt32(exception);
|
||||
if (magic != 0x1cb5c415) {
|
||||
if (exception) {
|
||||
throw new RuntimeException(String.format("wrong Vector magic, got %x", magic));
|
||||
}
|
||||
return;
|
||||
}
|
||||
int count = stream.readInt32(exception);
|
||||
for (int a = 0; a < count; a++) {
|
||||
MessageExtendedMedia object = MessageExtendedMedia.TLdeserialize(stream, stream.readInt32(exception), exception);
|
||||
if (object == null) continue;
|
||||
extended_media.add(object);
|
||||
}
|
||||
}
|
||||
|
||||
public void serializeToStream(AbstractSerializedData stream) {
|
||||
stream.writeInt32(constructor);
|
||||
stream.writeInt64(stars_amount);
|
||||
stream.writeInt32(0x1cb5c415);
|
||||
int count = extended_media.size();
|
||||
stream.writeInt32(count);
|
||||
for (int a = 0; a < count; a++) {
|
||||
extended_media.get(a).serializeToStream(stream);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static class TL_premiumGiftCodeOption extends TLObject {
|
||||
public static int constructor = 0x257e962b;
|
||||
|
||||
|
@ -81467,9 +81227,6 @@ public class TLRPC {
|
|||
case TL_starsTransactionPeerUnsupported.constructor:
|
||||
result = new TL_starsTransactionPeerUnsupported();
|
||||
break;
|
||||
case TL_starsTransactionPeerAds.constructor:
|
||||
result = new TL_starsTransactionPeerAds();
|
||||
break;
|
||||
}
|
||||
if (result == null && exception) {
|
||||
throw new RuntimeException(String.format("can't parse magic %x in StarsTransactionPeer", constructor));
|
||||
|
@ -81544,22 +81301,11 @@ public class TLRPC {
|
|||
}
|
||||
}
|
||||
|
||||
public static class TL_starsTransactionPeerAds extends StarsTransactionPeer {
|
||||
public static final int constructor = 0x60682812;
|
||||
|
||||
public void readParams(AbstractSerializedData stream, boolean exception) {}
|
||||
|
||||
public void serializeToStream(AbstractSerializedData stream) {
|
||||
stream.writeInt32(constructor);
|
||||
}
|
||||
}
|
||||
|
||||
public static class StarsTransaction extends TLObject {
|
||||
public static class TL_starsTransaction extends TLObject {
|
||||
public static final int constructor = 0xcc7079b2;
|
||||
|
||||
public int flags;
|
||||
public boolean refund;
|
||||
public boolean pending;
|
||||
public boolean failed;
|
||||
public String id;
|
||||
public long stars;
|
||||
public int date;
|
||||
|
@ -81567,39 +81313,20 @@ public class TLRPC {
|
|||
public String title;
|
||||
public String description;
|
||||
public WebDocument photo;
|
||||
public int transaction_date;
|
||||
public String transaction_url;
|
||||
public byte[] bot_payload;
|
||||
public int msg_id;
|
||||
public ArrayList<MessageMedia> extended_media = new ArrayList<>();
|
||||
|
||||
public static StarsTransaction TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) {
|
||||
StarsTransaction result = null;
|
||||
switch (constructor) {
|
||||
case TL_starsTransaction_layer181.constructor:
|
||||
result = new TL_starsTransaction_layer181();
|
||||
break;
|
||||
case TL_starsTransaction_layer182.constructor:
|
||||
result = new TL_starsTransaction_layer182();
|
||||
break;
|
||||
case TL_starsTransaction.constructor:
|
||||
result = new TL_starsTransaction();
|
||||
break;
|
||||
}
|
||||
if (result == null && exception) {
|
||||
throw new RuntimeException(String.format("can't parse magic %x in StarsTransaction", constructor));
|
||||
}
|
||||
if (result != null) {
|
||||
result.readParams(stream, exception);
|
||||
public static TL_starsTransaction TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) {
|
||||
if (TL_starsTransaction.constructor != constructor) {
|
||||
if (exception) {
|
||||
throw new RuntimeException(String.format("can't parse magic %x in TL_starsTransaction", constructor));
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
TL_starsTransaction result = new TL_starsTransaction();
|
||||
result.readParams(stream, exception);
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static class TL_starsTransaction_layer181 extends StarsTransaction {
|
||||
public static final int constructor = 0xcc7079b2;
|
||||
|
||||
public void readParams(AbstractSerializedData stream, boolean exception) {
|
||||
flags = stream.readInt32(exception);
|
||||
refund = (flags & 8) != 0;
|
||||
|
@ -81637,153 +81364,12 @@ public class TLRPC {
|
|||
}
|
||||
}
|
||||
|
||||
public static class TL_starsTransaction_layer182 extends TL_starsTransaction {
|
||||
public static final int constructor = 0xaa00c898;
|
||||
|
||||
public void readParams(AbstractSerializedData stream, boolean exception) {
|
||||
flags = stream.readInt32(exception);
|
||||
refund = (flags & 8) != 0;
|
||||
pending = (flags & 16) != 0;
|
||||
failed = (flags & 64) != 0;
|
||||
id = stream.readString(exception);
|
||||
stars = stream.readInt64(exception);
|
||||
date = stream.readInt32(exception);
|
||||
peer = StarsTransactionPeer.TLdeserialize(stream, stream.readInt32(exception), exception);
|
||||
if ((flags & 1) != 0) {
|
||||
title = stream.readString(exception);
|
||||
}
|
||||
if ((flags & 2) != 0) {
|
||||
description = stream.readString(exception);
|
||||
}
|
||||
if ((flags & 4) != 0) {
|
||||
photo = WebDocument.TLdeserialize(stream, stream.readInt32(exception), exception);
|
||||
}
|
||||
if ((flags & 32) != 0) {
|
||||
transaction_date = stream.readInt32(exception);
|
||||
transaction_url = stream.readString(exception);
|
||||
}
|
||||
}
|
||||
|
||||
public void serializeToStream(AbstractSerializedData stream) {
|
||||
stream.writeInt32(constructor);
|
||||
flags = refund ? flags | 8 : flags &~ 8;
|
||||
flags = pending ? flags | 16 : flags &~ 16;
|
||||
flags = failed ? flags | 64 : flags &~ 64;
|
||||
stream.writeInt32(flags);
|
||||
stream.writeInt64(stars);
|
||||
stream.writeInt32(date);
|
||||
peer.serializeToStream(stream);
|
||||
if ((flags & 1) != 0) {
|
||||
stream.writeString(title);
|
||||
}
|
||||
if ((flags & 2) != 0) {
|
||||
stream.writeString(description);
|
||||
}
|
||||
if ((flags & 4) != 0) {
|
||||
photo.serializeToStream(stream);
|
||||
}
|
||||
if ((flags & 32) != 0) {
|
||||
stream.writeInt32(transaction_date);
|
||||
stream.writeString(transaction_url);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static class TL_starsTransaction extends StarsTransaction {
|
||||
public static final int constructor = 0x2db5418f;
|
||||
|
||||
public void readParams(AbstractSerializedData stream, boolean exception) {
|
||||
flags = stream.readInt32(exception);
|
||||
refund = (flags & 8) != 0;
|
||||
pending = (flags & 16) != 0;
|
||||
failed = (flags & 64) != 0;
|
||||
id = stream.readString(exception);
|
||||
stars = stream.readInt64(exception);
|
||||
date = stream.readInt32(exception);
|
||||
peer = StarsTransactionPeer.TLdeserialize(stream, stream.readInt32(exception), exception);
|
||||
if ((flags & 1) != 0) {
|
||||
title = stream.readString(exception);
|
||||
}
|
||||
if ((flags & 2) != 0) {
|
||||
description = stream.readString(exception);
|
||||
}
|
||||
if ((flags & 4) != 0) {
|
||||
photo = WebDocument.TLdeserialize(stream, stream.readInt32(exception), exception);
|
||||
}
|
||||
if ((flags & 32) != 0) {
|
||||
transaction_date = stream.readInt32(exception);
|
||||
transaction_url = stream.readString(exception);
|
||||
}
|
||||
if ((flags & 128) != 0) {
|
||||
bot_payload = stream.readByteArray(exception);
|
||||
}
|
||||
if ((flags & 256) != 0) {
|
||||
msg_id = stream.readInt32(exception);
|
||||
}
|
||||
if ((flags & 512) != 0) {
|
||||
int magic = stream.readInt32(exception);
|
||||
if (magic != 0x1cb5c415) {
|
||||
if (exception) {
|
||||
throw new RuntimeException(String.format("wrong Vector magic, got %x", magic));
|
||||
}
|
||||
return;
|
||||
}
|
||||
int count = stream.readInt32(exception);
|
||||
for (int a = 0; a < count; a++) {
|
||||
MessageMedia object = MessageMedia.TLdeserialize(stream, stream.readInt32(exception), exception);
|
||||
if (object == null) {
|
||||
return;
|
||||
}
|
||||
extended_media.add(object);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void serializeToStream(AbstractSerializedData stream) {
|
||||
stream.writeInt32(constructor);
|
||||
flags = refund ? flags | 8 : flags &~ 8;
|
||||
flags = pending ? flags | 16 : flags &~ 16;
|
||||
flags = failed ? flags | 64 : flags &~ 64;
|
||||
stream.writeInt32(flags);
|
||||
stream.writeInt64(stars);
|
||||
stream.writeInt32(date);
|
||||
peer.serializeToStream(stream);
|
||||
if ((flags & 1) != 0) {
|
||||
stream.writeString(title);
|
||||
}
|
||||
if ((flags & 2) != 0) {
|
||||
stream.writeString(description);
|
||||
}
|
||||
if ((flags & 4) != 0) {
|
||||
photo.serializeToStream(stream);
|
||||
}
|
||||
if ((flags & 32) != 0) {
|
||||
stream.writeInt32(transaction_date);
|
||||
stream.writeString(transaction_url);
|
||||
}
|
||||
if ((flags & 128) != 0) {
|
||||
stream.writeByteArray(bot_payload);
|
||||
}
|
||||
if ((flags & 256) != 0) {
|
||||
stream.writeInt32(msg_id);
|
||||
}
|
||||
if ((flags & 512) != 0) {
|
||||
stream.writeInt32(0x1cb5c415);
|
||||
int count = extended_media.size();
|
||||
stream.writeInt32(count);
|
||||
for (int i = 0; i < count; ++i) {
|
||||
extended_media.get(i).serializeToStream(stream);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static class TL_payments_starsStatus extends TLObject {
|
||||
public static final int constructor = 0x8cf4ee60;
|
||||
|
||||
public int flags;
|
||||
public long balance;
|
||||
public ArrayList<StarsTransaction> history = new ArrayList<>();
|
||||
public ArrayList<TL_starsTransaction> history = new ArrayList<>();
|
||||
public String next_offset;
|
||||
public ArrayList<Chat> chats = new ArrayList<>();
|
||||
public ArrayList<User> users = new ArrayList<>();
|
||||
|
@ -81813,7 +81399,7 @@ public class TLRPC {
|
|||
}
|
||||
int count = stream.readInt32(exception);
|
||||
for (int a = 0; a < count; a++) {
|
||||
StarsTransaction object = StarsTransaction.TLdeserialize(stream, stream.readInt32(exception), exception);
|
||||
TL_starsTransaction object = TL_starsTransaction.TLdeserialize(stream, stream.readInt32(exception), exception);
|
||||
if (object == null) {
|
||||
return;
|
||||
}
|
||||
|
@ -82071,195 +81657,6 @@ public class TLRPC {
|
|||
}
|
||||
}
|
||||
|
||||
public static class TL_starsRevenueStatus extends TLObject {
|
||||
public static final int constructor = 0x79342946;
|
||||
|
||||
public int flags;
|
||||
public boolean withdrawal_enabled;
|
||||
public long current_balance;
|
||||
public long available_balance;
|
||||
public long overall_revenue;
|
||||
public int next_withdrawal_at;
|
||||
|
||||
public static TL_starsRevenueStatus TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) {
|
||||
if (TL_starsRevenueStatus.constructor != constructor) {
|
||||
if (exception) {
|
||||
throw new RuntimeException(String.format("can't parse magic %x in TL_starsRevenueStatus", constructor));
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
TL_starsRevenueStatus result = new TL_starsRevenueStatus();
|
||||
result.readParams(stream, exception);
|
||||
return result;
|
||||
}
|
||||
|
||||
public void readParams(AbstractSerializedData stream, boolean exception) {
|
||||
flags = stream.readInt32(exception);
|
||||
withdrawal_enabled = (flags & 1) != 0;
|
||||
current_balance = stream.readInt64(exception);
|
||||
available_balance = stream.readInt64(exception);
|
||||
overall_revenue = stream.readInt64(exception);
|
||||
if ((flags & 2) != 0) {
|
||||
next_withdrawal_at = stream.readInt32(exception);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void serializeToStream(AbstractSerializedData stream) {
|
||||
stream.writeInt32(constructor);
|
||||
flags = withdrawal_enabled ? flags | 1 : flags &~ 1;
|
||||
stream.writeInt32(flags);
|
||||
stream.writeInt64(current_balance);
|
||||
stream.writeInt64(available_balance);
|
||||
stream.writeInt64(overall_revenue);
|
||||
if ((flags & 2) != 0) {
|
||||
stream.writeInt32(next_withdrawal_at);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static class TL_payments_starsRevenueStats extends TLObject {
|
||||
public static final int constructor = 0xc92bb73b;
|
||||
|
||||
public TL_stats.StatsGraph revenue_graph;
|
||||
public TL_starsRevenueStatus status;
|
||||
public double usd_rate;
|
||||
|
||||
public static TL_payments_starsRevenueStats TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) {
|
||||
if (TL_payments_starsRevenueStats.constructor != constructor) {
|
||||
if (exception) {
|
||||
throw new RuntimeException(String.format("can't parse magic %x in TL_payments_starsRevenueStats", constructor));
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
TL_payments_starsRevenueStats result = new TL_payments_starsRevenueStats();
|
||||
result.readParams(stream, exception);
|
||||
return result;
|
||||
}
|
||||
|
||||
public void readParams(AbstractSerializedData stream, boolean exception) {
|
||||
revenue_graph = TL_stats.StatsGraph.TLdeserialize(stream, stream.readInt32(exception), exception);
|
||||
status = TL_starsRevenueStatus.TLdeserialize(stream, stream.readInt32(exception), exception);
|
||||
usd_rate = stream.readDouble(exception);
|
||||
}
|
||||
|
||||
public void serializeToStream(AbstractSerializedData stream) {
|
||||
stream.writeInt32(constructor);
|
||||
revenue_graph.serializeToStream(stream);
|
||||
status.serializeToStream(stream);
|
||||
stream.writeDouble(usd_rate);
|
||||
}
|
||||
}
|
||||
|
||||
public static class TL_payments_starsRevenueWithdrawalUrl extends TLObject {
|
||||
public static final int constructor = 0x1dab80b7;
|
||||
|
||||
public String url;
|
||||
|
||||
public static TL_payments_starsRevenueWithdrawalUrl TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) {
|
||||
if (TL_payments_starsRevenueWithdrawalUrl.constructor != constructor) {
|
||||
if (exception) {
|
||||
throw new RuntimeException(String.format("can't parse magic %x in TL_payments_starsRevenueWithdrawalUrl", constructor));
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
TL_payments_starsRevenueWithdrawalUrl result = new TL_payments_starsRevenueWithdrawalUrl();
|
||||
result.readParams(stream, exception);
|
||||
return result;
|
||||
}
|
||||
|
||||
public void readParams(AbstractSerializedData stream, boolean exception) {
|
||||
url = stream.readString(exception);
|
||||
}
|
||||
|
||||
public void serializeToStream(AbstractSerializedData stream) {
|
||||
stream.writeInt32(constructor);
|
||||
stream.writeString(url);
|
||||
}
|
||||
}
|
||||
|
||||
public static class TL_payments_starsRevenueAdsAccountUrl extends TLObject {
|
||||
public static final int constructor = 0x394e7f21;
|
||||
|
||||
public String url;
|
||||
|
||||
public static TL_payments_starsRevenueAdsAccountUrl TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) {
|
||||
if (TL_payments_starsRevenueAdsAccountUrl.constructor != constructor) {
|
||||
if (exception) {
|
||||
throw new RuntimeException(String.format("can't parse magic %x in TL_payments_starsRevenueWithdrawalUrl", constructor));
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
TL_payments_starsRevenueAdsAccountUrl result = new TL_payments_starsRevenueAdsAccountUrl();
|
||||
result.readParams(stream, exception);
|
||||
return result;
|
||||
}
|
||||
|
||||
public void readParams(AbstractSerializedData stream, boolean exception) {
|
||||
url = stream.readString(exception);
|
||||
}
|
||||
|
||||
public void serializeToStream(AbstractSerializedData stream) {
|
||||
stream.writeInt32(constructor);
|
||||
stream.writeString(url);
|
||||
}
|
||||
}
|
||||
|
||||
public static class TL_payments_getStarsRevenueStats extends TLObject {
|
||||
public static final int constructor = 0xd91ffad6;
|
||||
|
||||
public int flags;
|
||||
public boolean dark;
|
||||
public InputPeer peer;
|
||||
|
||||
public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) {
|
||||
return TL_payments_starsRevenueStats.TLdeserialize(stream, constructor, exception);
|
||||
}
|
||||
|
||||
public void serializeToStream(AbstractSerializedData stream) {
|
||||
stream.writeInt32(constructor);
|
||||
flags = dark ? flags | 1 : flags &~ 1;
|
||||
stream.writeInt32(flags);
|
||||
peer.serializeToStream(stream);
|
||||
}
|
||||
}
|
||||
|
||||
public static class TL_payments_getStarsRevenueWithdrawalUrl extends TLObject {
|
||||
public static final int constructor = 0x13bbe8b3;
|
||||
|
||||
public InputPeer peer;
|
||||
public long stars;
|
||||
public InputCheckPasswordSRP password;
|
||||
|
||||
public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) {
|
||||
return TL_payments_starsRevenueWithdrawalUrl.TLdeserialize(stream, constructor, exception);
|
||||
}
|
||||
|
||||
public void serializeToStream(AbstractSerializedData stream) {
|
||||
stream.writeInt32(constructor);
|
||||
peer.serializeToStream(stream);
|
||||
stream.writeInt64(stars);
|
||||
password.serializeToStream(stream);
|
||||
}
|
||||
}
|
||||
|
||||
public static class TL_payments_getStarsRevenueAdsAccountUrl extends TLObject {
|
||||
public static final int constructor = 0xd1d7efc5;
|
||||
|
||||
public InputPeer peer;
|
||||
|
||||
public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) {
|
||||
return TL_payments_starsRevenueAdsAccountUrl.TLdeserialize(stream, constructor, exception);
|
||||
}
|
||||
|
||||
public void serializeToStream(AbstractSerializedData stream) {
|
||||
stream.writeInt32(constructor);
|
||||
peer.serializeToStream(stream);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package org.telegram.tgnet.tl;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import org.telegram.messenger.DialogObject;
|
||||
import org.telegram.tgnet.AbstractSerializedData;
|
||||
import org.telegram.tgnet.TLObject;
|
||||
|
@ -1233,173 +1231,6 @@ public class TL_stories {
|
|||
}
|
||||
}
|
||||
|
||||
public static class TL_foundStory extends TLObject {
|
||||
public static final int constructor = 0xe87acbc0;
|
||||
|
||||
public TLRPC.Peer peer;
|
||||
public StoryItem storyItem;
|
||||
|
||||
public static TL_foundStory TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) {
|
||||
if (TL_foundStory.constructor != constructor) {
|
||||
if (exception) {
|
||||
throw new RuntimeException(String.format("can't parse magic %x in TL_foundStory", constructor));
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
TL_foundStory result = new TL_foundStory();
|
||||
result.readParams(stream, exception);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readParams(AbstractSerializedData stream, boolean exception) {
|
||||
peer = TLRPC.Peer.TLdeserialize(stream, stream.readInt32(exception), exception);
|
||||
storyItem = StoryItem.TLdeserialize(stream, stream.readInt32(exception), exception);
|
||||
}
|
||||
|
||||
public void serializeToStream(AbstractSerializedData stream) {
|
||||
stream.writeInt32(constructor);
|
||||
peer.serializeToStream(stream);
|
||||
storyItem.serializeToStream(stream);
|
||||
}
|
||||
}
|
||||
|
||||
public static class TL_foundStories extends TLObject {
|
||||
public static final int constructor = 0xe2de7737;
|
||||
|
||||
public int flags;
|
||||
public int count;
|
||||
public ArrayList<TL_foundStory> stories = new ArrayList<>();
|
||||
public String next_offset;
|
||||
public ArrayList<TLRPC.Chat> chats = new ArrayList<>();
|
||||
public ArrayList<TLRPC.User> users = new ArrayList<>();
|
||||
|
||||
public static TL_foundStories TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) {
|
||||
if (TL_foundStories.constructor != constructor) {
|
||||
if (exception) {
|
||||
throw new RuntimeException(String.format("can't parse magic %x in TL_foundStories", constructor));
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
TL_foundStories result = new TL_foundStories();
|
||||
result.readParams(stream, exception);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readParams(AbstractSerializedData stream, boolean exception) {
|
||||
flags = stream.readInt32(exception);
|
||||
this.count = stream.readInt32(exception);
|
||||
int magic = stream.readInt32(exception);
|
||||
if (magic != 0x1cb5c415) {
|
||||
if (exception) {
|
||||
throw new RuntimeException(String.format("wrong Vector magic, got %x", magic));
|
||||
}
|
||||
return;
|
||||
}
|
||||
int count = stream.readInt32(exception);
|
||||
for (int a = 0; a < count; a++) {
|
||||
TL_foundStory object = TL_foundStory.TLdeserialize(stream, stream.readInt32(exception), exception);
|
||||
if (object == null) {
|
||||
return;
|
||||
}
|
||||
stories.add(object);
|
||||
}
|
||||
if ((flags & 1) != 0) {
|
||||
next_offset = stream.readString(exception);
|
||||
}
|
||||
magic = stream.readInt32(exception);
|
||||
if (magic != 0x1cb5c415) {
|
||||
if (exception) {
|
||||
throw new RuntimeException(String.format("wrong Vector magic, got %x", magic));
|
||||
}
|
||||
return;
|
||||
}
|
||||
count = stream.readInt32(exception);
|
||||
for (int a = 0; a < count; a++) {
|
||||
TLRPC.Chat object = TLRPC.Chat.TLdeserialize(stream, stream.readInt32(exception), exception);
|
||||
if (object == null) {
|
||||
return;
|
||||
}
|
||||
chats.add(object);
|
||||
}
|
||||
magic = stream.readInt32(exception);
|
||||
if (magic != 0x1cb5c415) {
|
||||
if (exception) {
|
||||
throw new RuntimeException(String.format("wrong Vector magic, got %x", magic));
|
||||
}
|
||||
return;
|
||||
}
|
||||
count = stream.readInt32(exception);
|
||||
for (int a = 0; a < count; a++) {
|
||||
TLRPC.User object = TLRPC.User.TLdeserialize(stream, stream.readInt32(exception), exception);
|
||||
if (object == null) {
|
||||
return;
|
||||
}
|
||||
users.add(object);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void serializeToStream(AbstractSerializedData stream) {
|
||||
stream.writeInt32(constructor);
|
||||
stream.writeInt32(flags);
|
||||
stream.writeInt32(this.count);
|
||||
stream.writeInt32(0x1cb5c415);
|
||||
int count = stories.size();
|
||||
stream.writeInt32(count);
|
||||
for (int a = 0; a < count; a++) {
|
||||
stories.get(a).serializeToStream(stream);
|
||||
}
|
||||
if ((flags & 1) != 0) {
|
||||
stream.writeString(next_offset);
|
||||
}
|
||||
stream.writeInt32(0x1cb5c415);
|
||||
count = chats.size();
|
||||
stream.writeInt32(count);
|
||||
for (int a = 0; a < count; a++) {
|
||||
chats.get(a).serializeToStream(stream);
|
||||
}
|
||||
stream.writeInt32(0x1cb5c415);
|
||||
count = users.size();
|
||||
stream.writeInt32(count);
|
||||
for (int a = 0; a < count; a++) {
|
||||
users.get(a).serializeToStream(stream);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static class TL_stories_searchPosts extends TLObject {
|
||||
public static final int constructor = 0x6cea116a;
|
||||
|
||||
public int flags;
|
||||
public String hashtag;
|
||||
public MediaArea area;
|
||||
public String offset;
|
||||
public int limit;
|
||||
|
||||
@Override
|
||||
public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) {
|
||||
return TL_foundStories.TLdeserialize(stream, constructor, exception);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void serializeToStream(AbstractSerializedData stream) {
|
||||
stream.writeInt32(constructor);
|
||||
stream.writeInt32(flags);
|
||||
if ((flags & 1) != 0) {
|
||||
stream.writeString(hashtag);
|
||||
}
|
||||
if ((flags & 2) != 0) {
|
||||
area.serializeToStream(stream);
|
||||
}
|
||||
stream.writeString(offset);
|
||||
stream.writeInt32(limit);
|
||||
}
|
||||
}
|
||||
|
||||
public static class TL_stories_getStoriesViews extends TLObject {
|
||||
public static final int constructor = 0x28e16cc8;
|
||||
|
||||
|
@ -3008,69 +2839,27 @@ public class TL_stories {
|
|||
}
|
||||
}
|
||||
|
||||
public static class MediaAreaCoordinates extends TLObject {
|
||||
public static class TL_mediaAreaCoordinates extends TLObject {
|
||||
public static final int constructor = 0x3d1ea4e;
|
||||
|
||||
public int flags;
|
||||
public double x;
|
||||
public double y;
|
||||
public double w;
|
||||
public double h;
|
||||
public double rotation;
|
||||
public double radius;
|
||||
|
||||
public static MediaAreaCoordinates TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) {
|
||||
MediaAreaCoordinates result = null;
|
||||
switch (constructor) {
|
||||
case TL_mediaAreaCoordinates.constructor:
|
||||
result = new TL_mediaAreaCoordinates();
|
||||
break;
|
||||
case TL_mediaAreaCoordinates_layer181.constructor:
|
||||
result = new TL_mediaAreaCoordinates_layer181();
|
||||
break;
|
||||
}
|
||||
if (result == null && exception) {
|
||||
throw new RuntimeException(String.format("can't parse magic %x in MediaAreaCoordinates", constructor));
|
||||
}
|
||||
if (result != null) {
|
||||
result.readParams(stream, exception);
|
||||
public static TL_mediaAreaCoordinates TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) {
|
||||
if (TL_mediaAreaCoordinates.constructor != constructor) {
|
||||
if (exception) {
|
||||
throw new RuntimeException(String.format("can't parse magic %x in TL_mediaAreaCoordinates", constructor));
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
TL_mediaAreaCoordinates result = new TL_mediaAreaCoordinates();
|
||||
result.readParams(stream, exception);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
public static class TL_mediaAreaCoordinates extends MediaAreaCoordinates {
|
||||
public static final int constructor = 0xcfc9e002;
|
||||
|
||||
@Override
|
||||
public void readParams(AbstractSerializedData stream, boolean exception) {
|
||||
flags = stream.readInt32(exception);
|
||||
x = stream.readDouble(exception);
|
||||
y = stream.readDouble(exception);
|
||||
w = stream.readDouble(exception);
|
||||
h = stream.readDouble(exception);
|
||||
rotation = stream.readDouble(exception);
|
||||
if ((flags & 1) != 0) {
|
||||
radius = stream.readDouble(exception);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void serializeToStream(AbstractSerializedData stream) {
|
||||
stream.writeInt32(constructor);
|
||||
stream.writeInt32(flags);
|
||||
stream.writeDouble(x);
|
||||
stream.writeDouble(y);
|
||||
stream.writeDouble(w);
|
||||
stream.writeDouble(h);
|
||||
stream.writeDouble(rotation);
|
||||
if ((flags & 1) != 0) {
|
||||
stream.writeDouble(radius);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static class TL_mediaAreaCoordinates_layer181 extends MediaAreaCoordinates {
|
||||
public static final int constructor = 0x3d1ea4e;
|
||||
|
||||
@Override
|
||||
public void readParams(AbstractSerializedData stream, boolean exception) {
|
||||
|
@ -3093,7 +2882,7 @@ public class TL_stories {
|
|||
}
|
||||
|
||||
public static class MediaArea extends TLObject {
|
||||
public MediaAreaCoordinates coordinates;
|
||||
public TL_mediaAreaCoordinates coordinates;
|
||||
public TLRPC.Reaction reaction;
|
||||
public int flags;
|
||||
public boolean dark;
|
||||
|
@ -3102,17 +2891,17 @@ public class TL_stories {
|
|||
public static MediaArea TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) {
|
||||
MediaArea result = null;
|
||||
switch (constructor) {
|
||||
case TL_mediaAreaUrl.constructor:
|
||||
result = new TL_mediaAreaUrl();
|
||||
break;
|
||||
case TL_mediaAreaVenue.constructor:
|
||||
result = new TL_mediaAreaVenue();
|
||||
break;
|
||||
case TL_mediaAreaGeoPoint.constructor:
|
||||
result = new TL_mediaAreaGeoPoint();
|
||||
break;
|
||||
case TL_mediaAreaGeoPoint_layer181.constructor:
|
||||
result = new TL_mediaAreaGeoPoint_layer181();
|
||||
case TL_inputMediaAreaVenue.constructor:
|
||||
result = new TL_inputMediaAreaVenue();
|
||||
break;
|
||||
case TL_inputMediaAreaChannelPost.constructor:
|
||||
result = new TL_inputMediaAreaChannelPost();
|
||||
break;
|
||||
case TL_mediaAreaSuggestedReaction.constructor:
|
||||
result = new TL_mediaAreaSuggestedReaction();
|
||||
|
@ -3120,13 +2909,6 @@ public class TL_stories {
|
|||
case TL_mediaAreaChannelPost.constructor:
|
||||
result = new TL_mediaAreaChannelPost();
|
||||
break;
|
||||
|
||||
case TL_inputMediaAreaVenue.constructor:
|
||||
result = new TL_inputMediaAreaVenue();
|
||||
break;
|
||||
case TL_inputMediaAreaChannelPost.constructor:
|
||||
result = new TL_inputMediaAreaChannelPost();
|
||||
break;
|
||||
}
|
||||
if (result == null && exception) {
|
||||
throw new RuntimeException(String.format("can't parse magic %x in MediaArea", constructor));
|
||||
|
@ -3145,7 +2927,7 @@ public class TL_stories {
|
|||
flags = stream.readInt32(exception);
|
||||
dark = (flags & 1) != 0;
|
||||
flipped = (flags & 2) != 0;
|
||||
coordinates = MediaAreaCoordinates.TLdeserialize(stream, stream.readInt32(exception), exception);
|
||||
coordinates = TL_mediaAreaCoordinates.TLdeserialize(stream, stream.readInt32(exception), exception);
|
||||
reaction = TLRPC.Reaction.TLdeserialize(stream, stream.readInt32(exception), exception);
|
||||
}
|
||||
|
||||
|
@ -3166,7 +2948,7 @@ public class TL_stories {
|
|||
public int msg_id;
|
||||
|
||||
public void readParams(AbstractSerializedData stream, boolean exception) {
|
||||
coordinates = MediaAreaCoordinates.TLdeserialize(stream, stream.readInt32(exception), exception);
|
||||
coordinates = TL_mediaAreaCoordinates.TLdeserialize(stream, stream.readInt32(exception), exception);
|
||||
channel_id = stream.readInt64(exception);
|
||||
msg_id = stream.readInt32(exception);
|
||||
}
|
||||
|
@ -3191,7 +2973,7 @@ public class TL_stories {
|
|||
|
||||
@Override
|
||||
public void readParams(AbstractSerializedData stream, boolean exception) {
|
||||
coordinates = MediaAreaCoordinates.TLdeserialize(stream, stream.readInt32(exception), exception);
|
||||
coordinates = TL_mediaAreaCoordinates.TLdeserialize(stream, stream.readInt32(exception), exception);
|
||||
geo = TLRPC.GeoPoint.TLdeserialize(stream, stream.readInt32(exception), exception);
|
||||
title = stream.readString(exception);
|
||||
address = stream.readString(exception);
|
||||
|
@ -3213,26 +2995,6 @@ public class TL_stories {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
public static class TL_mediaAreaUrl extends MediaArea {
|
||||
public static final int constructor = 0x37381085;
|
||||
|
||||
public String url;
|
||||
|
||||
@Override
|
||||
public void readParams(AbstractSerializedData stream, boolean exception) {
|
||||
coordinates = MediaAreaCoordinates.TLdeserialize(stream, stream.readInt32(exception), exception);
|
||||
url = stream.readString(exception);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void serializeToStream(AbstractSerializedData stream) {
|
||||
stream.writeInt32(constructor);
|
||||
coordinates.serializeToStream(stream);
|
||||
stream.writeString(url);
|
||||
}
|
||||
}
|
||||
|
||||
public static class TL_inputMediaAreaVenue extends MediaArea {
|
||||
public static final int constructor = 0xb282217f;
|
||||
|
||||
|
@ -3241,7 +3003,7 @@ public class TL_stories {
|
|||
|
||||
@Override
|
||||
public void readParams(AbstractSerializedData stream, boolean exception) {
|
||||
coordinates = MediaAreaCoordinates.TLdeserialize(stream, stream.readInt32(exception), exception);
|
||||
coordinates = TL_mediaAreaCoordinates.TLdeserialize(stream, stream.readInt32(exception), exception);
|
||||
query_id = stream.readInt64(exception);
|
||||
result_id = stream.readString(exception);
|
||||
}
|
||||
|
@ -3263,7 +3025,7 @@ public class TL_stories {
|
|||
|
||||
@Override
|
||||
public void readParams(AbstractSerializedData stream, boolean exception) {
|
||||
coordinates = MediaAreaCoordinates.TLdeserialize(stream, stream.readInt32(exception), exception);
|
||||
coordinates = TL_mediaAreaCoordinates.TLdeserialize(stream, stream.readInt32(exception), exception);
|
||||
channel = TLRPC.InputChannel.TLdeserialize(stream, stream.readInt32(exception), exception);
|
||||
msg_id = stream.readInt32(exception);
|
||||
}
|
||||
|
@ -3277,100 +3039,14 @@ public class TL_stories {
|
|||
}
|
||||
}
|
||||
|
||||
public static class TL_geoPointAddress extends TLObject {
|
||||
public static final int constructor = 0xde4c5d93;
|
||||
|
||||
public int flags;
|
||||
public String country_iso2;
|
||||
public String state;
|
||||
public String city;
|
||||
public String street;
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public String toString() {
|
||||
return "geo{country=" + country_iso2 + ", " + (state != null ? "state=" + state + ", " : "") + (city != null ? "city=" + city + ", " : "") + (street != null ? "street=" + street : "") + "}";
|
||||
}
|
||||
|
||||
public static TL_geoPointAddress TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) {
|
||||
if (TL_geoPointAddress.constructor != constructor) {
|
||||
if (exception) {
|
||||
throw new RuntimeException(String.format("can't parse magic %x in TL_geoPointAddress", constructor));
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
TL_geoPointAddress result = new TL_geoPointAddress();
|
||||
result.readParams(stream, exception);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readParams(AbstractSerializedData stream, boolean exception) {
|
||||
flags = stream.readInt32(exception);
|
||||
country_iso2 = stream.readString(exception);
|
||||
if ((flags & 1) != 0) {
|
||||
state = stream.readString(exception);
|
||||
}
|
||||
if ((flags & 2) != 0) {
|
||||
city = stream.readString(exception);
|
||||
}
|
||||
if ((flags & 4) != 0) {
|
||||
street = stream.readString(exception);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void serializeToStream(AbstractSerializedData stream) {
|
||||
stream.writeInt32(constructor);
|
||||
stream.writeInt32(flags);
|
||||
stream.writeString(country_iso2);
|
||||
if ((flags & 1) != 0) {
|
||||
stream.writeString(state);
|
||||
}
|
||||
if ((flags & 2) != 0) {
|
||||
stream.writeString(city);
|
||||
}
|
||||
if ((flags & 4) != 0) {
|
||||
stream.writeString(street);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static class TL_mediaAreaGeoPoint extends MediaArea {
|
||||
public static final int constructor = 0xcad5452d;
|
||||
|
||||
public TLRPC.GeoPoint geo;
|
||||
public TL_geoPointAddress address;
|
||||
|
||||
@Override
|
||||
public void readParams(AbstractSerializedData stream, boolean exception) {
|
||||
flags = stream.readInt32(exception);
|
||||
coordinates = MediaAreaCoordinates.TLdeserialize(stream, stream.readInt32(exception), exception);
|
||||
geo = TLRPC.GeoPoint.TLdeserialize(stream, stream.readInt32(exception), exception);
|
||||
if ((flags & 1) != 0) {
|
||||
address = TL_geoPointAddress.TLdeserialize(stream, stream.readInt32(exception), exception);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void serializeToStream(AbstractSerializedData stream) {
|
||||
stream.writeInt32(constructor);
|
||||
stream.writeInt32(flags);
|
||||
coordinates.serializeToStream(stream);
|
||||
geo.serializeToStream(stream);
|
||||
if ((flags & 1) != 0) {
|
||||
address.serializeToStream(stream);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static class TL_mediaAreaGeoPoint_layer181 extends TL_mediaAreaGeoPoint {
|
||||
public static final int constructor = 0xdf8b3b22;
|
||||
|
||||
public TLRPC.GeoPoint geo;
|
||||
|
||||
@Override
|
||||
public void readParams(AbstractSerializedData stream, boolean exception) {
|
||||
coordinates = MediaAreaCoordinates.TLdeserialize(stream, stream.readInt32(exception), exception);
|
||||
coordinates = TL_mediaAreaCoordinates.TLdeserialize(stream, stream.readInt32(exception), exception);
|
||||
geo = TLRPC.GeoPoint.TLdeserialize(stream, stream.readInt32(exception), exception);
|
||||
}
|
||||
|
||||
|
|
|
@ -1628,10 +1628,6 @@ public class ActionBar extends FrameLayout {
|
|||
}
|
||||
|
||||
public void setCastShadows(boolean value) {
|
||||
if (castShadows != value && getParent() instanceof View) {
|
||||
((View) getParent()).invalidate();
|
||||
invalidate();
|
||||
}
|
||||
castShadows = value;
|
||||
}
|
||||
|
||||
|
|
|
@ -8,8 +8,6 @@
|
|||
|
||||
package org.telegram.ui.ActionBar;
|
||||
|
||||
import static org.telegram.messenger.AndroidUtilities.dp;
|
||||
|
||||
import android.animation.Animator;
|
||||
import android.animation.AnimatorListenerAdapter;
|
||||
import android.animation.AnimatorSet;
|
||||
|
@ -24,14 +22,11 @@ import android.graphics.Canvas;
|
|||
import android.graphics.Color;
|
||||
import android.graphics.Outline;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.Path;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.RectF;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Build;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.Gravity;
|
||||
import android.view.HapticFeedbackConstants;
|
||||
import android.view.KeyEvent;
|
||||
|
@ -118,7 +113,7 @@ public class ActionBarLayout extends FrameLayout implements INavigationLayout, F
|
|||
if (!fragmentsStack.isEmpty()) {
|
||||
lastFragment = fragmentsStack.get(fragmentsStack.size() - 1);
|
||||
}
|
||||
if (storyViewerAttached() && lastFragment != null && lastFragment.getLastSheet() != null && lastFragment.getLastSheet().isFullyVisible() && lastFragment.getLastSheet().getWindowView() != child) {
|
||||
if (storyViewerAttached() && lastFragment != null && lastFragment.getLastStoryViewer() != null && lastFragment.getLastStoryViewer().isFullyVisible() && lastFragment.getLastStoryViewer().windowView != child) {
|
||||
return true;
|
||||
}
|
||||
if (child instanceof ActionBar) {
|
||||
|
@ -169,14 +164,6 @@ public class ActionBarLayout extends FrameLayout implements INavigationLayout, F
|
|||
|
||||
int count = getChildCount();
|
||||
int actionBarHeight = 0;
|
||||
|
||||
View rootView = getRootView();
|
||||
getWindowVisibleDisplayFrame(rect);
|
||||
int usableViewHeight = rootView.getHeight() - (rect.top != 0 ? AndroidUtilities.statusBarHeight : 0) - AndroidUtilities.getViewInset(rootView);
|
||||
boolean isKeyboardVisible = usableViewHeight - (rect.bottom - rect.top) > 0;
|
||||
|
||||
int bottomTabsHeight = isKeyboardVisible ? 0 : getBottomTabsHeight(false);
|
||||
|
||||
for (int a = 0; a < count; a++) {
|
||||
View child = getChildAt(a);
|
||||
if (child instanceof ActionBar) {
|
||||
|
@ -188,10 +175,10 @@ public class ActionBarLayout extends FrameLayout implements INavigationLayout, F
|
|||
for (int a = 0; a < count; a++) {
|
||||
View child = getChildAt(a);
|
||||
if (!(child instanceof ActionBar)) {
|
||||
if (child.getFitsSystemWindows() || child instanceof BaseFragment.AttachedSheetWindow) {
|
||||
measureChildWithMargins(child, widthMeasureSpec, 0, heightMeasureSpec, bottomTabsHeight);
|
||||
if (child.getFitsSystemWindows()) {
|
||||
measureChildWithMargins(child, widthMeasureSpec, 0, heightMeasureSpec, 0);
|
||||
} else {
|
||||
measureChildWithMargins(child, widthMeasureSpec, 0, heightMeasureSpec, actionBarHeight + bottomTabsHeight);
|
||||
measureChildWithMargins(child, widthMeasureSpec, 0, heightMeasureSpec, actionBarHeight);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -214,20 +201,10 @@ public class ActionBarLayout extends FrameLayout implements INavigationLayout, F
|
|||
View child = getChildAt(a);
|
||||
if (!(child instanceof ActionBar)) {
|
||||
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) child.getLayoutParams();
|
||||
if (child.getFitsSystemWindows() || child instanceof BaseFragment.AttachedSheetWindow) {
|
||||
child.layout(
|
||||
layoutParams.leftMargin,
|
||||
layoutParams.topMargin,
|
||||
layoutParams.leftMargin + child.getMeasuredWidth(),
|
||||
layoutParams.topMargin + child.getMeasuredHeight()
|
||||
);
|
||||
if (child.getFitsSystemWindows()) {
|
||||
child.layout(layoutParams.leftMargin, layoutParams.topMargin, layoutParams.leftMargin + child.getMeasuredWidth(), layoutParams.topMargin + child.getMeasuredHeight());
|
||||
} else {
|
||||
child.layout(
|
||||
layoutParams.leftMargin,
|
||||
layoutParams.topMargin + actionBarHeight,
|
||||
layoutParams.leftMargin + child.getMeasuredWidth(),
|
||||
layoutParams.topMargin + actionBarHeight + child.getMeasuredHeight()
|
||||
);
|
||||
child.layout(layoutParams.leftMargin, layoutParams.topMargin + actionBarHeight, layoutParams.leftMargin + child.getMeasuredWidth(), layoutParams.topMargin + actionBarHeight + child.getMeasuredHeight());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -245,12 +222,6 @@ public class ActionBarLayout extends FrameLayout implements INavigationLayout, F
|
|||
|
||||
@Override
|
||||
public boolean dispatchTouchEvent(MotionEvent ev) {
|
||||
if (ev.getAction() == MotionEvent.ACTION_DOWN) {
|
||||
final int bottomSheetHeight = isKeyboardVisible ? 0 : getBottomTabsHeight(true);
|
||||
if (ev.getY() > getHeight() - bottomSheetHeight) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// processMenuButtonsTouch(ev);
|
||||
boolean passivePreview = inPreviewMode && previewMenu == null;
|
||||
if ((passivePreview || transitionAnimationPreviewMode) && (ev.getActionMasked() == MotionEvent.ACTION_DOWN || ev.getActionMasked() == MotionEvent.ACTION_POINTER_DOWN)) {
|
||||
|
@ -309,7 +280,7 @@ public class ActionBarLayout extends FrameLayout implements INavigationLayout, F
|
|||
} else if (event.getAction() == MotionEvent.ACTION_MOVE || event.getAction() == MotionEvent.ACTION_UP) {
|
||||
if (previewMenu != null && highlightActionButtons) {
|
||||
// movePreviewFragment(Math.min(pressY, AndroidUtilities.displaySize.y * .4f) - event.getY());
|
||||
if (!allowToPressByHover && Math.sqrt(Math.pow(pressX - event.getX(), 2) + Math.pow(pressY - event.getY(), 2)) > dp(30)) {
|
||||
if (!allowToPressByHover && Math.sqrt(Math.pow(pressX - event.getX(), 2) + Math.pow(pressY - event.getY(), 2)) > AndroidUtilities.dp(30)) {
|
||||
allowToPressByHover = true;
|
||||
}
|
||||
if (allowToPressByHover && (previewMenu.getSwipeBack() == null || !previewMenu.getSwipeBack().isForegroundOpen())) {
|
||||
|
@ -380,11 +351,10 @@ public class ActionBarLayout extends FrameLayout implements INavigationLayout, F
|
|||
private boolean previewOpenAnimationInProgress;
|
||||
private ColorDrawable previewBackgroundDrawable;
|
||||
|
||||
public LayoutContainer containerView;
|
||||
public LayoutContainer containerView; /* Contest: private -> public temp hack bc I don't know how to blur action bar otherwise */
|
||||
private LayoutContainer containerViewBack;
|
||||
private DrawerLayoutContainer drawerLayoutContainer;
|
||||
private ActionBar currentActionBar;
|
||||
private BottomSheetTabs bottomSheetTabs;
|
||||
|
||||
private BaseFragment newFragment;
|
||||
private BaseFragment oldFragment;
|
||||
|
@ -450,7 +420,6 @@ public class ActionBarLayout extends FrameLayout implements INavigationLayout, F
|
|||
|
||||
private INavigationLayoutDelegate delegate;
|
||||
protected Activity parentActivity;
|
||||
private final boolean main;
|
||||
|
||||
private List<BaseFragment> fragmentsStack;
|
||||
private List<BackButtonMenu.PulledDialog> pulledDialogs;
|
||||
|
@ -460,10 +429,9 @@ public class ActionBarLayout extends FrameLayout implements INavigationLayout, F
|
|||
|
||||
private int overrideWidthOffset = -1;
|
||||
|
||||
public ActionBarLayout(Context context, boolean main) {
|
||||
public ActionBarLayout(Context context) {
|
||||
super(context);
|
||||
parentActivity = (Activity) context;
|
||||
this.main = main;
|
||||
|
||||
if (layerShadowDrawable == null) {
|
||||
layerShadowDrawable = getResources().getDrawable(R.drawable.layer_shadow);
|
||||
|
@ -475,27 +443,9 @@ public class ActionBarLayout extends FrameLayout implements INavigationLayout, F
|
|||
@Override
|
||||
public void setFragmentStack(List<BaseFragment> stack) {
|
||||
this.fragmentsStack = stack;
|
||||
|
||||
FrameLayout.LayoutParams layoutParams;
|
||||
if (main) {
|
||||
if (bottomSheetTabs != null) {
|
||||
AndroidUtilities.removeFromParent(bottomSheetTabs);
|
||||
bottomSheetTabs = null;
|
||||
}
|
||||
|
||||
bottomSheetTabs = new BottomSheetTabs(parentActivity, this);
|
||||
layoutParams = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, dp(68 + 8));
|
||||
layoutParams.gravity = Gravity.BOTTOM | Gravity.FILL_HORIZONTAL;
|
||||
addView(bottomSheetTabs, layoutParams);
|
||||
|
||||
if (LaunchActivity.instance.getBottomSheetTabsOverlay() != null) {
|
||||
LaunchActivity.instance.getBottomSheetTabsOverlay().setTabsView(bottomSheetTabs);
|
||||
}
|
||||
}
|
||||
|
||||
this.containerViewBack = new LayoutContainer(parentActivity);
|
||||
addView(containerViewBack);
|
||||
layoutParams = (FrameLayout.LayoutParams) containerViewBack.getLayoutParams();
|
||||
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) containerViewBack.getLayoutParams();
|
||||
layoutParams.width = LayoutHelper.MATCH_PARENT;
|
||||
layoutParams.height = LayoutHelper.MATCH_PARENT;
|
||||
layoutParams.gravity = Gravity.TOP | Gravity.LEFT;
|
||||
|
@ -546,7 +496,6 @@ public class ActionBarLayout extends FrameLayout implements INavigationLayout, F
|
|||
}
|
||||
}
|
||||
|
||||
public boolean isKeyboardVisible;
|
||||
private int[] measureSpec = new int[2];
|
||||
@Override
|
||||
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
||||
|
@ -568,83 +517,9 @@ public class ActionBarLayout extends FrameLayout implements INavigationLayout, F
|
|||
widthMeasureSpec = measureSpec[0];
|
||||
heightMeasureSpec = measureSpec[1];
|
||||
}
|
||||
isKeyboardVisible = measureKeyboardHeight() > dp(20);
|
||||
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
|
||||
}
|
||||
|
||||
private int savedBottomSheetTabsTop;
|
||||
@Override
|
||||
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
|
||||
final int count = getChildCount();
|
||||
|
||||
final int parentLeft = getPaddingLeft();
|
||||
final int parentRight = right - left - getPaddingRight();
|
||||
|
||||
final int parentTop = getPaddingTop();
|
||||
final int parentBottom = bottom - top - getPaddingBottom();
|
||||
|
||||
for (int i = 0; i < count; i++) {
|
||||
final View child = getChildAt(i);
|
||||
if (child.getVisibility() != GONE) {
|
||||
if (child == bottomSheetTabs) {
|
||||
bottomSheetTabs.updateCurrentAccount();
|
||||
}
|
||||
|
||||
final LayoutParams lp = (LayoutParams) child.getLayoutParams();
|
||||
|
||||
final int width = child.getMeasuredWidth();
|
||||
final int height = child.getMeasuredHeight();
|
||||
|
||||
int childLeft;
|
||||
int childTop;
|
||||
|
||||
int gravity = lp.gravity;
|
||||
if (gravity == -1) {
|
||||
gravity = Gravity.TOP | Gravity.START;
|
||||
}
|
||||
|
||||
final int layoutDirection = getLayoutDirection();
|
||||
final int absoluteGravity = Gravity.getAbsoluteGravity(gravity, layoutDirection);
|
||||
final int verticalGravity = gravity & Gravity.VERTICAL_GRAVITY_MASK;
|
||||
|
||||
switch (absoluteGravity & Gravity.HORIZONTAL_GRAVITY_MASK) {
|
||||
case Gravity.CENTER_HORIZONTAL:
|
||||
childLeft = parentLeft + (parentRight - parentLeft - width) / 2 +
|
||||
lp.leftMargin - lp.rightMargin;
|
||||
break;
|
||||
case Gravity.RIGHT:
|
||||
childLeft = parentRight - width - lp.rightMargin;
|
||||
break;
|
||||
case Gravity.LEFT:
|
||||
default:
|
||||
childLeft = parentLeft + lp.leftMargin;
|
||||
}
|
||||
|
||||
switch (verticalGravity) {
|
||||
case Gravity.TOP:
|
||||
childTop = parentTop + lp.topMargin;
|
||||
break;
|
||||
case Gravity.CENTER_VERTICAL:
|
||||
childTop = parentTop + (parentBottom - parentTop - height) / 2 +
|
||||
lp.topMargin - lp.bottomMargin;
|
||||
break;
|
||||
case Gravity.BOTTOM:
|
||||
childTop = parentBottom - height - lp.bottomMargin;
|
||||
break;
|
||||
default:
|
||||
childTop = parentTop + lp.topMargin;
|
||||
}
|
||||
|
||||
if (child == bottomSheetTabs && savedBottomSheetTabsTop != 0 && (isKeyboardVisible || getParent() instanceof View && ((View) getParent()).getHeight() > getHeight())) {
|
||||
childTop = savedBottomSheetTabsTop;
|
||||
} else if (child == bottomSheetTabs) {
|
||||
savedBottomSheetTabsTop = childTop;
|
||||
}
|
||||
child.layout(childLeft, childTop, childLeft + width, childTop + height);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInBubbleMode(boolean value) {
|
||||
inBubbleMode = value;
|
||||
|
@ -765,14 +640,6 @@ public class ActionBarLayout extends FrameLayout implements INavigationLayout, F
|
|||
return super.dispatchKeyEventPreIme(event);
|
||||
}
|
||||
|
||||
private boolean withShadow;
|
||||
|
||||
@Override
|
||||
protected void dispatchDraw(Canvas canvas) {
|
||||
withShadow = true;
|
||||
super.dispatchDraw(canvas);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean drawChild(Canvas canvas, View child, long drawingTime) {
|
||||
if (drawerLayoutContainer != null && drawerLayoutContainer.isDrawCurrentPreviewFragmentAbove()) {
|
||||
|
@ -790,17 +657,11 @@ public class ActionBarLayout extends FrameLayout implements INavigationLayout, F
|
|||
int clipRight = width + getPaddingLeft();
|
||||
|
||||
if (child == containerViewBack) {
|
||||
clipRight = translationX + dp(1);
|
||||
clipRight = translationX + AndroidUtilities.dp(1);
|
||||
} else if (child == containerView) {
|
||||
clipLeft = translationX;
|
||||
}
|
||||
|
||||
final int restoreCount2 = canvas.save();
|
||||
if (child != bottomSheetTabs) {
|
||||
clipBottomSheetTabs(canvas, withShadow);
|
||||
withShadow = false;
|
||||
}
|
||||
|
||||
final int restoreCount = canvas.save();
|
||||
if (!isTransitionAnimationInProgress() && !inPreviewMode) {
|
||||
canvas.clipRect(clipLeft, 0, clipRight, getHeight());
|
||||
|
@ -814,62 +675,24 @@ public class ActionBarLayout extends FrameLayout implements INavigationLayout, F
|
|||
if (translationX != 0 || overrideWidthOffset != -1) {
|
||||
int widthOffset = overrideWidthOffset != -1 ? overrideWidthOffset : width - translationX;
|
||||
if (child == containerView) {
|
||||
float alpha = MathUtils.clamp(widthOffset / (float) dp(20), 0, 1f);
|
||||
layerShadowDrawable.setBounds(translationX - layerShadowDrawable.getIntrinsicWidth(), child.getTop(), translationX, child.getBottom() - getBottomTabsHeight(true));
|
||||
float alpha = MathUtils.clamp(widthOffset / (float) AndroidUtilities.dp(20), 0, 1f);
|
||||
layerShadowDrawable.setBounds(translationX - layerShadowDrawable.getIntrinsicWidth(), child.getTop(), translationX, child.getBottom());
|
||||
layerShadowDrawable.setAlpha((int) (0xff * alpha));
|
||||
layerShadowDrawable.draw(canvas);
|
||||
} else if (child == containerViewBack) {
|
||||
float opacity = MathUtils.clamp(widthOffset / (float) width, 0, 0.8f);
|
||||
scrimPaint.setColor(Color.argb((int)(0x99 * opacity), 0x00, 0x00, 0x00));
|
||||
if (overrideWidthOffset != -1) {
|
||||
canvas.drawRect(0, 0, getWidth(), getHeight() * 1.5f, scrimPaint);
|
||||
canvas.drawRect(0, 0, getWidth(), getHeight(), scrimPaint);
|
||||
} else {
|
||||
canvas.drawRect(clipLeft, 0, clipRight, getHeight() * 1.5f, scrimPaint);
|
||||
canvas.drawRect(clipLeft, 0, clipRight, getHeight(), scrimPaint);
|
||||
}
|
||||
}
|
||||
}
|
||||
canvas.restoreToCount(restoreCount2);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public void parentDraw(View parent, Canvas canvas) {
|
||||
if (bottomSheetTabs != null && getHeight() < parent.getHeight()) {
|
||||
canvas.save();
|
||||
canvas.translate(getX() + bottomSheetTabs.getX(), getY() + bottomSheetTabs.getY());
|
||||
bottomSheetTabs.draw(canvas);
|
||||
canvas.restore();
|
||||
}
|
||||
}
|
||||
|
||||
private final RectF clipRect = new RectF();
|
||||
private final float[] clipRadius = new float[8];
|
||||
private final Path clipPath = new Path();
|
||||
private final Paint clipShadowPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
|
||||
|
||||
public void clipBottomSheetTabs(Canvas canvas, boolean withShadow) {
|
||||
if (bottomSheetTabs == null)
|
||||
return;
|
||||
final int bottomSheetHeight = isKeyboardVisible ? 0 : getBottomTabsHeight(true);
|
||||
final int bottomRadius = Math.min(1, bottomSheetHeight / dp(60)) * dp(10);
|
||||
if (bottomSheetHeight <= 0)
|
||||
return;
|
||||
|
||||
clipRadius[0] = clipRadius[1] = clipRadius[2] = clipRadius[3] = 0; // top
|
||||
clipRadius[4] = clipRadius[5] = clipRadius[6] = clipRadius[7] = bottomRadius; // bottom
|
||||
|
||||
clipPath.rewind();
|
||||
clipRect.set(0, 0, getWidth(), bottomSheetTabs.getY() + bottomSheetTabs.getHeight() - bottomSheetHeight);
|
||||
clipPath.addRoundRect(clipRect, clipRadius, Path.Direction.CW);
|
||||
|
||||
clipShadowPaint.setAlpha(0);
|
||||
if (withShadow) {
|
||||
clipShadowPaint.setShadowLayer(dp(2), 0, dp(1), 0x10000000);
|
||||
canvas.drawPath(clipPath, clipShadowPaint);
|
||||
}
|
||||
canvas.clipPath(clipPath);
|
||||
}
|
||||
|
||||
public void setOverrideWidthOffset(int overrideWidthOffset) {
|
||||
this.overrideWidthOffset = overrideWidthOffset;
|
||||
invalidate();
|
||||
|
@ -919,9 +742,9 @@ public class ActionBarLayout extends FrameLayout implements INavigationLayout, F
|
|||
previewBackgroundDrawable.setBounds(0, 0, getMeasuredWidth(), getMeasuredHeight());
|
||||
previewBackgroundDrawable.draw(canvas);
|
||||
if (previewMenu == null) {
|
||||
int width = dp(32), height = width / 2;
|
||||
int width = AndroidUtilities.dp(32), height = width / 2;
|
||||
int x = (getMeasuredWidth() - width) / 2;
|
||||
int y = (int) (view.getTop() + containerView.getTranslationY() - dp(12 + (Build.VERSION.SDK_INT < 21 ? 20 : 0)));
|
||||
int y = (int) (view.getTop() + containerView.getTranslationY() - AndroidUtilities.dp(12 + (Build.VERSION.SDK_INT < 21 ? 20 : 0)));
|
||||
Theme.moveUpDrawable.setBounds(x, y, x + width, y + height);
|
||||
Theme.moveUpDrawable.draw(canvas);
|
||||
}
|
||||
|
@ -980,7 +803,7 @@ public class ActionBarLayout extends FrameLayout implements INavigationLayout, F
|
|||
parent.removeViewInLayout(lastFragment.actionBar);
|
||||
}
|
||||
}
|
||||
lastFragment.detachSheets();
|
||||
lastFragment.detachStoryViewer();
|
||||
}
|
||||
layoutToIgnore = null;
|
||||
}
|
||||
|
@ -1024,7 +847,7 @@ public class ActionBarLayout extends FrameLayout implements INavigationLayout, F
|
|||
containerViewBack.addView(lastFragment.actionBar);
|
||||
lastFragment.actionBar.setTitleOverlayText(titleOverlayText, titleOverlayTextId, overlayAction);
|
||||
}
|
||||
lastFragment.attachSheets(containerViewBack);
|
||||
lastFragment.attachStoryViewer(containerViewBack);
|
||||
if (!lastFragment.hasOwnBackground && fragmentView.getBackground() == null) {
|
||||
fragmentView.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite));
|
||||
}
|
||||
|
@ -1121,13 +944,12 @@ public class ActionBarLayout extends FrameLayout implements INavigationLayout, F
|
|||
}
|
||||
} else {
|
||||
distToMove = x;
|
||||
int duration = Math.max((int) (320.0f / containerView.getMeasuredWidth() * distToMove), 120);
|
||||
int duration = Math.max((int) (200.0f / containerView.getMeasuredWidth() * distToMove), 50);
|
||||
if (!overrideTransition) {
|
||||
animatorSet.playTogether(
|
||||
ObjectAnimator.ofFloat(containerView, View.TRANSLATION_X, 0).setDuration(duration),
|
||||
ObjectAnimator.ofFloat(this, "innerTranslationX", 0.0f).setDuration(duration)
|
||||
);
|
||||
animatorSet.setInterpolator(CubicBezierInterpolator.EASE_OUT_QUINT);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1242,7 +1064,7 @@ public class ActionBarLayout extends FrameLayout implements INavigationLayout, F
|
|||
if (transitionAnimationPreviewMode) {
|
||||
return false;
|
||||
}
|
||||
if (transitionAnimationInProgress && (transitionAnimationStartTime < System.currentTimeMillis() - 1500 || inPreviewMode)) {
|
||||
if (transitionAnimationInProgress && transitionAnimationStartTime < System.currentTimeMillis() - 1500) {
|
||||
onAnimationEndCheck(true);
|
||||
}
|
||||
return transitionAnimationInProgress;
|
||||
|
@ -1297,7 +1119,7 @@ public class ActionBarLayout extends FrameLayout implements INavigationLayout, F
|
|||
parent.removeViewInLayout(fragment.actionBar);
|
||||
}
|
||||
}
|
||||
fragment.detachSheets();
|
||||
fragment.detachStoryViewer();
|
||||
}
|
||||
containerViewBack.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
|
@ -1359,8 +1181,8 @@ public class ActionBarLayout extends FrameLayout implements INavigationLayout, F
|
|||
containerView.setScaleX(0.7f + 0.3f * interpolated);
|
||||
containerView.setScaleY(0.7f + 0.3f * interpolated);
|
||||
if (previewMenu != null) {
|
||||
containerView.setTranslationY(dp(40) * (1f - interpolated));
|
||||
previewMenu.setTranslationY(-dp(40 + 30) * (1f - interpolated));
|
||||
containerView.setTranslationY(AndroidUtilities.dp(40) * (1f - interpolated));
|
||||
previewMenu.setTranslationY(-AndroidUtilities.dp(40 + 30) * (1f - interpolated));
|
||||
previewMenu.setScaleX(0.95f + 0.05f * interpolated);
|
||||
previewMenu.setScaleY(0.95f + 0.05f * interpolated);
|
||||
}
|
||||
|
@ -1369,7 +1191,7 @@ public class ActionBarLayout extends FrameLayout implements INavigationLayout, F
|
|||
containerView.invalidate();
|
||||
invalidate();
|
||||
} else {
|
||||
containerView.setTranslationX(dp(48) * (1.0f - interpolated));
|
||||
containerView.setTranslationX(AndroidUtilities.dp(48) * (1.0f - interpolated));
|
||||
}
|
||||
} else {
|
||||
float clampedReverseInterpolated = MathUtils.clamp(1f - interpolated, 0, 1);
|
||||
|
@ -1384,7 +1206,7 @@ public class ActionBarLayout extends FrameLayout implements INavigationLayout, F
|
|||
containerView.invalidate();
|
||||
invalidate();
|
||||
} else {
|
||||
containerViewBack.setTranslationX(dp(48) * interpolated);
|
||||
containerViewBack.setTranslationX(AndroidUtilities.dp(48) * interpolated);
|
||||
}
|
||||
}
|
||||
if (animationProgress < 1) {
|
||||
|
@ -1489,11 +1311,11 @@ public class ActionBarLayout extends FrameLayout implements INavigationLayout, F
|
|||
if (menu != null) {
|
||||
containerViewBack.addView(menu);
|
||||
menu.measure(MeasureSpec.makeMeasureSpec(getMeasuredWidth(), MeasureSpec.AT_MOST), MeasureSpec.makeMeasureSpec(getMeasuredHeight(), MeasureSpec.AT_MOST));
|
||||
menuHeight = menu.getMeasuredHeight() + dp(24);
|
||||
menuHeight = menu.getMeasuredHeight() + AndroidUtilities.dp(24);
|
||||
FrameLayout.LayoutParams menuParams = (FrameLayout.LayoutParams) menu.getLayoutParams();
|
||||
menuParams.width = LayoutHelper.WRAP_CONTENT;
|
||||
menuParams.height = LayoutHelper.WRAP_CONTENT;
|
||||
menuParams.topMargin = getMeasuredHeight() - menuHeight - dp(6);
|
||||
menuParams.topMargin = getMeasuredHeight() - menuHeight - AndroidUtilities.dp(6);
|
||||
menu.setLayoutParams(menuParams);
|
||||
}
|
||||
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) wrappedView.getLayoutParams();
|
||||
|
@ -1506,14 +1328,14 @@ public class ActionBarLayout extends FrameLayout implements INavigationLayout, F
|
|||
layoutParams.height = height;
|
||||
layoutParams.topMargin = statusBarHeight + (getMeasuredHeight() - statusBarHeight - height) / 2;
|
||||
} else {
|
||||
layoutParams.topMargin = layoutParams.bottomMargin = dp(menu != null ? 0 : 24);
|
||||
layoutParams.topMargin = layoutParams.bottomMargin = AndroidUtilities.dp(menu != null ? 0 : 24);
|
||||
layoutParams.topMargin += AndroidUtilities.statusBarHeight;
|
||||
}
|
||||
if (menu != null) {
|
||||
layoutParams.bottomMargin += menuHeight + dp(8);
|
||||
layoutParams.bottomMargin += menuHeight + AndroidUtilities.dp(8);
|
||||
// layoutParams.topMargin += AndroidUtilities.dp(32);
|
||||
}
|
||||
layoutParams.rightMargin = layoutParams.leftMargin = dp(8);
|
||||
layoutParams.rightMargin = layoutParams.leftMargin = AndroidUtilities.dp(8);
|
||||
} else {
|
||||
layoutParams.topMargin = layoutParams.bottomMargin = layoutParams.rightMargin = layoutParams.leftMargin = 0;
|
||||
}
|
||||
|
@ -1526,7 +1348,7 @@ public class ActionBarLayout extends FrameLayout implements INavigationLayout, F
|
|||
containerViewBack.addView(fragment.actionBar);
|
||||
fragment.actionBar.setTitleOverlayText(titleOverlayText, titleOverlayTextId, overlayAction);
|
||||
}
|
||||
fragment.attachSheets(containerViewBack);
|
||||
fragment.attachStoryViewer(containerViewBack);
|
||||
fragmentsStack.add(fragment);
|
||||
|
||||
onFragmentStackChanged("presentFragment");
|
||||
|
@ -1550,11 +1372,11 @@ public class ActionBarLayout extends FrameLayout implements INavigationLayout, F
|
|||
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
|
||||
@Override
|
||||
public void getOutline(View view, Outline outline) {
|
||||
outline.setRoundRect(0, AndroidUtilities.statusBarHeight, view.getMeasuredWidth(), view.getMeasuredHeight(), dp(6));
|
||||
outline.setRoundRect(0, AndroidUtilities.statusBarHeight, view.getMeasuredWidth(), view.getMeasuredHeight(), AndroidUtilities.dp(6));
|
||||
}
|
||||
});
|
||||
fragmentView.setClipToOutline(true);
|
||||
fragmentView.setElevation(dp(4));
|
||||
fragmentView.setElevation(AndroidUtilities.dp(4));
|
||||
}
|
||||
if (previewBackgroundDrawable == null) {
|
||||
previewBackgroundDrawable = new ColorDrawable(0x2e000000);
|
||||
|
@ -1789,7 +1611,7 @@ public class ActionBarLayout extends FrameLayout implements INavigationLayout, F
|
|||
parent.removeView(previousFragment.fragmentView);
|
||||
}
|
||||
}
|
||||
previousFragment.detachSheets();
|
||||
previousFragment.detachStoryViewer();
|
||||
}
|
||||
fragmentsStack.add(fragment);
|
||||
if (position != INavigationLayout.FORCE_NOT_ATTACH_VIEW) {
|
||||
|
@ -1843,7 +1665,7 @@ public class ActionBarLayout extends FrameLayout implements INavigationLayout, F
|
|||
containerView.addView(fragment.actionBar);
|
||||
fragment.actionBar.setTitleOverlayText(titleOverlayText, titleOverlayTextId, overlayAction);
|
||||
}
|
||||
fragment.attachSheets(containerView);
|
||||
fragment.attachStoryViewer(containerView);
|
||||
}
|
||||
|
||||
private void attachViewTo(BaseFragment fragment, int position) {
|
||||
|
@ -1872,7 +1694,7 @@ public class ActionBarLayout extends FrameLayout implements INavigationLayout, F
|
|||
containerView.addView(fragment.actionBar);
|
||||
fragment.actionBar.setTitleOverlayText(titleOverlayText, titleOverlayTextId, overlayAction);
|
||||
}
|
||||
fragment.attachSheets(containerView);
|
||||
fragment.attachStoryViewer(containerView);
|
||||
}
|
||||
|
||||
private void closeLastFragmentInternalRemoveOld(BaseFragment fragment) {
|
||||
|
@ -1896,7 +1718,7 @@ public class ActionBarLayout extends FrameLayout implements INavigationLayout, F
|
|||
float nextTranslation = -dy;
|
||||
if (nextTranslation > 0) {
|
||||
nextTranslation = 0;
|
||||
} else if (nextTranslation < -dp(60)) {
|
||||
} else if (nextTranslation < -AndroidUtilities.dp(60)) {
|
||||
nextTranslation = 0;
|
||||
expandPreviewFragment();
|
||||
}
|
||||
|
@ -2021,7 +1843,7 @@ public class ActionBarLayout extends FrameLayout implements INavigationLayout, F
|
|||
containerView.addView(previousFragment.actionBar);
|
||||
previousFragment.actionBar.setTitleOverlayText(titleOverlayText, titleOverlayTextId, overlayAction);
|
||||
}
|
||||
previousFragment.attachSheets(containerView);
|
||||
previousFragment.attachStoryViewer(containerView);
|
||||
}
|
||||
|
||||
newFragment = previousFragment;
|
||||
|
@ -2195,7 +2017,7 @@ public class ActionBarLayout extends FrameLayout implements INavigationLayout, F
|
|||
containerView.addView(previousFragment.actionBar);
|
||||
previousFragment.actionBar.setTitleOverlayText(titleOverlayText, titleOverlayTextId, overlayAction);
|
||||
}
|
||||
previousFragment.attachSheets(containerView);
|
||||
previousFragment.attachStoryViewer(containerView);
|
||||
previousFragment.onResume();
|
||||
currentActionBar = previousFragment.actionBar;
|
||||
if (!previousFragment.hasOwnBackground && fragmentView.getBackground() == null) {
|
||||
|
@ -2813,27 +2635,10 @@ public class ActionBarLayout extends FrameLayout implements INavigationLayout, F
|
|||
return Math.max(0, usableViewHeight - (rect.bottom - rect.top));
|
||||
}
|
||||
|
||||
private boolean tabsEvents;
|
||||
@Override
|
||||
public boolean dispatchTouchEvent(MotionEvent ev) {
|
||||
final boolean tabs = ev.getY() > getHeight() - getBottomTabsHeight(true);
|
||||
if (
|
||||
getLastFragment() != null &&
|
||||
getLastFragment().getLastSheet() != null &&
|
||||
getLastFragment().getLastSheet().attachedToParent()
|
||||
) {
|
||||
if (ev.getAction() == MotionEvent.ACTION_DOWN) {
|
||||
tabsEvents = tabs;
|
||||
}
|
||||
if (!tabsEvents) {
|
||||
if (ev.getAction() == MotionEvent.ACTION_UP || ev.getAction() == MotionEvent.ACTION_CANCEL) {
|
||||
tabsEvents = false;
|
||||
}
|
||||
return getLastFragment().getLastSheet().getWindowView().dispatchTouchEvent(ev);
|
||||
}
|
||||
}
|
||||
if (ev.getAction() == MotionEvent.ACTION_UP || ev.getAction() == MotionEvent.ACTION_CANCEL) {
|
||||
tabsEvents = false;
|
||||
if (getLastFragment() != null && getLastFragment().getLastStoryViewer() != null && getLastFragment().getLastStoryViewer().attachedToParent()) {
|
||||
return getLastFragment().getLastStoryViewer().windowView.dispatchTouchEvent(ev);
|
||||
}
|
||||
return super.dispatchTouchEvent(ev);
|
||||
}
|
||||
|
@ -2853,69 +2658,4 @@ public class ActionBarLayout extends FrameLayout implements INavigationLayout, F
|
|||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BottomSheetTabs getBottomSheetTabs() {
|
||||
return bottomSheetTabs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setNavigationBarColor(int color) {
|
||||
if (bottomSheetTabs != null) {
|
||||
bottomSheetTabs.setNavigationBarColor(color, !(startedTracking || animationInProgress));
|
||||
}
|
||||
}
|
||||
|
||||
private ValueAnimator bottomTabsAnimator;
|
||||
private float bottomTabsProgress;
|
||||
private int bottomTabsHeight;
|
||||
|
||||
public void updateBottomTabsVisibility(boolean animated) {
|
||||
if (bottomSheetTabs == null) {
|
||||
return;
|
||||
}
|
||||
if (bottomTabsAnimator != null) {
|
||||
ValueAnimator prev = bottomTabsAnimator;
|
||||
bottomTabsAnimator = null;
|
||||
prev.cancel();
|
||||
}
|
||||
if (bottomTabsHeight == bottomSheetTabs.getExpandedHeight())
|
||||
return;
|
||||
bottomTabsHeight = bottomSheetTabs.getExpandedHeight();
|
||||
requestLayout();
|
||||
containerView.requestLayout();
|
||||
containerViewBack.requestLayout();
|
||||
if (animated) {
|
||||
bottomTabsAnimator = ValueAnimator.ofFloat(bottomTabsProgress, bottomTabsHeight);
|
||||
bottomTabsAnimator.addUpdateListener(anm -> {
|
||||
bottomTabsProgress = (float) anm.getAnimatedValue();
|
||||
invalidate();
|
||||
});
|
||||
bottomTabsAnimator.addListener(new AnimatorListenerAdapter() {
|
||||
@Override
|
||||
public void onAnimationEnd(Animator animation) {
|
||||
if (bottomTabsAnimator == animation) {
|
||||
bottomTabsProgress = bottomTabsHeight;
|
||||
invalidate();
|
||||
}
|
||||
}
|
||||
});
|
||||
bottomTabsAnimator.setDuration(AdjustPanLayoutHelper.keyboardDuration);
|
||||
bottomTabsAnimator.setInterpolator(AdjustPanLayoutHelper.keyboardInterpolator);
|
||||
bottomTabsAnimator.start();
|
||||
} else {
|
||||
bottomTabsProgress = bottomTabsHeight;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBottomTabsHeight(boolean animated) {
|
||||
if (!main) return 0;
|
||||
if (animated) {
|
||||
return (int) bottomTabsProgress;
|
||||
} else {
|
||||
return bottomTabsHeight;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -28,7 +28,6 @@ import com.google.android.exoplayer2.util.Log;
|
|||
import org.telegram.messenger.AndroidUtilities;
|
||||
import org.telegram.messenger.AnimationNotificationsLocker;
|
||||
import org.telegram.messenger.UserConfig;
|
||||
import org.telegram.ui.LaunchActivity;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
@ -173,11 +172,7 @@ public class AdjustPanLayoutHelper {
|
|||
additionalContentHeight = ((View) viewParent).getHeight() - contentHeight;
|
||||
}
|
||||
}
|
||||
int bottomTabsHeight = 0;
|
||||
if (LaunchActivity.instance != null && LaunchActivity.instance.getBottomSheetTabs() != null) {
|
||||
bottomTabsHeight += LaunchActivity.instance.getBottomSheetTabs().getExpandedHeight();
|
||||
}
|
||||
setViewHeight(Math.max(previousHeight, contentHeight + additionalContentHeight + bottomTabsHeight));
|
||||
setViewHeight(Math.max(previousHeight, contentHeight + additionalContentHeight));
|
||||
resizableView.requestLayout();
|
||||
|
||||
onTransitionStart(isKeyboardVisible, previousHeight, contentHeight);
|
||||
|
@ -191,7 +186,7 @@ public class AdjustPanLayoutHelper {
|
|||
parent.setTranslationY(-dy);
|
||||
onPanTranslationUpdate(dy, 1f, isKeyboardVisible);
|
||||
from = -dy;
|
||||
to = -bottomTabsHeight;
|
||||
to = 0;
|
||||
inverse = true;
|
||||
} else {
|
||||
parent.setTranslationY(previousStartOffset);
|
||||
|
@ -224,7 +219,7 @@ public class AdjustPanLayoutHelper {
|
|||
setViewHeight(ViewGroup.LayoutParams.MATCH_PARENT);
|
||||
viewsToHeightSet.clear();
|
||||
resizableView.requestLayout();
|
||||
onPanTranslationUpdate(0, isKeyboardVisible ? 1f : 0f, isKeyboardVisible);
|
||||
onPanTranslationUpdate(0, isKeyboardVisible ? 1f : 0f, isKeyboardVisible);
|
||||
parent.setTranslationY(0);
|
||||
onTransitionEnd();
|
||||
}
|
||||
|
|
|
@ -32,7 +32,6 @@ import android.view.accessibility.AccessibilityManager;
|
|||
import android.widget.FrameLayout;
|
||||
|
||||
import androidx.annotation.CallSuper;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.core.graphics.ColorUtils;
|
||||
|
||||
import org.telegram.messenger.AccountInstance;
|
||||
|
@ -56,7 +55,6 @@ import org.telegram.tgnet.ConnectionsManager;
|
|||
import org.telegram.ui.Components.LayoutHelper;
|
||||
import org.telegram.ui.LaunchActivity;
|
||||
import org.telegram.ui.Stories.StoryViewer;
|
||||
import org.telegram.ui.bots.BotWebViewAttachedSheet;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
|
@ -83,72 +81,30 @@ public abstract class BaseFragment {
|
|||
private boolean removingFromStack;
|
||||
private PreviewDelegate previewDelegate;
|
||||
protected Theme.ResourcesProvider resourceProvider;
|
||||
// public ArrayList<StoryViewer> storyViewerStack;
|
||||
// public ArrayList<BotWebViewAttachedSheet> botsStack;
|
||||
//
|
||||
public ArrayList<AttachedSheet> sheetsStack;
|
||||
public ArrayList<StoryViewer> storyViewerStack;
|
||||
|
||||
public static interface AttachedSheet {
|
||||
public View getWindowView();
|
||||
public boolean isShown();
|
||||
public void dismiss();
|
||||
default void dismiss(boolean tabs) { dismiss(); }
|
||||
public void release();
|
||||
|
||||
public boolean isFullyVisible();
|
||||
|
||||
public boolean attachedToParent();
|
||||
|
||||
public boolean onBackPressed();
|
||||
public boolean showDialog(Dialog dialog);
|
||||
|
||||
public void setKeyboardHeightFromParent(int keyboardHeight);
|
||||
|
||||
public int getNavigationBarColor(int color);
|
||||
|
||||
public void setOnDismissListener(Runnable onDismiss);
|
||||
}
|
||||
|
||||
public static interface AttachedSheetWindow {}
|
||||
|
||||
@Nullable
|
||||
public StoryViewer getLastStoryViewer() {
|
||||
if (sheetsStack == null || sheetsStack.isEmpty())
|
||||
if (storyViewerStack == null || storyViewerStack.isEmpty())
|
||||
return null;
|
||||
for (int i = sheetsStack.size() - 1; i >= 0; --i) {
|
||||
if (sheetsStack.get(i) instanceof StoryViewer && sheetsStack.get(i).isShown()) {
|
||||
return (StoryViewer) sheetsStack.get(i);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public AttachedSheet getLastSheet() {
|
||||
if (sheetsStack == null || sheetsStack.isEmpty())
|
||||
return null;
|
||||
for (int i = sheetsStack.size() - 1; i >= 0; --i) {
|
||||
if (sheetsStack.get(i).isShown()) {
|
||||
return sheetsStack.get(i);
|
||||
for (int i = storyViewerStack.size() - 1; i >= 0; --i) {
|
||||
if (storyViewerStack.get(i).isShown()) {
|
||||
return storyViewerStack.get(i);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean hasStoryViewer() {
|
||||
return getLastStoryViewer() != null;
|
||||
return storyViewerStack != null && !storyViewerStack.isEmpty();
|
||||
}
|
||||
|
||||
public boolean hasSheet() {
|
||||
return sheetsStack != null && !sheetsStack.isEmpty();
|
||||
}
|
||||
|
||||
public void clearSheets() {
|
||||
if (sheetsStack == null || sheetsStack.isEmpty())
|
||||
public void clearStoryViewers() {
|
||||
if (storyViewerStack == null || storyViewerStack.isEmpty())
|
||||
return;
|
||||
for (int i = sheetsStack.size() - 1; i >= 0; --i) {
|
||||
sheetsStack.get(i).dismiss(true);
|
||||
for (int i = storyViewerStack.size() - 1; i >= 0; --i) {
|
||||
storyViewerStack.get(i).release();
|
||||
}
|
||||
sheetsStack.clear();
|
||||
storyViewerStack.clear();
|
||||
}
|
||||
|
||||
public BaseFragment() {
|
||||
|
@ -281,12 +237,12 @@ public abstract class BaseFragment {
|
|||
}
|
||||
actionBar = null;
|
||||
}
|
||||
clearSheets();
|
||||
clearStoryViewers();
|
||||
parentLayout = null;
|
||||
}
|
||||
|
||||
public void onRemoveFromParent() {
|
||||
clearSheets();
|
||||
|
||||
}
|
||||
|
||||
public void setParentFragment(BaseFragment fragment) {
|
||||
|
@ -310,7 +266,7 @@ public abstract class BaseFragment {
|
|||
}
|
||||
if (parentLayout != null && parentLayout.getView().getContext() != fragmentView.getContext()) {
|
||||
fragmentView = null;
|
||||
clearSheets();
|
||||
clearStoryViewers();
|
||||
}
|
||||
}
|
||||
if (actionBar != null) {
|
||||
|
@ -499,17 +455,17 @@ public abstract class BaseFragment {
|
|||
}
|
||||
|
||||
public boolean onBackPressed() {
|
||||
if (closeSheet()) {
|
||||
if (closeStoryViewer()) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean closeSheet() {
|
||||
if (sheetsStack != null) {
|
||||
for (int i = sheetsStack.size() - 1; i >= 0; --i) {
|
||||
if (sheetsStack.get(i).isShown()) {
|
||||
return sheetsStack.get(i).onBackPressed();
|
||||
public boolean closeStoryViewer() {
|
||||
if (storyViewerStack != null) {
|
||||
for (int i = storyViewerStack.size() - 1; i >= 0; --i) {
|
||||
if (storyViewerStack.get(i).isShown()) {
|
||||
return storyViewerStack.get(i).onBackPressed();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -666,16 +622,6 @@ public abstract class BaseFragment {
|
|||
}
|
||||
}
|
||||
}
|
||||
if (fullyVisibleListener != null) {
|
||||
Runnable c = fullyVisibleListener;
|
||||
fullyVisibleListener = null;
|
||||
c.run();
|
||||
}
|
||||
}
|
||||
|
||||
private Runnable fullyVisibleListener;
|
||||
public void whenFullyVisible(Runnable callback) {
|
||||
fullyVisibleListener = callback;
|
||||
}
|
||||
|
||||
public int getPreviewHeight() {
|
||||
|
@ -706,12 +652,11 @@ public abstract class BaseFragment {
|
|||
if (dialog == null || parentLayout == null || parentLayout.isTransitionAnimationInProgress() || parentLayout.isSwipeInProgress() || !allowInTransition && parentLayout.checkTransitionAnimation()) {
|
||||
return null;
|
||||
}
|
||||
if (sheetsStack != null) {
|
||||
for (int i = sheetsStack.size() - 1; i >= 0; --i) {
|
||||
if (sheetsStack.get(i).isShown()) {
|
||||
if (sheetsStack.get(i).showDialog(dialog)) {
|
||||
return dialog;
|
||||
}
|
||||
if (storyViewerStack != null) {
|
||||
for (int i = storyViewerStack.size() - 1; i >= 0; --i) {
|
||||
if (storyViewerStack.get(i).isShown()) {
|
||||
storyViewerStack.get(i).showDialog(dialog);
|
||||
return dialog;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -874,7 +819,7 @@ public abstract class BaseFragment {
|
|||
return null;
|
||||
}
|
||||
BottomSheet[] bottomSheet = new BottomSheet[1];
|
||||
INavigationLayout[] actionBarLayout = new INavigationLayout[]{INavigationLayout.newLayout(getParentActivity(), false, () -> bottomSheet[0])};
|
||||
INavigationLayout[] actionBarLayout = new INavigationLayout[]{INavigationLayout.newLayout(getParentActivity(), () -> bottomSheet[0])};
|
||||
actionBarLayout[0].setIsSheet(true);
|
||||
LaunchActivity.instance.sheetFragmentsStack.add(actionBarLayout[0]);
|
||||
fragment.onTransitionAnimationStart(true, false);
|
||||
|
@ -1003,11 +948,11 @@ public abstract class BaseFragment {
|
|||
|
||||
public int getNavigationBarColor() {
|
||||
int color = Theme.getColor(Theme.key_windowBackgroundGray, getResourceProvider());
|
||||
if (sheetsStack != null) {
|
||||
for (int i = 0; i < sheetsStack.size(); ++i) {
|
||||
AttachedSheet sheet = sheetsStack.get(i);
|
||||
if (sheet.attachedToParent()) {
|
||||
color = sheet.getNavigationBarColor(color);
|
||||
if (storyViewerStack != null) {
|
||||
for (int i = storyViewerStack.size() - 1; i >= 0; --i) {
|
||||
StoryViewer storyViewer = storyViewerStack.get(i);
|
||||
if (storyViewer.attachedToParent()) {
|
||||
color = storyViewer.getNavigationBarColor(color);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1029,9 +974,6 @@ public abstract class BaseFragment {
|
|||
}
|
||||
}
|
||||
}
|
||||
if (parentLayout != null) {
|
||||
parentLayout.setNavigationBarColor(color);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isBeginToShow() {
|
||||
|
@ -1115,46 +1057,34 @@ public abstract class BaseFragment {
|
|||
|
||||
}
|
||||
|
||||
public void attachSheets(ActionBarLayout.LayoutContainer parentLayout) {
|
||||
if (sheetsStack != null) {
|
||||
for (int i = 0; i < sheetsStack.size(); ++i) {
|
||||
AttachedSheet sheet = sheetsStack.get(i);
|
||||
if (sheet != null && sheet.attachedToParent()) {
|
||||
AndroidUtilities.removeFromParent(sheet.getWindowView());
|
||||
parentLayout.addView(sheet.getWindowView());
|
||||
public void attachStoryViewer(ActionBarLayout.LayoutContainer parentLayout) {
|
||||
if (storyViewerStack != null) {
|
||||
for (int i = 0; i < storyViewerStack.size(); ++i) {
|
||||
StoryViewer storyViewer = storyViewerStack.get(i);
|
||||
if (storyViewer != null && storyViewer.attachedToParent()) {
|
||||
AndroidUtilities.removeFromParent(storyViewer.windowView);
|
||||
parentLayout.addView(storyViewer.windowView);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void detachSheets() {
|
||||
if (sheetsStack != null) {
|
||||
for (int i = 0; i < sheetsStack.size(); ++i) {
|
||||
AttachedSheet sheet = sheetsStack.get(i);
|
||||
if (sheet != null && sheet.attachedToParent()) {
|
||||
AndroidUtilities.removeFromParent(sheet.getWindowView());
|
||||
public void detachStoryViewer() {
|
||||
if (storyViewerStack != null) {
|
||||
for (int i = 0; i < storyViewerStack.size(); ++i) {
|
||||
StoryViewer storyViewer = storyViewerStack.get(i);
|
||||
if (storyViewer != null && storyViewer.attachedToParent()) {
|
||||
AndroidUtilities.removeFromParent(storyViewer.windowView);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isStoryViewer(View child) {
|
||||
if (sheetsStack != null) {
|
||||
for (int i = 0; i < sheetsStack.size(); ++i) {
|
||||
AttachedSheet sheet = sheetsStack.get(i);
|
||||
if (sheet instanceof StoryViewer && child == sheet.getWindowView()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isBotView(View child) {
|
||||
if (sheetsStack != null) {
|
||||
for (int i = 0; i < sheetsStack.size(); ++i) {
|
||||
AttachedSheet sheet = sheetsStack.get(i);
|
||||
if (sheet instanceof BotWebViewAttachedSheet && child == sheet.getWindowView()) {
|
||||
if (storyViewerStack != null) {
|
||||
for (int i = 0; i < storyViewerStack.size(); ++i) {
|
||||
StoryViewer storyViewer = storyViewerStack.get(i);
|
||||
if (storyViewer != null && child == storyViewer.windowView) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -1163,9 +1093,9 @@ public abstract class BaseFragment {
|
|||
}
|
||||
|
||||
public void setKeyboardHeightFromParent(int keyboardHeight) {
|
||||
if (sheetsStack != null) {
|
||||
for (int i = 0; i < sheetsStack.size(); ++i) {
|
||||
AttachedSheet storyViewer = sheetsStack.get(i);
|
||||
if (storyViewerStack != null) {
|
||||
for (int i = 0; i < storyViewerStack.size(); ++i) {
|
||||
StoryViewer storyViewer = storyViewerStack.get(i);
|
||||
if (storyViewer != null) {
|
||||
storyViewer.setKeyboardHeightFromParent(keyboardHeight);
|
||||
}
|
||||
|
@ -1178,48 +1108,31 @@ public abstract class BaseFragment {
|
|||
}
|
||||
|
||||
public StoryViewer getOrCreateStoryViewer() {
|
||||
if (sheetsStack == null) {
|
||||
sheetsStack = new ArrayList<>();
|
||||
if (storyViewerStack == null) {
|
||||
storyViewerStack = new ArrayList<>();
|
||||
}
|
||||
StoryViewer storyViewer = null;
|
||||
if (!sheetsStack.isEmpty() && sheetsStack.get(sheetsStack.size() - 1) instanceof StoryViewer) {
|
||||
storyViewer = (StoryViewer) sheetsStack.get(sheetsStack.size() - 1);
|
||||
}
|
||||
if (storyViewer == null) {
|
||||
storyViewer = new StoryViewer(this);
|
||||
if (storyViewerStack.isEmpty()) {
|
||||
StoryViewer storyViewer = new StoryViewer(this);
|
||||
if (parentLayout != null && parentLayout.isSheet()) {
|
||||
storyViewer.fromBottomSheet = true;
|
||||
}
|
||||
sheetsStack.add(storyViewer);
|
||||
storyViewerStack.add(storyViewer);
|
||||
}
|
||||
return storyViewer;
|
||||
return storyViewerStack.get(0);
|
||||
}
|
||||
|
||||
public StoryViewer createOverlayStoryViewer() {
|
||||
if (sheetsStack == null) {
|
||||
sheetsStack = new ArrayList<>();
|
||||
if (storyViewerStack == null) {
|
||||
storyViewerStack = new ArrayList<>();
|
||||
}
|
||||
StoryViewer storyViewer = new StoryViewer(this);
|
||||
if (parentLayout != null && parentLayout.isSheet()) {
|
||||
storyViewer.fromBottomSheet = true;
|
||||
}
|
||||
sheetsStack.add(storyViewer);
|
||||
storyViewerStack.add(storyViewer);
|
||||
return storyViewer;
|
||||
}
|
||||
|
||||
public BotWebViewAttachedSheet createBotViewer() {
|
||||
if (sheetsStack == null) {
|
||||
sheetsStack = new ArrayList<>();
|
||||
}
|
||||
BotWebViewAttachedSheet botViewer = new BotWebViewAttachedSheet(this);
|
||||
StoryViewer storyViewer = getLastStoryViewer();
|
||||
if (storyViewer != null) {
|
||||
storyViewer.listenToAttachedSheet(botViewer);
|
||||
}
|
||||
sheetsStack.add(botViewer);
|
||||
return botViewer;
|
||||
}
|
||||
|
||||
public void onBottomSheetCreated() {
|
||||
|
||||
}
|
||||
|
|
|
@ -191,7 +191,6 @@ public class BottomSheet extends Dialog {
|
|||
|
||||
private ValueAnimator keyboardContentAnimator;
|
||||
public boolean smoothKeyboardAnimationEnabled;
|
||||
public boolean smoothKeyboardByBottom;
|
||||
private boolean openNoDelay;
|
||||
|
||||
private float hideSystemVerticalInsetsProgress;
|
||||
|
@ -588,8 +587,8 @@ public class BottomSheet extends Dialog {
|
|||
if (lastInsets != null && Build.VERSION.SDK_INT >= 21) {
|
||||
l += getLeftInset();
|
||||
}
|
||||
if (smoothKeyboardAnimationEnabled && startAnimationRunnable == null && keyboardChanged && !dismissed && (smoothKeyboardByBottom ? containerView.getBottom() != t + containerView.getMeasuredHeight() : containerView.getTop() != t) || smoothContainerViewLayoutUntil > 0 && System.currentTimeMillis() < smoothContainerViewLayoutUntil) {
|
||||
containerView.setTranslationY(smoothKeyboardByBottom ? containerView.getBottom() - (t + containerView.getMeasuredHeight()) : containerView.getTop() - t);
|
||||
if (smoothKeyboardAnimationEnabled && startAnimationRunnable == null && keyboardChanged && !dismissed && containerView.getTop() != t || smoothContainerViewLayoutUntil > 0 && System.currentTimeMillis() < smoothContainerViewLayoutUntil) {
|
||||
containerView.setTranslationY(containerView.getTop() - t);
|
||||
onSmoothContainerViewLayout(containerView.getTranslationY());
|
||||
if (keyboardContentAnimator != null) {
|
||||
keyboardContentAnimator.cancel();
|
||||
|
|
|
@ -1,692 +0,0 @@
|
|||
package org.telegram.ui.ActionBar;
|
||||
|
||||
import static org.telegram.messenger.AndroidUtilities.dp;
|
||||
import static org.telegram.messenger.AndroidUtilities.lerp;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.Path;
|
||||
import android.graphics.RectF;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Bundle;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.core.graphics.ColorUtils;
|
||||
|
||||
import org.telegram.messenger.AndroidUtilities;
|
||||
import org.telegram.messenger.ContactsController;
|
||||
import org.telegram.messenger.FileLog;
|
||||
import org.telegram.messenger.LocaleController;
|
||||
import org.telegram.messenger.MessagesController;
|
||||
import org.telegram.messenger.R;
|
||||
import org.telegram.messenger.UserConfig;
|
||||
import org.telegram.messenger.UserObject;
|
||||
import org.telegram.messenger.Utilities;
|
||||
import org.telegram.tgnet.TLRPC;
|
||||
import org.telegram.ui.ChatActivity;
|
||||
import org.telegram.ui.Components.AnimatedColor;
|
||||
import org.telegram.ui.Components.AnimatedFloat;
|
||||
import org.telegram.ui.Components.CubicBezierInterpolator;
|
||||
import org.telegram.ui.Components.Text;
|
||||
import org.telegram.ui.LaunchActivity;
|
||||
import org.telegram.ui.bots.BotWebViewAttachedSheet;
|
||||
import org.telegram.ui.bots.BotWebViewContainer;
|
||||
import org.telegram.ui.bots.BotWebViewSheet;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
||||
public class BottomSheetTabs extends FrameLayout {
|
||||
|
||||
private final Paint backgroundPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
|
||||
public boolean drawTabs = true;
|
||||
|
||||
private final ActionBarLayout actionBarLayout;
|
||||
|
||||
public BottomSheetTabs(Context context, ActionBarLayout actionBarLayout) {
|
||||
super(context);
|
||||
this.actionBarLayout = actionBarLayout;
|
||||
|
||||
setNavigationBarColor(Theme.getColor(Theme.key_windowBackgroundGray));
|
||||
|
||||
setOnClickListener(v -> {
|
||||
final ArrayList<WebTabData> tabs = getTabs();
|
||||
|
||||
final int count = tabs.size();
|
||||
if (count == 0) return;
|
||||
WebTabData lastTab = tabs.get(tabs.size() - 1);
|
||||
BottomSheetTabsOverlay overlay = LaunchActivity.instance.getBottomSheetTabsOverlay();
|
||||
|
||||
if (count == 1 || overlay == null) {
|
||||
openTab(lastTab);
|
||||
} else {
|
||||
overlay.openTabsView();
|
||||
}
|
||||
});
|
||||
|
||||
updateMultipleTitle();
|
||||
}
|
||||
|
||||
public void openTab(WebTabData tab) {
|
||||
BaseFragment lastFragment = LaunchActivity.getLastFragment();
|
||||
if (lastFragment == null || lastFragment.getParentActivity() == null) return;
|
||||
if (lastFragment instanceof ChatActivity) {
|
||||
if (((ChatActivity) lastFragment).getChatActivityEnterView() != null) {
|
||||
((ChatActivity) lastFragment).getChatActivityEnterView().closeKeyboard();
|
||||
((ChatActivity) lastFragment).getChatActivityEnterView().hidePopup(true, false);
|
||||
}
|
||||
}
|
||||
boolean closed = closeAttachedSheets();
|
||||
Utilities.Callback<BaseFragment> open = fragment -> {
|
||||
if (fragment == null) return;
|
||||
if (fragment instanceof ChatActivity) {
|
||||
if (((ChatActivity) fragment).getChatActivityEnterView() != null) {
|
||||
((ChatActivity) fragment).getChatActivityEnterView().closeKeyboard();
|
||||
((ChatActivity) fragment).getChatActivityEnterView().hidePopup(true, false);
|
||||
}
|
||||
}
|
||||
if (fragment.getContext() == null) {
|
||||
return;
|
||||
}
|
||||
if (AndroidUtilities.isTablet()) {
|
||||
BotWebViewSheet sheet = new BotWebViewSheet(fragment.getContext(), fragment.getResourceProvider());
|
||||
sheet.setParentActivity(fragment.getParentActivity());
|
||||
if (sheet.restoreState(fragment, tab)) {
|
||||
removeTab(tab, false);
|
||||
sheet.show();
|
||||
}
|
||||
} else {
|
||||
BottomSheetTabsOverlay overlay = LaunchActivity.instance.getBottomSheetTabsOverlay();
|
||||
BotWebViewAttachedSheet webViewSheet = fragment.createBotViewer();
|
||||
webViewSheet.setParentActivity(fragment.getParentActivity());
|
||||
if (webViewSheet.restoreState(fragment, tab)) {
|
||||
// if (overlay != null && overlay.isOpened() && overlay.openSheet(webViewSheet, tab, null)) {
|
||||
// removeTab(tab, false);
|
||||
// webViewSheet.show(closed, true);
|
||||
// } else {
|
||||
removeTab(tab, false);
|
||||
webViewSheet.show(closed);
|
||||
// }
|
||||
}
|
||||
}
|
||||
};
|
||||
if (tab.needsContext && (!(lastFragment instanceof ChatActivity) || ((ChatActivity) lastFragment).getDialogId() != tab.props.botId)) {
|
||||
BaseFragment chatActivity = ChatActivity.of(tab.props.botId);
|
||||
chatActivity.whenFullyVisible(() -> open.run(chatActivity));
|
||||
lastFragment.presentFragment(chatActivity);
|
||||
} else {
|
||||
open.run(lastFragment);
|
||||
}
|
||||
}
|
||||
|
||||
public WebTabData tryReopenTab(BotWebViewAttachedSheet.WebViewRequestProps props) {
|
||||
ArrayList<WebTabData> tabs = this.tabs.get(currentAccount);
|
||||
if (tabs == null) this.tabs.put(currentAccount, tabs = new ArrayList<>());
|
||||
|
||||
if (props == null) return null;
|
||||
for (int i = 0; i < tabs.size(); ++i) {
|
||||
WebTabData tab = tabs.get(i);
|
||||
if (props.equals(tab.props)) {
|
||||
openTab(tab);
|
||||
return tab;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean closeAttachedSheets() {
|
||||
boolean had = false;
|
||||
BottomSheetTabsOverlay overlay = LaunchActivity.instance.getBottomSheetTabsOverlay();
|
||||
BaseFragment fragment = LaunchActivity.getSafeLastFragment();
|
||||
if (fragment != null) {
|
||||
for (int i = 0; fragment.sheetsStack != null && i < fragment.sheetsStack.size(); ++i) {
|
||||
BaseFragment.AttachedSheet sheet = fragment.sheetsStack.get(i);
|
||||
if (sheet instanceof BotWebViewAttachedSheet) {
|
||||
if (overlay != null) {
|
||||
overlay.setSlowerDismiss(true);
|
||||
}
|
||||
((BotWebViewAttachedSheet) sheet).dismiss(true, null);
|
||||
had = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return had;
|
||||
}
|
||||
|
||||
private int backgroundColor;
|
||||
private AnimatedColor backgroundColorAnimated = new AnimatedColor(this, 0, 200, CubicBezierInterpolator.EASE_OUT_QUINT);
|
||||
private int tabColor;
|
||||
private AnimatedColor tabColorAnimated = new AnimatedColor(this, 0, 200, CubicBezierInterpolator.EASE_OUT_QUINT);
|
||||
private boolean tabIsDark;
|
||||
private AnimatedFloat tabDarkAnimated = new AnimatedFloat(this, 0, 200, CubicBezierInterpolator.EASE_OUT_QUINT);
|
||||
|
||||
public void setNavigationBarColor(int color) {
|
||||
setNavigationBarColor(color, true);
|
||||
}
|
||||
|
||||
public void setNavigationBarColor(int color, boolean animated) {
|
||||
if (color != backgroundColor) {
|
||||
if (!actionBarLayout.startedTracking || actionBarLayout.animationInProgress) {
|
||||
animated = false;
|
||||
}
|
||||
backgroundColor = color;
|
||||
final boolean isDark = AndroidUtilities.computePerceivedBrightness(color) < .721f;
|
||||
tabColor = Theme.blendOver(color, Theme.multAlpha(0xFFFFFFFF, isDark ? .08f : .75f));
|
||||
tabIsDark = AndroidUtilities.computePerceivedBrightness(tabColor) < .721f;
|
||||
if (!animated) {
|
||||
backgroundColorAnimated.set(backgroundColor, true);
|
||||
tabColorAnimated.set(tabColor, true);
|
||||
tabDarkAnimated.set(tabIsDark, true);
|
||||
}
|
||||
invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
public int currentAccount = UserConfig.selectedAccount;
|
||||
public final HashMap<Integer, ArrayList<WebTabData>> tabs = new HashMap<>();
|
||||
public final HashMap<Integer, ArrayList<TabDrawable>> tabDrawables = new HashMap<>();
|
||||
|
||||
public void updateCurrentAccount() {
|
||||
setCurrentAccount(UserConfig.selectedAccount);
|
||||
}
|
||||
|
||||
public void setCurrentAccount(int account) {
|
||||
if (currentAccount != account) {
|
||||
currentAccount = account;
|
||||
|
||||
actionBarLayout.updateBottomTabsVisibility(false);
|
||||
invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isExpanded() {
|
||||
return !getTabs().isEmpty();
|
||||
}
|
||||
|
||||
public int getExpandedHeight() {
|
||||
final int count = getTabs().size();
|
||||
if (count == 0) {
|
||||
return 0;
|
||||
} else if (count == 1) {
|
||||
return dp(60);
|
||||
} else {
|
||||
return dp(68);
|
||||
}
|
||||
}
|
||||
|
||||
public ArrayList<WebTabData> getTabs() {
|
||||
ArrayList<WebTabData> tabs = this.tabs.get(currentAccount);
|
||||
if (tabs == null) this.tabs.put(currentAccount, tabs = new ArrayList<>());
|
||||
return tabs;
|
||||
}
|
||||
|
||||
public ArrayList<TabDrawable> getTabDrawables() {
|
||||
ArrayList<TabDrawable> tabDrawables = this.tabDrawables.get(currentAccount);
|
||||
if (tabDrawables == null) this.tabDrawables.put(currentAccount, tabDrawables = new ArrayList<>());
|
||||
return tabDrawables;
|
||||
}
|
||||
|
||||
public TabDrawable findTabDrawable(WebTabData tab) {
|
||||
final ArrayList<TabDrawable> tabDrawables = getTabDrawables();
|
||||
|
||||
for (int i = 0; i < tabDrawables.size(); ++i) {
|
||||
if (tabDrawables.get(i).tab == tab) {
|
||||
return tabDrawables.get(i);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public TabDrawable pushTab(WebTabData tab) {
|
||||
final ArrayList<WebTabData> tabs = getTabs();
|
||||
final ArrayList<TabDrawable> tabDrawables = getTabDrawables();
|
||||
|
||||
TabDrawable tabDrawable = new TabDrawable(this, tab);
|
||||
tabDrawable.animatedPosition.set(-1, true);
|
||||
tabDrawable.animatedAlpha.set(0, true);
|
||||
tabDrawables.add(tabDrawable);
|
||||
|
||||
tabs.add(0, tab);
|
||||
for (int i = 0; i < tabDrawables.size(); ++i) {
|
||||
TabDrawable drawable = tabDrawables.get(i);
|
||||
final int index = tabs.indexOf(drawable.tab);
|
||||
drawable.index = index;
|
||||
if (index >= 0) {
|
||||
drawable.position = index;
|
||||
}
|
||||
}
|
||||
updateMultipleTitle();
|
||||
|
||||
actionBarLayout.updateBottomTabsVisibility(true);
|
||||
|
||||
invalidate();
|
||||
return tabDrawable;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean verifyDrawable(@NonNull Drawable who) {
|
||||
return super.verifyDrawable(who) || true;
|
||||
}
|
||||
|
||||
private void updateMultipleTitle() {
|
||||
final ArrayList<WebTabData> tabs = getTabs();
|
||||
final ArrayList<TabDrawable> tabDrawables = getTabDrawables();
|
||||
|
||||
String title = null;
|
||||
for (int i = 0; i < tabDrawables.size(); ++i) {
|
||||
TabDrawable drawable = tabDrawables.get(i);
|
||||
|
||||
if (tabs.size() > 1 && drawable.position == 0) {
|
||||
TLRPC.User user = MessagesController.getInstance(drawable.tab.props.currentAccount).getUser(drawable.tab.props.botId);
|
||||
title = LocaleController.formatPluralString("BotMoreTabs", tabs.size() - 1, UserObject.getUserName(user));
|
||||
drawable.setOverrideTitle(title);
|
||||
} else {
|
||||
TLRPC.User user = MessagesController.getInstance(drawable.tab.props.currentAccount).getUser(drawable.tab.props.botId);
|
||||
title = UserObject.getUserName(user);
|
||||
drawable.setOverrideTitle(null);
|
||||
}
|
||||
}
|
||||
|
||||
if (tabs.isEmpty()) {
|
||||
setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_NO);
|
||||
setContentDescription(LocaleController.formatString(R.string.AccDescrTabs, ""));
|
||||
} else {
|
||||
setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_YES);
|
||||
setContentDescription(LocaleController.formatString(R.string.AccDescrTabs, title == null ? "" : title));
|
||||
}
|
||||
}
|
||||
|
||||
public boolean removeAll() {
|
||||
final ArrayList<WebTabData> tabs = getTabs();
|
||||
final ArrayList<TabDrawable> tabDrawables = getTabDrawables();
|
||||
|
||||
for (int i = 0; i < tabs.size(); ++i) {
|
||||
tabs.get(i).destroy();
|
||||
}
|
||||
tabs.clear();
|
||||
for (int i = 0; i < tabDrawables.size(); ++i) {
|
||||
TabDrawable drawable = tabDrawables.get(i);
|
||||
drawable.index = -1;
|
||||
}
|
||||
updateMultipleTitle();
|
||||
actionBarLayout.updateBottomTabsVisibility(true);
|
||||
invalidate();
|
||||
return tabs.isEmpty();
|
||||
}
|
||||
|
||||
public void removeTab(WebTabData tab, Utilities.Callback<Boolean> callback) {
|
||||
if (tab == null) {
|
||||
callback.run(true);
|
||||
return;
|
||||
}
|
||||
if (!tab.confirmDismiss) {
|
||||
removeTab(tab, true);
|
||||
callback.run(true);
|
||||
return;
|
||||
}
|
||||
|
||||
String botName = null;
|
||||
TLRPC.User user = MessagesController.getInstance(tab.props.currentAccount).getUser(tab.props.botId);
|
||||
if (user != null) {
|
||||
botName = ContactsController.formatName(user.first_name, user.last_name);
|
||||
}
|
||||
|
||||
final boolean[] clicked = new boolean[] { false };
|
||||
final AlertDialog[] dialog = new AlertDialog[1];
|
||||
dialog[0] = new AlertDialog.Builder(getContext())
|
||||
.setTitle(botName)
|
||||
.setMessage(LocaleController.getString(R.string.BotWebViewChangesMayNotBeSaved))
|
||||
.setPositiveButton(LocaleController.getString(R.string.BotWebViewCloseAnyway), (d, w) -> {
|
||||
clicked[0] = true;
|
||||
removeTab(tab, true);
|
||||
callback.run(true);
|
||||
dialog[0].dismiss();
|
||||
})
|
||||
.setNegativeButton(LocaleController.getString(R.string.Cancel), (d, w) -> {
|
||||
clicked[0] = true;
|
||||
callback.run(false);
|
||||
dialog[0].dismiss();
|
||||
})
|
||||
.create();
|
||||
dialog[0].setOnDismissListener(v -> {
|
||||
if (!clicked[0]) {
|
||||
callback.run(false);
|
||||
clicked[0] = true;
|
||||
}
|
||||
});
|
||||
dialog[0].show();
|
||||
TextView textView = (TextView) dialog[0].getButton(AlertDialog.BUTTON_POSITIVE);
|
||||
textView.setTextColor(Theme.getColor(Theme.key_text_RedBold));
|
||||
}
|
||||
|
||||
public boolean removeTab(WebTabData tab, boolean destroy) {
|
||||
final ArrayList<WebTabData> tabs = getTabs();
|
||||
final ArrayList<TabDrawable> tabDrawables = getTabDrawables();
|
||||
|
||||
tabs.remove(tab);
|
||||
if (destroy) {
|
||||
tab.destroy();
|
||||
}
|
||||
for (int i = 0; i < tabDrawables.size(); ++i) {
|
||||
TabDrawable drawable = tabDrawables.get(i);
|
||||
final int index = tabs.indexOf(drawable.tab);
|
||||
drawable.index = index;
|
||||
if (index >= 0) {
|
||||
drawable.position = index;
|
||||
}
|
||||
}
|
||||
updateMultipleTitle();
|
||||
final ArrayList<TabDrawable> finalTabDrawables = tabDrawables;
|
||||
AndroidUtilities.runOnUIThread(() -> {
|
||||
for (int i = 0; i < finalTabDrawables.size(); ++i) {
|
||||
TabDrawable drawable = finalTabDrawables.get(i);
|
||||
if (drawable.tab == tab) {
|
||||
finalTabDrawables.remove(i);
|
||||
i--;
|
||||
}
|
||||
}
|
||||
invalidate();
|
||||
}, 320);
|
||||
actionBarLayout.updateBottomTabsVisibility(true);
|
||||
invalidate();
|
||||
return tabs.isEmpty();
|
||||
}
|
||||
|
||||
private boolean closeRippleHit;
|
||||
@Override
|
||||
public boolean onTouchEvent(MotionEvent event) {
|
||||
final ArrayList<WebTabData> tabs = getTabs();
|
||||
final ArrayList<TabDrawable> tabDrawables = getTabDrawables();
|
||||
|
||||
if (drawTabs) {
|
||||
|
||||
WebTabData lastTab = tabs.isEmpty() ? null : tabs.get(0);
|
||||
TabDrawable drawable = findTabDrawable(lastTab);
|
||||
|
||||
if (drawable != null) {
|
||||
getTabBounds(rect, drawable.getPosition());
|
||||
final boolean closeHit = drawable.closeRipple.getBounds().contains((int) (event.getX() - rect.left), (int) (event.getY() - rect.centerY()));
|
||||
if (event.getAction() == MotionEvent.ACTION_DOWN || event.getAction() == MotionEvent.ACTION_MOVE) {
|
||||
closeRippleHit = closeHit;
|
||||
drawable.closeRipple.setState(closeHit ? new int[]{android.R.attr.state_pressed, android.R.attr.state_enabled} : new int[] {});
|
||||
} else if (event.getAction() == MotionEvent.ACTION_UP || event.getAction() == MotionEvent.ACTION_CANCEL) {
|
||||
if (closeRippleHit && event.getAction() == MotionEvent.ACTION_UP) {
|
||||
removeTab(lastTab, success -> {});
|
||||
}
|
||||
closeRippleHit = false;
|
||||
drawable.closeRipple.setState(new int[] {});
|
||||
}
|
||||
for (int i = 0; i < tabDrawables.size(); ++i) {
|
||||
if (tabDrawables.get(i) != drawable) {
|
||||
tabDrawables.get(i).closeRipple.setState(new int[] {});
|
||||
}
|
||||
}
|
||||
} else {
|
||||
closeRippleHit = false;
|
||||
}
|
||||
}
|
||||
if (closeRippleHit) return true;
|
||||
return super.onTouchEvent(event);
|
||||
}
|
||||
|
||||
private final RectF rect = new RectF();
|
||||
|
||||
@Override
|
||||
protected void dispatchDraw(Canvas canvas) {
|
||||
final ArrayList<WebTabData> tabs = getTabs();
|
||||
final ArrayList<TabDrawable> tabDrawables = getTabDrawables();
|
||||
|
||||
backgroundPaint.setColor(backgroundColorAnimated.set(backgroundColor));
|
||||
canvas.drawRect(0, 0, getWidth(), getHeight(), backgroundPaint);
|
||||
super.dispatchDraw(canvas);
|
||||
|
||||
final int tabColor = tabColorAnimated.set(this.tabColor);
|
||||
final float tabIsDark = tabDarkAnimated.set(this.tabIsDark);
|
||||
if (drawTabs) {
|
||||
for (int i = 0; i < tabDrawables.size(); ++i) {
|
||||
final TabDrawable drawable = tabDrawables.get(i);
|
||||
float position = drawable.getPosition();
|
||||
float alpha = drawable.getAlpha();
|
||||
|
||||
if (alpha <= 0) continue;
|
||||
if (position > 1.99f) continue;
|
||||
|
||||
getTabBounds(rect, position);
|
||||
drawable.setExpandProgress(0f);
|
||||
drawable.setBackgroundColor(tabColor, tabIsDark > .5f);
|
||||
drawable.draw(canvas, rect, dp(10), alpha, 1f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setupTab(TabDrawable drawable) {
|
||||
final int tabColor = tabColorAnimated.set(this.tabColor);
|
||||
final float tabIsDark = tabDarkAnimated.set(this.tabIsDark);
|
||||
drawable.setExpandProgress(0f);
|
||||
drawable.setBackgroundColor(tabColor, tabIsDark > .5f);
|
||||
}
|
||||
|
||||
public void getTabBounds(RectF rect, float position) {
|
||||
rect.set(dp(4), getHeight() - dp(4) - dp(50), getWidth() - dp(4), getHeight() - dp(4));
|
||||
rect.offset(0, position * -dp(8));
|
||||
final float s = lerp(1f, .95f, Math.abs(position));
|
||||
final float cx = rect.centerX(), cy = rect.centerY(), w = rect.width(), h = rect.height();
|
||||
rect.left = cx - w / 2f * s;
|
||||
rect.right = cx + w / 2f * s;
|
||||
rect.top = cy - h / 2f * s;
|
||||
rect.bottom = cy + h / 2f * s;
|
||||
}
|
||||
|
||||
|
||||
public static class TabDrawable {
|
||||
|
||||
public final WebTabData tab;
|
||||
public final View parentView;
|
||||
|
||||
private int position;
|
||||
public int index;
|
||||
public final AnimatedFloat animatedPosition;
|
||||
public final AnimatedFloat animatedAlpha;
|
||||
|
||||
private final Paint backgroundPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
|
||||
private final Paint iconPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
|
||||
|
||||
public int closeRippleColor;
|
||||
public final Drawable closeRipple = Theme.createSelectorDrawable(0x30ffffff, Theme.RIPPLE_MASK_CIRCLE_20DP);
|
||||
|
||||
private boolean tabColorOverride;
|
||||
private int backgroundColor, tabColor;
|
||||
private boolean backgroundIsDark, tabIsDark;
|
||||
|
||||
private Text title;
|
||||
private Text overrideTitle;
|
||||
|
||||
public TabDrawable(View view, WebTabData tab) {
|
||||
parentView = view;
|
||||
this.tab = tab;
|
||||
closeRipple.setCallback(view);
|
||||
|
||||
iconPaint.setStyle(Paint.Style.STROKE);
|
||||
iconPaint.setStrokeJoin(Paint.Join.ROUND);
|
||||
iconPaint.setStrokeCap(Paint.Cap.ROUND);
|
||||
|
||||
animatedPosition = new AnimatedFloat(view, 320, CubicBezierInterpolator.EASE_OUT_QUINT);
|
||||
animatedAlpha = new AnimatedFloat(view, 320, CubicBezierInterpolator.EASE_OUT_QUINT);
|
||||
|
||||
TLRPC.User user = MessagesController.getInstance(tab.props.currentAccount).getUser(tab.getBotId());
|
||||
this.title = new Text(UserObject.getUserName(user), 17, AndroidUtilities.bold());
|
||||
this.tabColor = tab.actionBarColor;
|
||||
this.tabIsDark = AndroidUtilities.computePerceivedBrightness(tabColor) < .721f;
|
||||
|
||||
closePath.rewind();
|
||||
closePath.moveTo(0, 0);
|
||||
closePath.lineTo(dp(12), dp(12));
|
||||
closePath.moveTo(dp(12), 0);
|
||||
closePath.lineTo(0, dp(12));
|
||||
|
||||
expandPath.rewind();
|
||||
expandPath.moveTo(0, dp(6.33f) / 2f);
|
||||
expandPath.lineTo(dp(12.66f) / 2f, -dp(6.33f) / 2f);
|
||||
expandPath.lineTo(dp(12.66f), dp(6.33f) / 2f);
|
||||
}
|
||||
|
||||
public void setOverrideTitle(String title) {
|
||||
if (title == null) {
|
||||
overrideTitle = null;
|
||||
} else {
|
||||
overrideTitle = new Text(title, 17, AndroidUtilities.bold());
|
||||
}
|
||||
}
|
||||
|
||||
public float getPosition() {
|
||||
return index < 0 ? position : animatedPosition.set(position);
|
||||
}
|
||||
|
||||
public float getAlpha() {
|
||||
final float position = getPosition();
|
||||
float positionalpha;
|
||||
if (position < 0)
|
||||
positionalpha = 1f + position;
|
||||
else if (position >= 0 && position < 1)
|
||||
positionalpha = lerp(1f, .87f, position);
|
||||
else
|
||||
positionalpha = .87f * (1f - Math.min(1, position - 1));
|
||||
return positionalpha * animatedAlpha.set(index >= 0);
|
||||
}
|
||||
|
||||
public void setBackgroundColor(int color, boolean isDark) {
|
||||
backgroundColor = color;
|
||||
backgroundIsDark = isDark;
|
||||
}
|
||||
|
||||
public void setOnCloseClick(Runnable listener) {
|
||||
|
||||
}
|
||||
|
||||
public void setOnExpandClick(Runnable listener) {
|
||||
|
||||
}
|
||||
|
||||
private float expandProgress;
|
||||
public void setExpandProgress(float expandProgress) {
|
||||
this.expandProgress = expandProgress;
|
||||
}
|
||||
|
||||
private final float[] radii = new float[8];
|
||||
private final Path rectPath = new Path();
|
||||
private final Path closePath = new Path();
|
||||
private final Path expandPath = new Path();
|
||||
|
||||
public void draw(Canvas canvas, RectF bounds, float r, float alpha, float contentAlpha) {
|
||||
final int backgroundColor = ColorUtils.blendARGB(this.backgroundColor, this.tabColor, expandProgress);
|
||||
backgroundPaint.setColor(backgroundColor);
|
||||
backgroundPaint.setAlpha((int) (0xFF * alpha));
|
||||
backgroundPaint.setShadowLayer(dp(2.33f), 0, dp(1), Theme.multAlpha(0x10000000, alpha));
|
||||
|
||||
radii[0] = radii[1] = radii[2] = radii[3] = r;
|
||||
radii[4] = radii[5] = radii[6] = radii[7] = lerp(r, 0, expandProgress);
|
||||
rectPath.rewind();
|
||||
rectPath.addRoundRect(bounds, radii, Path.Direction.CW);
|
||||
canvas.drawPath(rectPath, backgroundPaint);
|
||||
|
||||
final float isDark = lerp(backgroundIsDark ? 1f : 0f, tabIsDark ? 1f : 0f, expandProgress);
|
||||
final int iconColor = ColorUtils.blendARGB(0xFF000000, 0xFFFFFFFF, isDark);
|
||||
|
||||
iconPaint.setColor(iconColor);
|
||||
iconPaint.setStrokeWidth(dp(2));
|
||||
|
||||
canvas.save();
|
||||
canvas.translate(bounds.left, bounds.centerY());
|
||||
int rippleColor = ColorUtils.blendARGB(0x20FFFFFF, 0x20FFFFFF, isDark);
|
||||
closeRipple.setBounds(
|
||||
(int) (dp(25) + -dp(25)),
|
||||
(int) ( + -dp(25)),
|
||||
(int) (dp(25) + dp(25)),
|
||||
(int) ( + dp(25))
|
||||
);
|
||||
if (closeRippleColor != rippleColor) {
|
||||
Theme.setSelectorDrawableColor(closeRipple, closeRippleColor = rippleColor, false);
|
||||
}
|
||||
closeRipple.draw(canvas);
|
||||
canvas.restore();
|
||||
|
||||
canvas.save();
|
||||
canvas.translate(bounds.left + dp(22 - 4), bounds.centerY() - dp(6));
|
||||
iconPaint.setAlpha((int) (0xFF * alpha * contentAlpha));
|
||||
canvas.drawPath(closePath, iconPaint);
|
||||
canvas.restore();
|
||||
|
||||
canvas.save();
|
||||
canvas.translate(bounds.right - dp(22 - 4 + 12.66f), bounds.centerY());
|
||||
iconPaint.setAlpha((int) (0xFF * alpha * contentAlpha * (1f - expandProgress)));
|
||||
canvas.drawPath(expandPath, iconPaint);
|
||||
canvas.restore();
|
||||
|
||||
if (overrideTitle != null) {
|
||||
overrideTitle
|
||||
.ellipsize((int) (bounds.width() - dp(100)))
|
||||
.draw(canvas, bounds.left + dp(60), bounds.centerY(), iconColor, (1f - expandProgress) * alpha * contentAlpha);
|
||||
}
|
||||
title
|
||||
.ellipsize((int) (bounds.width() - dp(100)))
|
||||
.draw(canvas, bounds.left + dp(60), bounds.centerY(), iconColor, (overrideTitle == null ? 1f : expandProgress) * alpha * contentAlpha);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static class WebTabData {
|
||||
|
||||
public BotWebViewAttachedSheet.WebViewRequestProps props;
|
||||
public Bundle webViewState;
|
||||
public BotWebViewContainer.MyWebView webView;
|
||||
public BotWebViewContainer.WebViewProxy webViewProxy;
|
||||
public int webViewWidth, webViewHeight;
|
||||
public int webViewScroll;
|
||||
public boolean expanded;
|
||||
public float expandedOffset = Float.MAX_VALUE;
|
||||
|
||||
public Bitmap previewBitmap;
|
||||
public Object previewNode;
|
||||
|
||||
public boolean overrideActionBarColor;
|
||||
public int actionBarColorKey;
|
||||
public int actionBarColor;
|
||||
public int backgroundColor;
|
||||
|
||||
public boolean ready;
|
||||
public boolean backButton;
|
||||
public boolean settings;
|
||||
public BotWebViewAttachedSheet.MainButtonSettings main;
|
||||
public String lastUrl;
|
||||
public boolean confirmDismiss;
|
||||
|
||||
public boolean fullsize;
|
||||
public boolean needsContext;
|
||||
|
||||
public boolean themeIsDark;
|
||||
|
||||
public long getBotId() {
|
||||
if (props == null) return 0;
|
||||
return props.botId;
|
||||
}
|
||||
|
||||
public void destroy() {
|
||||
try {
|
||||
if (webView != null) {
|
||||
webView.destroy();
|
||||
webView = null;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
FileLog.e(e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
File diff suppressed because it is too large
Load diff
|
@ -449,7 +449,7 @@ public class DrawerLayoutContainer extends FrameLayout {
|
|||
return true;
|
||||
}
|
||||
|
||||
if ((allowOpenDrawerBySwipe || drawerOpened) && allowOpenDrawer && parentActionBarLayout.getFragmentStack().size() == 1 && (parentActionBarLayout.getLastFragment().getLastSheet() == null || !parentActionBarLayout.getLastFragment().getLastSheet().attachedToParent())) {
|
||||
if ((allowOpenDrawerBySwipe || drawerOpened) && allowOpenDrawer && parentActionBarLayout.getFragmentStack().size() == 1 && (parentActionBarLayout.getLastFragment().getLastStoryViewer() == null || !parentActionBarLayout.getLastFragment().getLastStoryViewer().attachedToParent())) {
|
||||
if (ev != null && (ev.getAction() == MotionEvent.ACTION_DOWN || ev.getAction() == MotionEvent.ACTION_MOVE) && !startedTracking && !maybeStartTracking) {
|
||||
View scrollingChild = findScrollingChild(this, ev.getX(),ev.getY());
|
||||
if (scrollingChild != null) {
|
||||
|
|
|
@ -79,12 +79,12 @@ public interface INavigationLayout {
|
|||
List<BackButtonMenu.PulledDialog> getPulledDialogs();
|
||||
void setPulledDialogs(List<BackButtonMenu.PulledDialog> pulledDialogs);
|
||||
|
||||
static INavigationLayout newLayout(Context context, boolean main) {
|
||||
return new ActionBarLayout(context, main);
|
||||
static INavigationLayout newLayout(Context context) {
|
||||
return new ActionBarLayout(context);
|
||||
}
|
||||
|
||||
static INavigationLayout newLayout(Context context, boolean main, Supplier<BottomSheet> supplier) {
|
||||
return new ActionBarLayout(context, main) {
|
||||
static INavigationLayout newLayout(Context context, Supplier<BottomSheet> supplier) {
|
||||
return new ActionBarLayout(context) {
|
||||
@Override
|
||||
public BottomSheet getBottomSheet() {
|
||||
return supplier.get();
|
||||
|
@ -433,15 +433,6 @@ public interface INavigationLayout {
|
|||
}
|
||||
}
|
||||
|
||||
void setNavigationBarColor(int color);
|
||||
|
||||
default int getBottomTabsHeight(boolean animated) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
default BottomSheetTabs getBottomSheetTabs() {
|
||||
return null;
|
||||
}
|
||||
enum BackButtonState {
|
||||
BACK,
|
||||
MENU
|
||||
|
|
|
@ -27,8 +27,6 @@ import org.telegram.messenger.Utilities;
|
|||
import org.telegram.tgnet.ConnectionsManager;
|
||||
import org.telegram.tgnet.TLObject;
|
||||
import org.telegram.tgnet.TLRPC;
|
||||
import org.telegram.tgnet.tl.TL_stories;
|
||||
import org.telegram.ui.Components.ListView.AdapterWithDiffUtils;
|
||||
import org.telegram.ui.Components.RecyclerListView;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -36,7 +34,7 @@ import java.util.HashSet;
|
|||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
public abstract class BaseLocationAdapter extends AdapterWithDiffUtils {
|
||||
public abstract class BaseLocationAdapter extends RecyclerListView.SelectionAdapter {
|
||||
|
||||
public final boolean stories;
|
||||
public final boolean biz;
|
||||
|
@ -83,7 +81,7 @@ public abstract class BaseLocationAdapter extends AdapterWithDiffUtils {
|
|||
places.clear();
|
||||
locations.clear();
|
||||
searchInProgress = false;
|
||||
update(true);
|
||||
notifyDataSetChanged();
|
||||
} else {
|
||||
if (searchRunnable != null) {
|
||||
Utilities.searchQueue.cancelRunnable(searchRunnable);
|
||||
|
@ -205,7 +203,6 @@ public abstract class BaseLocationAdapter extends AdapterWithDiffUtils {
|
|||
if (!TextUtils.isEmpty(query) && (stories || biz)) {
|
||||
searchingLocations = true;
|
||||
final Locale locale = LocaleController.getInstance().getCurrentLocale();
|
||||
final Locale englishLocale = stories ? locale.getLanguage().contains("en") ? locale : Locale.US : null;
|
||||
final String finalQuery = query;
|
||||
Utilities.globalQueue.postRunnable(() -> {
|
||||
final ArrayList<TLRPC.TL_messageMediaVenue> locations = new ArrayList<>();
|
||||
|
@ -213,17 +210,11 @@ public abstract class BaseLocationAdapter extends AdapterWithDiffUtils {
|
|||
final int maxCount = biz ? 10 : 5;
|
||||
Geocoder geocoder = new Geocoder(ApplicationLoader.applicationContext, locale);
|
||||
List<Address> addresses = geocoder.getFromLocationName(finalQuery, 5);
|
||||
List<Address> engAddresses = null;
|
||||
if (stories) {
|
||||
geocoder = new Geocoder(ApplicationLoader.applicationContext, englishLocale);
|
||||
engAddresses = geocoder.getFromLocationName(finalQuery, 5);
|
||||
}
|
||||
HashSet<String> countries = new HashSet<>();
|
||||
HashSet<String> cities = new HashSet<>();
|
||||
String arg, lc;
|
||||
for (int i = 0; i < addresses.size(); ++i) {
|
||||
Address address = addresses.get(i);
|
||||
Address engAddress = engAddresses != null && i < engAddresses.size() ? engAddresses.get(i) : null;
|
||||
if (!address.hasLatitude() || !address.hasLongitude())
|
||||
continue;
|
||||
double lat = address.getLatitude();
|
||||
|
@ -239,13 +230,6 @@ public abstract class BaseLocationAdapter extends AdapterWithDiffUtils {
|
|||
if (TextUtils.isEmpty(locality)) {
|
||||
locality = address.getAdminArea();
|
||||
}
|
||||
String engLocality = null;
|
||||
if (engAddress != null) {
|
||||
engLocality = engAddress.getLocality();
|
||||
if (TextUtils.isEmpty(engLocality)) {
|
||||
engLocality = engAddress.getAdminArea();
|
||||
}
|
||||
}
|
||||
arg = address.getThoroughfare();
|
||||
if (!TextUtils.isEmpty(arg) && !TextUtils.equals(arg, address.getAdminArea())) {
|
||||
if (streetBuilder.length() > 0) {
|
||||
|
@ -338,73 +322,9 @@ public abstract class BaseLocationAdapter extends AdapterWithDiffUtils {
|
|||
streetLocation.title = streetBuilder.toString();
|
||||
streetLocation.icon = "pin";
|
||||
streetLocation.address = onlyCity ? LocaleController.getString("PassportCity", R.string.PassportCity) : LocaleController.getString("PassportStreet1", R.string.PassportStreet1);
|
||||
boolean isUnnamed = false;
|
||||
if (engAddress != null) {
|
||||
streetLocation.geoAddress = new TL_stories.TL_geoPointAddress();
|
||||
streetLocation.geoAddress.country_iso2 = engAddress.getCountryCode();
|
||||
|
||||
String engCity = null, engState = null;
|
||||
if (TextUtils.isEmpty(engCity)) {
|
||||
engCity = engAddress.getLocality();
|
||||
}
|
||||
if (TextUtils.isEmpty(engCity)) {
|
||||
engCity = engAddress.getAdminArea();
|
||||
}
|
||||
if (TextUtils.isEmpty(engCity)) {
|
||||
engCity = engAddress.getSubAdminArea();
|
||||
}
|
||||
engState = engAddress.getAdminArea();
|
||||
StringBuilder engStreet = new StringBuilder();
|
||||
|
||||
if (!TextUtils.isEmpty(engState)) {
|
||||
streetLocation.geoAddress.state = engState;
|
||||
streetLocation.geoAddress.flags |= 1;
|
||||
}
|
||||
if (!TextUtils.isEmpty(engCity)) {
|
||||
streetLocation.geoAddress.city = engCity;
|
||||
streetLocation.geoAddress.flags |= 2;
|
||||
}
|
||||
|
||||
if (!onlyCity) {
|
||||
String engFeature = null;
|
||||
if (TextUtils.isEmpty(engFeature) && !TextUtils.equals(engAddress.getThoroughfare(), locality) && !TextUtils.equals(engAddress.getThoroughfare(), engAddress.getCountryName())) {
|
||||
engFeature = engAddress.getThoroughfare();
|
||||
}
|
||||
if (TextUtils.isEmpty(engFeature) && !TextUtils.equals(engAddress.getSubLocality(), locality) && !TextUtils.equals(engAddress.getSubLocality(), engAddress.getCountryName())) {
|
||||
engFeature = engAddress.getSubLocality();
|
||||
}
|
||||
if (TextUtils.isEmpty(engFeature) && !TextUtils.equals(engAddress.getLocality(), locality) && !TextUtils.equals(engAddress.getLocality(), engAddress.getCountryName())) {
|
||||
engFeature = engAddress.getLocality();
|
||||
}
|
||||
if (!TextUtils.isEmpty(engFeature) && !TextUtils.equals(engFeature, engState) && !TextUtils.equals(engFeature, engAddress.getCountryName())) {
|
||||
if (engStreet.length() > 0) {
|
||||
engStreet.append(", ");
|
||||
}
|
||||
engStreet.append(engFeature);
|
||||
} else {
|
||||
engStreet = null;
|
||||
}
|
||||
|
||||
if (!TextUtils.isEmpty(engStreet)) {
|
||||
for (int j = 0; j < LocationController.unnamedRoads.length; ++j) {
|
||||
if (LocationController.unnamedRoads[j].equalsIgnoreCase(engStreet.toString())) {
|
||||
isUnnamed = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!TextUtils.isEmpty(engStreet)) {
|
||||
streetLocation.geoAddress.flags |= 4;
|
||||
streetLocation.geoAddress.street = engStreet.toString();
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!isUnnamed) {
|
||||
locations.add(streetLocation);
|
||||
if (locations.size() >= maxCount) {
|
||||
break;
|
||||
}
|
||||
locations.add(streetLocation);
|
||||
if (locations.size() >= maxCount) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -419,31 +339,6 @@ public abstract class BaseLocationAdapter extends AdapterWithDiffUtils {
|
|||
cityLocation.emoji = LocationController.countryCodeToEmoji(address.getCountryCode());
|
||||
cities.add(cityLocation.title);
|
||||
cityLocation.address = LocaleController.getString("PassportCity", R.string.PassportCity);
|
||||
if (engAddress != null) {
|
||||
cityLocation.geoAddress = new TL_stories.TL_geoPointAddress();
|
||||
cityLocation.geoAddress.country_iso2 = engAddress.getCountryCode();
|
||||
|
||||
String engCity = null, engState = null;
|
||||
if (TextUtils.isEmpty(engCity)) {
|
||||
engCity = engAddress.getLocality();
|
||||
}
|
||||
if (TextUtils.isEmpty(engCity)) {
|
||||
engCity = engAddress.getAdminArea();
|
||||
}
|
||||
if (TextUtils.isEmpty(engCity)) {
|
||||
engCity = engAddress.getSubAdminArea();
|
||||
}
|
||||
engState = engAddress.getAdminArea();
|
||||
|
||||
if (!TextUtils.isEmpty(engState)) {
|
||||
cityLocation.geoAddress.state = engState;
|
||||
cityLocation.geoAddress.flags |= 1;
|
||||
}
|
||||
if (!TextUtils.isEmpty(engCity)) {
|
||||
cityLocation.geoAddress.city = engCity;
|
||||
cityLocation.geoAddress.flags |= 2;
|
||||
}
|
||||
}
|
||||
locations.add(cityLocation);
|
||||
if (locations.size() >= maxCount) {
|
||||
break;
|
||||
|
@ -461,10 +356,6 @@ public abstract class BaseLocationAdapter extends AdapterWithDiffUtils {
|
|||
countryLocation.emoji = LocationController.countryCodeToEmoji(address.getCountryCode());
|
||||
countries.add(countryLocation.title);
|
||||
countryLocation.address = LocaleController.getString("Country", R.string.Country);
|
||||
if (engAddress != null) {
|
||||
countryLocation.geoAddress = new TL_stories.TL_geoPointAddress();
|
||||
countryLocation.geoAddress.country_iso2 = engAddress.getCountryCode();
|
||||
}
|
||||
locations.add(countryLocation);
|
||||
if (locations.size() >= maxCount) {
|
||||
break;
|
||||
|
@ -484,7 +375,7 @@ public abstract class BaseLocationAdapter extends AdapterWithDiffUtils {
|
|||
}
|
||||
BaseLocationAdapter.this.locations.clear();
|
||||
BaseLocationAdapter.this.locations.addAll(locations);
|
||||
update(true);
|
||||
notifyDataSetChanged();
|
||||
});
|
||||
});
|
||||
} else {
|
||||
|
@ -526,13 +417,10 @@ public abstract class BaseLocationAdapter extends AdapterWithDiffUtils {
|
|||
if (delegate != null) {
|
||||
delegate.didLoadSearchResult(places);
|
||||
}
|
||||
update(true);
|
||||
notifyDataSetChanged();
|
||||
}));
|
||||
|
||||
update(true);
|
||||
}
|
||||
|
||||
protected void update(boolean animated) {
|
||||
notifyDataSetChanged();
|
||||
// notifyStartSearch(wasSearched, wasSearching, oldItemCount, animated);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,6 +33,8 @@ import org.telegram.ui.Cells.DrawerUserCell;
|
|||
import org.telegram.ui.Cells.EmptyCell;
|
||||
import org.telegram.ui.Components.RecyclerListView;
|
||||
import org.telegram.ui.Components.SideMenultItemAnimator;
|
||||
import org.xatirchi.utils.GhostVariable;
|
||||
import org.xatirchi.utils.LanguageCode;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
|
@ -353,9 +355,11 @@ public class DrawerLayoutAdapter extends RecyclerListView.SelectionAdapter {
|
|||
}
|
||||
items.add(new Item(11, LocaleController.getString("SavedMessages", R.string.SavedMessages), savedIcon));
|
||||
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(13, LocaleController.getString("TelegramFeatures", R.string.TelegramFeatures), helpIcon));
|
||||
|
||||
items.add(new Item(100, LanguageCode.INSTANCE.getMyTitles(1), R.drawable.xatirchi_settings_ic));
|
||||
// items.add(null); // divider
|
||||
// items.add(new Item(7, LocaleController.getString("InviteFriends", R.string.InviteFriends), inviteIcon));
|
||||
// items.add(new Item(13, LocaleController.getString("TelegramFeatures", R.string.TelegramFeatures), helpIcon));
|
||||
}
|
||||
|
||||
public boolean click(View view, int position) {
|
||||
|
|
|
@ -334,7 +334,7 @@ public class FiltersView extends RecyclerListView {
|
|||
long minDate = calendar.getTimeInMillis();
|
||||
calendar.set(year, month, day + 1, 0, 0, 0);
|
||||
long maxDate = calendar.getTimeInMillis() - 1;
|
||||
dates.add(new DateData(LocaleController.getInstance().getFormatterWeekLong().format(minDate), minDate, maxDate));
|
||||
dates.add(new DateData(LocaleController.getInstance().formatterWeekLong.format(minDate), minDate, maxDate));
|
||||
return;
|
||||
}
|
||||
if ((matcher = shortDate.matcher(q)).matches()) {
|
||||
|
@ -382,7 +382,7 @@ public class FiltersView extends RecyclerListView {
|
|||
long minDate = calendar.getTimeInMillis();
|
||||
calendar.set(year, month, day + 1, 0, 0, 0);
|
||||
long maxDate = calendar.getTimeInMillis() - 1;
|
||||
dates.add(new DateData(LocaleController.getInstance().getFormatterYearMax().format(minDate), minDate, maxDate));
|
||||
dates.add(new DateData(LocaleController.getInstance().formatterYearMax.format(minDate), minDate, maxDate));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -462,7 +462,7 @@ public class FiltersView extends RecyclerListView {
|
|||
}
|
||||
calendar.add(Calendar.MONTH, 1);
|
||||
long maxDate = calendar.getTimeInMillis() - 1;
|
||||
dates.add(new DateData(LocaleController.getInstance().getFormatterMonthYear().format(minDate), minDate, maxDate));
|
||||
dates.add(new DateData(LocaleController.getInstance().formatterMonthYear.format(minDate), minDate, maxDate));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -480,7 +480,7 @@ public class FiltersView extends RecyclerListView {
|
|||
}
|
||||
calendar.add(Calendar.MONTH, 1);
|
||||
long maxDate = calendar.getTimeInMillis() - 1;
|
||||
dates.add(new DateData(LocaleController.getInstance().getFormatterMonthYear().format(minDate), minDate, maxDate));
|
||||
dates.add(new DateData(LocaleController.getInstance().formatterMonthYear.format(minDate), minDate, maxDate));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -502,9 +502,9 @@ public class FiltersView extends RecyclerListView {
|
|||
calendar.set(i, month, day + 2, 0, 0, 0);
|
||||
long maxDate = calendar.getTimeInMillis() - 1;
|
||||
if (i == currentYear) {
|
||||
dates.add(new DateData(LocaleController.getInstance().getFormatterDayMonth().format(minDate), minDate, maxDate));
|
||||
dates.add(new DateData(LocaleController.getInstance().formatterDayMonth.format(minDate), minDate, maxDate));
|
||||
} else {
|
||||
dates.add(new DateData(LocaleController.getInstance().getFormatterYearMax().format(minDate), minDate, maxDate));
|
||||
dates.add(new DateData(LocaleController.getInstance().formatterYearMax.format(minDate), minDate, maxDate));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -527,7 +527,7 @@ public class FiltersView extends RecyclerListView {
|
|||
SimpleDateFormat dateFormat = new SimpleDateFormat("EEEE", Locale.ENGLISH);
|
||||
for (int i = 0; i < 7; i++) {
|
||||
c.set(Calendar.DAY_OF_WEEK, i);
|
||||
if (LocaleController.getInstance().getFormatterWeekLong().format(c.getTime()).toLowerCase().startsWith(q)) {
|
||||
if (LocaleController.getInstance().formatterWeekLong.format(c.getTime()).toLowerCase().startsWith(q)) {
|
||||
return i;
|
||||
}
|
||||
if (dateFormat.format(c.getTime()).toLowerCase().startsWith(q)) {
|
||||
|
|
|
@ -37,7 +37,6 @@ import org.telegram.ui.Components.ChatAttachAlertLocationLayout;
|
|||
import org.telegram.ui.Components.CombinedDrawable;
|
||||
import org.telegram.ui.Components.FlickerLoadingView;
|
||||
import org.telegram.ui.Components.RecyclerListView;
|
||||
import org.telegram.ui.Components.SharedMediaLayout;
|
||||
import org.telegram.ui.LocationActivity;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -76,11 +75,9 @@ public class LocationActivityAdapter extends BaseLocationAdapter implements Loca
|
|||
updateCell();
|
||||
}
|
||||
|
||||
private boolean fromStories;
|
||||
|
||||
public LocationActivityAdapter(Context context, int type, long did, boolean emptyView, Theme.ResourcesProvider resourcesProvider, boolean stories, boolean fromStories, boolean biz) {
|
||||
public LocationActivityAdapter(Context context, int type, long did, boolean emptyView, Theme.ResourcesProvider resourcesProvider, boolean stories, boolean biz) {
|
||||
super(stories, biz);
|
||||
this.fromStories = fromStories;
|
||||
|
||||
mContext = context;
|
||||
locationType = type;
|
||||
dialogId = did;
|
||||
|
@ -88,21 +85,6 @@ public class LocationActivityAdapter extends BaseLocationAdapter implements Loca
|
|||
this.resourcesProvider = resourcesProvider;
|
||||
}
|
||||
|
||||
private SharedMediaLayout sharedMediaLayout;
|
||||
private boolean sharedMediaLayoutVisible;
|
||||
public void setSharedMediaLayout(SharedMediaLayout layout) {
|
||||
this.sharedMediaLayout = layout;
|
||||
}
|
||||
|
||||
public boolean setSharedMediaLayoutVisible(boolean sharedMediaLayoutVisible) {
|
||||
if (this.sharedMediaLayoutVisible != sharedMediaLayoutVisible) {
|
||||
this.sharedMediaLayoutVisible = sharedMediaLayoutVisible;
|
||||
notifyDataSetChanged();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean myLocationDenied = false;
|
||||
private boolean askingForMyLocation = false;
|
||||
public void setMyLocationDenied(boolean myLocationDenied, boolean askingForLocation) {
|
||||
|
@ -323,49 +305,43 @@ public class LocationActivityAdapter extends BaseLocationAdapter implements Loca
|
|||
}
|
||||
fetchingLocation = true;
|
||||
updateCell();
|
||||
LocationController.fetchLocationAddress(location, stories ? LocationController.TYPE_STORY : 0, this);
|
||||
LocationController.fetchLocationAddress(location, this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
int count;
|
||||
if (locationType == LocationActivity.LOCATION_TYPE_LIVE_VIEW) {
|
||||
count = 2;
|
||||
return 2;
|
||||
} else if (locationType == LocationActivity.LOCATION_TYPE_GROUP_VIEW) {
|
||||
count = 2;
|
||||
return 2;
|
||||
} else if (locationType == LocationActivity.LOCATION_TYPE_GROUP) {
|
||||
count = 2;
|
||||
return 2;
|
||||
} else if (biz) {
|
||||
count = 2;
|
||||
return 2;
|
||||
} else if (currentMessageObject != null) {
|
||||
count = 2 + (currentLiveLocations.isEmpty() ? (fromStories ? 0 : 1) : currentLiveLocations.size() + 3);
|
||||
return 2 + (currentLiveLocations.isEmpty() ? 1 : currentLiveLocations.size() + 3);
|
||||
} else if (locationType == LocationActivity.LOCATION_TYPE_LIVE) {
|
||||
LocationController.SharingLocationInfo currentInfo = LocationController.getInstance(currentAccount).getSharingLocationInfo(dialogId);
|
||||
count = 2 + currentLiveLocations.size() + (currentInfo != null && currentInfo.period != 0x7FFFFFFF ? 1 : 0);
|
||||
return 2 + currentLiveLocations.size() + (currentInfo != null && currentInfo.period != 0x7FFFFFFF ? 1 : 0);
|
||||
} else {
|
||||
if (searching || !searched || places.isEmpty()) {
|
||||
count = 6;
|
||||
int count = 6;
|
||||
if (locationType == LocationActivity.LOCATION_TYPE_SEND) {
|
||||
count = 5;
|
||||
} else if (locationType == ChatAttachAlertLocationLayout.LOCATION_TYPE_STORY) {
|
||||
count = 5 + (this.street != null ? 1 : 0);
|
||||
}
|
||||
count += (!myLocationDenied && (searching || !searched) ? 2 : 0) + (needEmptyView ? 1 : 0) - (myLocationDenied ? 2 : 0);
|
||||
} else {
|
||||
count = 5;
|
||||
if (locationType == LocationActivity.LOCATION_TYPE_SEND_WITH_LIVE) {
|
||||
count = 6;
|
||||
} else if (locationType == ChatAttachAlertLocationLayout.LOCATION_TYPE_STORY) {
|
||||
count = 5;// + (this.street != null ? 1 : 0);
|
||||
}
|
||||
count += locations.size() + places.size() + (needEmptyView ? 1 : 0);
|
||||
return count + (!myLocationDenied && (searching || !searched) ? 2 : 0) + (needEmptyView ? 1 : 0) - (myLocationDenied ? 2 : 0);
|
||||
}
|
||||
int count = 5;
|
||||
if (locationType == LocationActivity.LOCATION_TYPE_SEND_WITH_LIVE) {
|
||||
count = 6;
|
||||
} else if (locationType == ChatAttachAlertLocationLayout.LOCATION_TYPE_STORY) {
|
||||
count = 5;// + (this.street != null ? 1 : 0);
|
||||
}
|
||||
return count + locations.size() + places.size() + (needEmptyView ? 1 : 0);
|
||||
}
|
||||
if (sharedMediaLayout != null && sharedMediaLayoutVisible) {
|
||||
count++;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
private FrameLayout emptyCell;
|
||||
|
@ -443,9 +419,6 @@ public class LocationActivityAdapter extends BaseLocationAdapter implements Loca
|
|||
view = locationCell2;
|
||||
break;
|
||||
}
|
||||
case VIEW_TYPE_SHARED_STORIES:
|
||||
view = sharedMediaLayout;
|
||||
break;
|
||||
case VIEW_TYPE_EMPTY:
|
||||
default: {
|
||||
view = new View(mContext);
|
||||
|
@ -468,7 +441,6 @@ public class LocationActivityAdapter extends BaseLocationAdapter implements Loca
|
|||
public static final int VIEW_TYPE_SHADOW = 10;
|
||||
public static final int VIEW_TYPE_EMPTY = 11;
|
||||
public static final int VIEW_TYPE_STORY_LOCATION = 12;
|
||||
public static final int VIEW_TYPE_SHARED_STORIES = 13;
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
|
||||
|
@ -631,9 +603,6 @@ public class LocationActivityAdapter extends BaseLocationAdapter implements Loca
|
|||
|
||||
@Override
|
||||
public int getItemViewType(int position) {
|
||||
if (position == getItemCount() - 1 && sharedMediaLayout != null && sharedMediaLayoutVisible) {
|
||||
return VIEW_TYPE_SHARED_STORIES;
|
||||
}
|
||||
if (position == 0) {
|
||||
return VIEW_TYPE_PADDING;
|
||||
}
|
||||
|
@ -750,4 +719,4 @@ public class LocationActivityAdapter extends BaseLocationAdapter implements Loca
|
|||
private int getThemedColor(int key) {
|
||||
return Theme.getColor(key, resourcesProvider);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,53 +8,30 @@
|
|||
|
||||
package org.telegram.ui.Adapters;
|
||||
|
||||
import static org.telegram.messenger.AndroidUtilities.checkAndroidTheme;
|
||||
import static org.telegram.messenger.AndroidUtilities.dp;
|
||||
import static org.telegram.messenger.AndroidUtilities.statusBarHeight;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Paint;
|
||||
import android.text.TextUtils;
|
||||
import android.util.TypedValue;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import org.telegram.messenger.AndroidUtilities;
|
||||
import org.telegram.messenger.HashtagSearchController;
|
||||
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.UserConfig;
|
||||
import org.telegram.messenger.Utilities;
|
||||
import org.telegram.tgnet.TLRPC;
|
||||
import org.telegram.ui.ActionBar.Theme;
|
||||
import org.telegram.ui.Cells.DialogCell;
|
||||
import org.telegram.ui.Components.AvatarsDrawable;
|
||||
import org.telegram.ui.Components.FlickerLoadingView;
|
||||
import org.telegram.ui.Components.LayoutHelper;
|
||||
import org.telegram.ui.Components.RecyclerListView;
|
||||
import org.telegram.ui.Stories.StoriesController;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
|
||||
public class MessagesSearchAdapter extends RecyclerListView.SelectionAdapter implements NotificationCenter.NotificationCenterDelegate {
|
||||
public class MessagesSearchAdapter extends RecyclerListView.SelectionAdapter {
|
||||
|
||||
private Context mContext;
|
||||
private HashSet<Integer> messageIds = new HashSet<>();
|
||||
private ArrayList<MessageObject> searchResultMessages = new ArrayList<>();
|
||||
|
||||
public boolean containsStories;
|
||||
|
||||
public int loadedCount;
|
||||
public int flickerCount;
|
||||
|
||||
|
@ -71,64 +48,10 @@ public class MessagesSearchAdapter extends RecyclerListView.SelectionAdapter imp
|
|||
this.isSavedMessages = isSavedMessages;
|
||||
}
|
||||
|
||||
public StoriesController.SearchStoriesList storiesList;
|
||||
public void setStoriesList(StoriesController.SearchStoriesList storiesList) {
|
||||
this.storiesList = storiesList;
|
||||
if (storiesList != null) {
|
||||
storiesList.load(true, 3);
|
||||
}
|
||||
}
|
||||
|
||||
private Runnable loadStories = () -> {
|
||||
if (storiesList != null) {
|
||||
storiesList.load(true, 3);
|
||||
}
|
||||
};
|
||||
|
||||
public void searchStories(String hashtag, boolean instant) {
|
||||
if (hashtag.startsWith("$")) hashtag = "";
|
||||
if (hashtag.startsWith("#")) hashtag = hashtag.substring(1);
|
||||
|
||||
final String currentHashtag = storiesList == null ? "" : storiesList.query;
|
||||
if (TextUtils.equals(currentHashtag, hashtag)) return;
|
||||
|
||||
final boolean wereContainingStories = containsStories;
|
||||
|
||||
AndroidUtilities.cancelRunOnUIThread(loadStories);
|
||||
if (storiesList != null) {
|
||||
storiesList.cancel();
|
||||
}
|
||||
|
||||
if (!TextUtils.isEmpty(hashtag)) {
|
||||
storiesList = new StoriesController.SearchStoriesList(currentAccount, hashtag);
|
||||
if (instant) {
|
||||
loadStories.run();
|
||||
} else {
|
||||
AndroidUtilities.runOnUIThread(loadStories, 1000);
|
||||
}
|
||||
}
|
||||
|
||||
final boolean nowContainingStories = storiesList != null && storiesList.getCount() > 0;
|
||||
if (nowContainingStories != wereContainingStories) {
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void didReceivedNotification(int id, int account, Object... args) {
|
||||
if (id == NotificationCenter.storiesListUpdated) {
|
||||
if (args[0] == storiesList) {
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void notifyDataSetChanged() {
|
||||
final int oldItemsCount = getItemCount();
|
||||
|
||||
containsStories = storiesList != null && storiesList.getCount() > 0;
|
||||
|
||||
searchResultMessages.clear();
|
||||
messageIds.clear();
|
||||
ArrayList<MessageObject> searchResults = searchType == 0 ? MediaDataController.getInstance(currentAccount).getFoundMessageObjects() : HashtagSearchController.getInstance(currentAccount).getMessages(searchType);
|
||||
|
@ -164,13 +87,10 @@ public class MessagesSearchAdapter extends RecyclerListView.SelectionAdapter imp
|
|||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return (containsStories ? 1 : 0) + searchResultMessages.size() + flickerCount;
|
||||
return searchResultMessages.size() + flickerCount;
|
||||
}
|
||||
|
||||
public Object getItem(int i) {
|
||||
if (containsStories) {
|
||||
i--;
|
||||
}
|
||||
if (i < 0 || i >= searchResultMessages.size()) {
|
||||
return null;
|
||||
}
|
||||
|
@ -179,7 +99,7 @@ public class MessagesSearchAdapter extends RecyclerListView.SelectionAdapter imp
|
|||
|
||||
@Override
|
||||
public boolean isEnabled(RecyclerView.ViewHolder holder) {
|
||||
return holder.getItemViewType() == 0 || holder.getItemViewType() == 2;
|
||||
return holder.getItemViewType() == 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -195,9 +115,6 @@ public class MessagesSearchAdapter extends RecyclerListView.SelectionAdapter imp
|
|||
flickerLoadingView.setViewType(FlickerLoadingView.DIALOG_CELL_TYPE);
|
||||
view = flickerLoadingView;
|
||||
break;
|
||||
case 2:
|
||||
view = new StoriesView(mContext, resourcesProvider);
|
||||
break;
|
||||
}
|
||||
view.setLayoutParams(new RecyclerView.LayoutParams(RecyclerView.LayoutParams.MATCH_PARENT, RecyclerView.LayoutParams.WRAP_CONTENT));
|
||||
return new RecyclerListView.Holder(view);
|
||||
|
@ -232,106 +149,14 @@ public class MessagesSearchAdapter extends RecyclerListView.SelectionAdapter imp
|
|||
useMe = true;
|
||||
}
|
||||
cell.setDialog(did, messageObject, date, useMe, false);
|
||||
} else if (holder.getItemViewType() == 2) {
|
||||
((StoriesView) holder.itemView).set(storiesList);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemViewType(int i) {
|
||||
if (containsStories) {
|
||||
i--;
|
||||
if (i == -1)
|
||||
return 2;
|
||||
}
|
||||
if (i < searchResultMessages.size()) {
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
public void attach() {
|
||||
NotificationCenter.getInstance(currentAccount).addObserver(this, NotificationCenter.storiesListUpdated);
|
||||
}
|
||||
|
||||
public void detach() {
|
||||
AndroidUtilities.cancelRunOnUIThread(loadStories);
|
||||
NotificationCenter.getInstance(currentAccount).removeObserver(this, NotificationCenter.storiesListUpdated);
|
||||
}
|
||||
|
||||
public static class StoriesView extends FrameLayout {
|
||||
|
||||
private final Theme.ResourcesProvider resourcesProvider;
|
||||
private final AvatarsDrawable avatarsDrawable;
|
||||
private final TextView titleTextView;
|
||||
private final TextView subtitleTextView;
|
||||
|
||||
public StoriesView(Context context, Theme.ResourcesProvider resourcesProvider) {
|
||||
super(context);
|
||||
this.resourcesProvider = resourcesProvider;
|
||||
setWillNotDraw(false);
|
||||
|
||||
avatarsDrawable = new AvatarsDrawable(this, false);
|
||||
avatarsDrawable.setCentered(true);
|
||||
avatarsDrawable.width = dp(75);
|
||||
avatarsDrawable.height = dp(48);
|
||||
avatarsDrawable.drawStoriesCircle = true;
|
||||
avatarsDrawable.setSize(dp(22));
|
||||
|
||||
titleTextView = new TextView(context);
|
||||
titleTextView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText, resourcesProvider));
|
||||
titleTextView.setTypeface(AndroidUtilities.bold());
|
||||
titleTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14);
|
||||
addView(titleTextView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.TOP, 76, 7, 12, 0));
|
||||
|
||||
subtitleTextView = new TextView(context);
|
||||
subtitleTextView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteGrayText2, resourcesProvider));
|
||||
subtitleTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 12);
|
||||
addView(subtitleTextView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.TOP, 76, 26.33f, 12, 0));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
||||
super.onMeasure(MeasureSpec.makeMeasureSpec(MeasureSpec.getSize(widthMeasureSpec), MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(dp(48), MeasureSpec.EXACTLY));
|
||||
}
|
||||
|
||||
public void set(StoriesController.SearchStoriesList list) {
|
||||
int actualCount = 0;
|
||||
for (int i = 0; i < list.messageObjects.size() && actualCount < 3; ++i) {
|
||||
MessageObject msg = list.messageObjects.get(i);
|
||||
final long dialogId = msg.storyItem.dialogId;
|
||||
if (dialogId >= 0) {
|
||||
TLRPC.User user = MessagesController.getInstance(list.currentAccount).getUser(dialogId);
|
||||
if (user != null) {
|
||||
avatarsDrawable.setObject(actualCount, list.currentAccount, user);
|
||||
actualCount++;
|
||||
}
|
||||
} else {
|
||||
TLRPC.Chat chat = MessagesController.getInstance(list.currentAccount).getChat(-dialogId);
|
||||
if (chat != null) {
|
||||
avatarsDrawable.setObject(actualCount, list.currentAccount, chat);
|
||||
actualCount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
avatarsDrawable.setCount(actualCount);
|
||||
avatarsDrawable.commitTransition(false);
|
||||
|
||||
titleTextView.setText(LocaleController.formatPluralString("HashtagStoriesFound", list.getCount()));
|
||||
subtitleTextView.setText(LocaleController.formatString(R.string.HashtagStoriesFoundSubtitle, list.query));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDraw(Canvas canvas) {
|
||||
canvas.save();
|
||||
canvas.translate(0, 0);
|
||||
avatarsDrawable.onDraw(canvas);
|
||||
canvas.restore();
|
||||
|
||||
super.onDraw(canvas);
|
||||
Paint dividerPaint = Theme.getThemePaint(Theme.key_paint_divider, resourcesProvider);
|
||||
if (dividerPaint == null) dividerPaint = Theme.dividerPaint;
|
||||
canvas.drawRect(0, getHeight() - 1, getWidth(), getHeight(), dividerPaint);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -170,7 +170,6 @@ import org.telegram.ui.Components.RecyclerListView;
|
|||
import org.telegram.ui.Components.SeekBar;
|
||||
import org.telegram.ui.Components.SeekBarView;
|
||||
import org.telegram.ui.Components.ShareAlert;
|
||||
import org.telegram.ui.Components.SizeNotifierFrameLayout;
|
||||
import org.telegram.ui.Components.StaticLayoutEx;
|
||||
import org.telegram.ui.Components.TableLayout;
|
||||
import org.telegram.ui.Components.TextPaintImageReceiverSpan;
|
||||
|
@ -193,14 +192,6 @@ import java.util.Locale;
|
|||
|
||||
public class ArticleViewer implements NotificationCenter.NotificationCenterDelegate {
|
||||
|
||||
public final boolean isSheet;
|
||||
public final ArticleViewer.Sheet sheet;
|
||||
|
||||
public ArticleViewer(boolean sheet, Context context) {
|
||||
this.isSheet = sheet;
|
||||
this.sheet = sheet ? new ArticleViewer.Sheet(context) : null;
|
||||
}
|
||||
|
||||
private Activity parentActivity;
|
||||
private BaseFragment parentFragment;
|
||||
private ArrayList<BlockEmbedCell> createdWebViews = new ArrayList<>();
|
||||
|
@ -336,17 +327,13 @@ public class ArticleViewer implements NotificationCenter.NotificationCenterDeleg
|
|||
synchronized (ArticleViewer.class) {
|
||||
localInstance = Instance;
|
||||
if (localInstance == null) {
|
||||
Instance = localInstance = new ArticleViewer(false, null);
|
||||
Instance = localInstance = new ArticleViewer();
|
||||
}
|
||||
}
|
||||
}
|
||||
return localInstance;
|
||||
}
|
||||
|
||||
public static ArticleViewer makeSheet(Context context) {
|
||||
return new ArticleViewer(true, context);
|
||||
}
|
||||
|
||||
public static boolean hasInstance() {
|
||||
return Instance != null;
|
||||
}
|
||||
|
@ -372,7 +359,7 @@ public class ArticleViewer implements NotificationCenter.NotificationCenterDeleg
|
|||
private TLRPC.TL_pageBlockDetails parent;
|
||||
}
|
||||
|
||||
private static class TL_pageBlockListParent extends TLRPC.PageBlock {
|
||||
private class TL_pageBlockListParent extends TLRPC.PageBlock {
|
||||
private TLRPC.TL_pageBlockList pageBlockList;
|
||||
private ArrayList<TL_pageBlockListItem> items = new ArrayList<>();
|
||||
private int maxNumWidth;
|
||||
|
@ -381,7 +368,7 @@ public class ArticleViewer implements NotificationCenter.NotificationCenterDeleg
|
|||
private int level;
|
||||
}
|
||||
|
||||
private static class TL_pageBlockListItem extends TLRPC.PageBlock {
|
||||
private class TL_pageBlockListItem extends TLRPC.PageBlock {
|
||||
private TL_pageBlockListParent parent;
|
||||
private TLRPC.PageBlock blockItem;
|
||||
private TLRPC.RichText textItem;
|
||||
|
@ -390,7 +377,7 @@ public class ArticleViewer implements NotificationCenter.NotificationCenterDeleg
|
|||
private int index = Integer.MAX_VALUE;
|
||||
}
|
||||
|
||||
private static class TL_pageBlockOrderedListParent extends TLRPC.PageBlock {
|
||||
private class TL_pageBlockOrderedListParent extends TLRPC.PageBlock {
|
||||
private TLRPC.TL_pageBlockOrderedList pageBlockOrderedList;
|
||||
private ArrayList<TL_pageBlockOrderedListItem> items = new ArrayList<>();
|
||||
private int maxNumWidth;
|
||||
|
@ -399,7 +386,7 @@ public class ArticleViewer implements NotificationCenter.NotificationCenterDeleg
|
|||
private int level;
|
||||
}
|
||||
|
||||
private static class TL_pageBlockOrderedListItem extends TLRPC.PageBlock {
|
||||
private class TL_pageBlockOrderedListItem extends TLRPC.PageBlock {
|
||||
private TL_pageBlockOrderedListParent parent;
|
||||
private TLRPC.PageBlock blockItem;
|
||||
private TLRPC.RichText textItem;
|
||||
|
@ -3051,7 +3038,7 @@ public class ArticleViewer implements NotificationCenter.NotificationCenterDeleg
|
|||
|
||||
public void setParentActivity(Activity activity, BaseFragment fragment) {
|
||||
parentFragment = fragment;
|
||||
currentAccount = fragment != null ? fragment.getCurrentAccount() : UserConfig.selectedAccount;
|
||||
currentAccount = UserConfig.selectedAccount;
|
||||
NotificationCenter.getInstance(currentAccount).addObserver(this, NotificationCenter.messagePlayingProgressDidChanged);
|
||||
NotificationCenter.getInstance(currentAccount).addObserver(this, NotificationCenter.messagePlayingDidReset);
|
||||
NotificationCenter.getInstance(currentAccount).addObserver(this, NotificationCenter.messagePlayingPlayStateChanged);
|
||||
|
@ -3636,11 +3623,7 @@ public class ArticleViewer implements NotificationCenter.NotificationCenterDeleg
|
|||
} else {
|
||||
webPageUrl = adapter[0].currentPage.url;
|
||||
}
|
||||
if (parentActivity == null || parentActivity.isFinishing()) return;
|
||||
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(webPageUrl));
|
||||
intent.putExtra(android.provider.Browser.EXTRA_CREATE_NEW_TAB, true);
|
||||
intent.putExtra(android.provider.Browser.EXTRA_APPLICATION_ID, parentActivity.getPackageName());
|
||||
parentActivity.startActivity(intent);
|
||||
Browser.openUrl(parentActivity, webPageUrl, true, false);
|
||||
} else if (id == settings_item) {
|
||||
BottomSheet.Builder builder = new BottomSheet.Builder(parentActivity);
|
||||
builder.setApplyTopPadding(false);
|
||||
|
@ -4330,10 +4313,7 @@ public class ArticleViewer implements NotificationCenter.NotificationCenterDeleg
|
|||
}
|
||||
|
||||
lastInsets = null;
|
||||
if (sheet != null) {
|
||||
AndroidUtilities.removeFromParent(windowView);
|
||||
sheet.windowView.addView(windowView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));
|
||||
} else if (!isVisible) {
|
||||
if (!isVisible) {
|
||||
WindowManager wm = (WindowManager) parentActivity.getSystemService(Context.WINDOW_SERVICE);
|
||||
if (attachedToWindow) {
|
||||
try {
|
||||
|
@ -7135,7 +7115,7 @@ public class ArticleViewer implements NotificationCenter.NotificationCenterDeleg
|
|||
}
|
||||
|
||||
if (currentBlock.date != 0) {
|
||||
dateLayout = createLayoutForText(this, LocaleController.getInstance().getChatFullDate().format((long) currentBlock.date * 1000), null, width - AndroidUtilities.dp(36 + 14 + (avatarVisible ? 40 + 14 : 0)), AndroidUtilities.dp(29), currentBlock, parentAdapter);
|
||||
dateLayout = createLayoutForText(this, LocaleController.getInstance().chatFullDate.format((long) currentBlock.date * 1000), null, width - AndroidUtilities.dp(36 + 14 + (avatarVisible ? 40 + 14 : 0)), AndroidUtilities.dp(29), currentBlock, parentAdapter);
|
||||
} else {
|
||||
dateLayout = null;
|
||||
}
|
||||
|
@ -9686,11 +9666,11 @@ public class ArticleViewer implements NotificationCenter.NotificationCenterDeleg
|
|||
}
|
||||
String description;
|
||||
if (item.published_date != 0 && !TextUtils.isEmpty(item.author)) {
|
||||
description = LocaleController.formatString("ArticleDateByAuthor", R.string.ArticleDateByAuthor, LocaleController.getInstance().getChatFullDate().format((long) item.published_date * 1000), item.author);
|
||||
description = LocaleController.formatString("ArticleDateByAuthor", R.string.ArticleDateByAuthor, LocaleController.getInstance().chatFullDate.format((long) item.published_date * 1000), item.author);
|
||||
} else if (!TextUtils.isEmpty(item.author)) {
|
||||
description = LocaleController.formatString("ArticleByAuthor", R.string.ArticleByAuthor, item.author);
|
||||
} else if (item.published_date != 0) {
|
||||
description = LocaleController.getInstance().getChatFullDate().format((long) item.published_date * 1000);
|
||||
description = LocaleController.getInstance().chatFullDate.format((long) item.published_date * 1000);
|
||||
} else if (!TextUtils.isEmpty(item.description)) {
|
||||
description = item.description;
|
||||
} else {
|
||||
|
@ -10964,11 +10944,11 @@ public class ArticleViewer implements NotificationCenter.NotificationCenterDeleg
|
|||
spans = null;
|
||||
}
|
||||
if (currentBlock.published_date != 0 && !TextUtils.isEmpty(author)) {
|
||||
text = LocaleController.formatString("ArticleDateByAuthor", R.string.ArticleDateByAuthor, LocaleController.getInstance().getChatFullDate().format((long) currentBlock.published_date * 1000), author);
|
||||
text = LocaleController.formatString("ArticleDateByAuthor", R.string.ArticleDateByAuthor, LocaleController.getInstance().chatFullDate.format((long) currentBlock.published_date * 1000), author);
|
||||
} else if (!TextUtils.isEmpty(author)) {
|
||||
text = LocaleController.formatString("ArticleByAuthor", R.string.ArticleByAuthor, author);
|
||||
} else {
|
||||
text = LocaleController.getInstance().getChatFullDate().format((long) currentBlock.published_date * 1000);
|
||||
text = LocaleController.getInstance().chatFullDate.format((long) currentBlock.published_date * 1000);
|
||||
}
|
||||
try {
|
||||
if (spans != null && spans.length > 0) {
|
||||
|
@ -11848,79 +11828,4 @@ public class ArticleViewer implements NotificationCenter.NotificationCenterDeleg
|
|||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public class Sheet implements BaseFragment.AttachedSheet {
|
||||
|
||||
public WindowView windowView;
|
||||
|
||||
public Sheet(Context context) {
|
||||
|
||||
windowView = new WindowView(context);
|
||||
|
||||
}
|
||||
|
||||
public WindowView getWindowView() {
|
||||
return windowView;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isShown() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dismiss() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void release() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFullyVisible() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean attachedToParent() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBackPressed() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean showDialog(Dialog dialog) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setKeyboardHeightFromParent(int keyboardHeight) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getNavigationBarColor(int color) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOnDismissListener(Runnable onDismiss) {
|
||||
|
||||
}
|
||||
|
||||
public class WindowView extends SizeNotifierFrameLayout {
|
||||
|
||||
public WindowView(Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -7,7 +7,6 @@ import android.graphics.Canvas;
|
|||
import android.graphics.Paint;
|
||||
import android.text.Spannable;
|
||||
import android.text.style.ReplacementSpan;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
@ -16,7 +15,6 @@ import androidx.annotation.Nullable;
|
|||
import org.telegram.messenger.ImageReceiver;
|
||||
import org.telegram.messenger.MessagesController;
|
||||
import org.telegram.tgnet.TLRPC;
|
||||
import org.telegram.ui.ActionBar.Theme;
|
||||
import org.telegram.ui.Components.AvatarDrawable;
|
||||
|
||||
public class AvatarSpan extends ReplacementSpan {
|
||||
|
@ -89,14 +87,6 @@ public class AvatarSpan extends ReplacementSpan {
|
|||
}
|
||||
};
|
||||
|
||||
public void setDialogId(long dialogId) {
|
||||
if (dialogId >= 0) {
|
||||
setUser(MessagesController.getInstance(currentAccount).getUser(dialogId));
|
||||
} else {
|
||||
setChat(MessagesController.getInstance(currentAccount).getChat(-dialogId));
|
||||
}
|
||||
}
|
||||
|
||||
public void setChat(TLRPC.Chat chat) {
|
||||
avatarDrawable.setInfo(currentAccount, chat);
|
||||
imageReceiver.setForUserOrChat(chat, avatarDrawable);
|
||||
|
@ -118,17 +108,11 @@ public class AvatarSpan extends ReplacementSpan {
|
|||
}
|
||||
|
||||
private float translateX, translateY;
|
||||
private int shadowPaintAlpha = 0xFF;
|
||||
|
||||
@Override
|
||||
public void draw(@NonNull Canvas canvas, CharSequence text, int start, int end, float x, int top, int y, int bottom, @NonNull Paint paint) {
|
||||
if (shadowPaintAlpha != paint.getAlpha()) {
|
||||
shadowPaint.setAlpha(shadowPaintAlpha = paint.getAlpha());
|
||||
shadowPaint.setShadowLayer(dp(1), 0, dp(.66f), Theme.multAlpha(0x33000000, shadowPaintAlpha / 255f));
|
||||
}
|
||||
canvas.drawCircle(translateX + x + dp(sz) / 2f, translateY + (top + bottom) / 2f, dp(sz) / 2f, shadowPaint);
|
||||
imageReceiver.setImageCoords(translateX + x, translateY + (top + bottom) / 2f - dp(sz) / 2f, dp(sz), dp(sz));
|
||||
imageReceiver.setAlpha(paint.getAlpha() / 255f);
|
||||
imageReceiver.draw(canvas);
|
||||
}
|
||||
|
||||
|
|
|
@ -270,7 +270,7 @@ public class BoostsActivity extends GradientHeaderActivity implements Notificati
|
|||
overviewCell.setData(0, Integer.toString(boostsStatus.level), null, LocaleController.getString("BoostsLevel2", R.string.BoostsLevel2));
|
||||
if (boostsStatus.premium_audience != null && boostsStatus.premium_audience.total != 0) {
|
||||
float percent = (((float) boostsStatus.premium_audience.part / (float) boostsStatus.premium_audience.total) * 100f);
|
||||
overviewCell.setData(1, "≈" + (int) boostsStatus.premium_audience.part, String.format(Locale.US, "%.1f", percent) + "%", LocaleController.getString(isChannel() ? R.string.PremiumSubscribers : R.string.PremiumMembers));
|
||||
overviewCell.setData(1, "~" + (int) boostsStatus.premium_audience.part, String.format(Locale.US, "%.1f", percent) + "%", LocaleController.getString(isChannel() ? R.string.PremiumSubscribers : R.string.PremiumMembers));
|
||||
} else {
|
||||
overviewCell.setData(1, "~0", "0%", LocaleController.getString(isChannel() ? R.string.PremiumSubscribers : R.string.PremiumMembers));
|
||||
}
|
||||
|
|
|
@ -80,7 +80,7 @@ public class BubbleActivity extends BasePermissionsActivity implements INavigati
|
|||
Theme.createDialogsResources(this);
|
||||
Theme.createChatResources(this, false);
|
||||
|
||||
actionBarLayout = INavigationLayout.newLayout(this, false);
|
||||
actionBarLayout = INavigationLayout.newLayout(this);
|
||||
actionBarLayout.setInBubbleMode(true);
|
||||
actionBarLayout.setRemoveActionBarExtraHeight(true);
|
||||
|
||||
|
|
|
@ -174,7 +174,7 @@ public class BusinessIntroActivity extends UniversalFragment implements Notifica
|
|||
previewContainer.addView(previewBackground, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, Gravity.FILL));
|
||||
previewContainer.addView(greetingsView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.CENTER, 42, 18, 42, 18));
|
||||
|
||||
titleEdit = new EditTextCell(context, getString(R.string.BusinessIntroTitleHint), false, getMessagesController().introTitleLengthLimit, resourceProvider) {
|
||||
titleEdit = new EditTextCell(context, getString(R.string.BusinessIntroTitleHint), false, getMessagesController().introTitleLengthLimit) {
|
||||
@Override
|
||||
protected void onTextChanged(CharSequence newText) {
|
||||
greetingsView.setPreview(titleEdit.getText().toString(), messageEdit.getText().toString());
|
||||
|
@ -193,7 +193,7 @@ public class BusinessIntroActivity extends UniversalFragment implements Notifica
|
|||
titleEdit.setBackgroundColor(getThemedColor(Theme.key_windowBackgroundWhite));
|
||||
titleEdit.setDivider(true);
|
||||
titleEdit.hideKeyboardOnEnter();
|
||||
messageEdit = new EditTextCell(context, getString(R.string.BusinessIntroMessageHint), true, getMessagesController().introDescriptionLengthLimit, resourceProvider) {
|
||||
messageEdit = new EditTextCell(context, getString(R.string.BusinessIntroMessageHint), true, getMessagesController().introDescriptionLengthLimit) {
|
||||
@Override
|
||||
protected void onTextChanged(CharSequence newText) {
|
||||
greetingsView.setPreview(titleEdit.getText().toString(), messageEdit.getText().toString());
|
||||
|
|
|
@ -468,7 +468,7 @@ public class OpeningHoursActivity extends BaseFragment implements NotificationCe
|
|||
int hours = (time - min) / 60 % 24;
|
||||
Calendar rightNow = Calendar.getInstance();
|
||||
rightNow.set(0, 0, 0, hours, min);
|
||||
String str = LocaleController.getInstance().getFormatterConstDay().format(rightNow.getTime());
|
||||
String str = LocaleController.getInstance().formatterConstDay.format(rightNow.getTime());
|
||||
if (time > 24 * 60 && includeNextDay) {
|
||||
return LocaleController.formatString(R.string.BusinessHoursNextDay, str);
|
||||
}
|
||||
|
|
|
@ -332,7 +332,7 @@ public class CachedMediaLayout extends FrameLayout implements NestedSizeNotifier
|
|||
photoEntries.add(new MediaController.PhotoEntry(0, 0, 0, fileInfo.file.getPath(), 0, fileInfo.type == TYPE_VIDEOS, 0, 0, 0));
|
||||
PhotoViewer.getInstance().openPhotoForSelect(photoEntries, 0, PhotoViewer.SELECT_TYPE_NO_SELECT, false, placeProvider, null);
|
||||
} else {
|
||||
AndroidUtilities.openForView(fileInfo.file, fileInfo.file.getName(), null, parentFragment.getParentActivity(), null, false);
|
||||
AndroidUtilities.openForView(fileInfo.file, fileInfo.file.getName(), null, parentFragment.getParentActivity(), null);
|
||||
}
|
||||
}
|
||||
if (cacheCell.type == TYPE_MUSIC) {
|
||||
|
|
|
@ -188,7 +188,7 @@ public class CameraScanActivity extends BaseFragment {
|
|||
if (parentActivity == null) {
|
||||
return null;
|
||||
}
|
||||
INavigationLayout[] actionBarLayout = new INavigationLayout[]{INavigationLayout.newLayout(parentActivity, false)};
|
||||
INavigationLayout[] actionBarLayout = new INavigationLayout[]{INavigationLayout.newLayout(parentActivity)};
|
||||
BottomSheet bottomSheet = new BottomSheet(parentActivity, false) {
|
||||
CameraScanActivity fragment;
|
||||
{
|
||||
|
|
|
@ -16,7 +16,6 @@ import android.graphics.RenderNode;
|
|||
import android.graphics.drawable.Drawable;
|
||||
import android.graphics.drawable.RippleDrawable;
|
||||
import android.os.Build;
|
||||
import android.util.Log;
|
||||
import android.view.HapticFeedbackConstants;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.ViewConfiguration;
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -113,7 +113,6 @@ import org.telegram.ui.Components.VectorAvatarThumbDrawable;
|
|||
import org.telegram.ui.Components.spoilers.SpoilerEffect;
|
||||
import org.telegram.ui.DialogsActivity;
|
||||
import org.telegram.ui.RightSlidingDialogContainer;
|
||||
import org.telegram.ui.Stars.StarsIntroActivity;
|
||||
import org.telegram.ui.Stories.StoriesListPlaceProvider;
|
||||
import org.telegram.ui.Stories.StoriesUtilities;
|
||||
import org.telegram.ui.Stories.StoryViewer;
|
||||
|
@ -937,7 +936,7 @@ public class DialogCell extends BaseCell implements StoriesListPlaceProvider.Ava
|
|||
if (UserObject.isDeleted(currentUser)) {
|
||||
title = LocaleController.getString("HiddenName", R.string.HiddenName);
|
||||
} else {
|
||||
title = AndroidUtilities.removeDiacritics(ContactsController.formatName(currentUser.first_name, currentUser.last_name).replace('\n', ' '));
|
||||
title = ContactsController.formatName(currentUser.first_name, currentUser.last_name).replace('\n', ' ');
|
||||
}
|
||||
} else {
|
||||
continue;
|
||||
|
@ -1290,7 +1289,7 @@ public class DialogCell extends BaseCell implements StoriesListPlaceProvider.Ava
|
|||
draftVoice = false;
|
||||
needEmoji = true;
|
||||
updateMessageThumbs();
|
||||
messageNameString = AndroidUtilities.removeDiacritics(getMessageNameString());
|
||||
messageNameString = getMessageNameString();
|
||||
messageString = formatTopicsNames();
|
||||
String restrictionReason = message != null ? MessagesController.getRestrictionReason(message.messageOwner.restriction_reason) : null;
|
||||
buttonString = message != null ? getMessageStringFormatted(messageFormatType, restrictionReason, messageNameString, true) : "";
|
||||
|
@ -1486,10 +1485,10 @@ public class DialogCell extends BaseCell implements StoriesListPlaceProvider.Ava
|
|||
updateMessageThumbs();
|
||||
String triedMessageName = null;
|
||||
if (!isSavedDialog && user != null && user.self && !message.isOutOwner()) {
|
||||
triedMessageName = AndroidUtilities.removeDiacritics(getMessageNameString());
|
||||
triedMessageName = getMessageNameString();
|
||||
}
|
||||
if (isSavedDialog && user != null && !user.self && message != null && message.isOutOwner() || triedMessageName != null || chat != null && chat.id > 0 && fromChat == null && (!ChatObject.isChannel(chat) || ChatObject.isMegagroup(chat)) && !ForumUtilities.isTopicCreateMessage(message)) {
|
||||
messageNameString = AndroidUtilities.removeDiacritics(triedMessageName != null ? triedMessageName : getMessageNameString());
|
||||
messageNameString = triedMessageName != null ? triedMessageName : getMessageNameString();
|
||||
if (chat != null && chat.forum && !isTopic && !useFromUserAsAvatar) {
|
||||
CharSequence topicName = MessagesController.getInstance(currentAccount).getTopicsController().getTopicIconName(chat, message, currentMessagePaint);
|
||||
if (!TextUtils.isEmpty(topicName)) {
|
||||
|
@ -1600,16 +1599,6 @@ public class DialogCell extends BaseCell implements StoriesListPlaceProvider.Ava
|
|||
}
|
||||
messageString = new SpannableStringBuilder(emoji).append(msgBuilder);
|
||||
}
|
||||
} else if (message.messageOwner.media instanceof TLRPC.TL_messageMediaPaidMedia) {
|
||||
TLRPC.TL_messageMediaPaidMedia paidMedia = (TLRPC.TL_messageMediaPaidMedia) message.messageOwner.media;
|
||||
final int count = paidMedia.extended_media.size();
|
||||
if (hasVideoThumb) {
|
||||
messageString = count > 1 ? LocaleController.formatPluralString("Media", count) : LocaleController.getString(R.string.AttachVideo);
|
||||
} else {
|
||||
messageString = count > 1 ? LocaleController.formatPluralString("Photos", count) : LocaleController.getString(R.string.AttachPhoto);
|
||||
}
|
||||
messageString = StarsIntroActivity.replaceStars(LocaleController.formatString(R.string.AttachPaidMedia, messageString));
|
||||
currentMessagePaint = Theme.dialogs_messagePrintingPaint[paintIndex];
|
||||
} else if (thumbsCount > 1) {
|
||||
if (hasVideoThumb) {
|
||||
messageString = LocaleController.formatPluralString("Media", groupMessages == null ? 0 : groupMessages.size());
|
||||
|
@ -1867,9 +1856,9 @@ public class DialogCell extends BaseCell implements StoriesListPlaceProvider.Ava
|
|||
topicIconInName = new Drawable[1];
|
||||
}
|
||||
topicIconInName[0] = null;
|
||||
nameString = showTopicIconInName ? ForumUtilities.getTopicSpannedName(forumTopic, Theme.dialogs_namePaint[paintIndex], topicIconInName, false) : AndroidUtilities.removeDiacritics(forumTopic.title);
|
||||
nameString = showTopicIconInName ? ForumUtilities.getTopicSpannedName(forumTopic, Theme.dialogs_namePaint[paintIndex], topicIconInName, false) : forumTopic.title;
|
||||
} else {
|
||||
nameString = AndroidUtilities.removeDiacritics(chat.title);
|
||||
nameString = chat.title;
|
||||
}
|
||||
} else if (user != null) {
|
||||
if (UserObject.isReplyUser(user)) {
|
||||
|
@ -1888,7 +1877,7 @@ public class DialogCell extends BaseCell implements StoriesListPlaceProvider.Ava
|
|||
nameString = LocaleController.getString("SavedMessages", R.string.SavedMessages);
|
||||
}
|
||||
} else {
|
||||
nameString = AndroidUtilities.removeDiacritics(UserObject.getUserName(user));
|
||||
nameString = UserObject.getUserName(user);
|
||||
}
|
||||
}
|
||||
if (nameString != null && nameString.length() == 0) {
|
||||
|
@ -4867,20 +4856,7 @@ public class DialogCell extends BaseCell implements StoriesListPlaceProvider.Ava
|
|||
return;
|
||||
}
|
||||
String restrictionReason = MessagesController.getRestrictionReason(message.messageOwner.restriction_reason);
|
||||
if (message != null && message.messageOwner != null && message.messageOwner.media instanceof TLRPC.TL_messageMediaPaidMedia) {
|
||||
thumbsCount = 0;
|
||||
hasVideoThumb = false;
|
||||
TLRPC.TL_messageMediaPaidMedia paidMedia = (TLRPC.TL_messageMediaPaidMedia) message.messageOwner.media;
|
||||
int index = 0;
|
||||
for (int i = 0; i < paidMedia.extended_media.size() && thumbsCount < 3; ++i) {
|
||||
TLRPC.MessageExtendedMedia emedia = paidMedia.extended_media.get(i);
|
||||
if (emedia instanceof TLRPC.TL_messageExtendedMediaPreview) {
|
||||
setThumb(index++, ((TLRPC.TL_messageExtendedMediaPreview) emedia).thumb);
|
||||
} else if (emedia instanceof TLRPC.TL_messageExtendedMedia) {
|
||||
setThumb(index++, ((TLRPC.TL_messageExtendedMedia) emedia).media);
|
||||
}
|
||||
}
|
||||
} else if (groupMessages != null && groupMessages.size() > 1 && TextUtils.isEmpty(restrictionReason) && currentDialogFolderId == 0 && encryptedChat == null) {
|
||||
if (groupMessages != null && groupMessages.size() > 1 && TextUtils.isEmpty(restrictionReason) && currentDialogFolderId == 0 && encryptedChat == null) {
|
||||
thumbsCount = 0;
|
||||
hasVideoThumb = false;
|
||||
Collections.sort(groupMessages, Comparator.comparingInt(MessageObject::getId));
|
||||
|
@ -4948,60 +4924,6 @@ public class DialogCell extends BaseCell implements StoriesListPlaceProvider.Ava
|
|||
}
|
||||
}
|
||||
|
||||
private void setThumb(int index, TLRPC.MessageMedia media) {
|
||||
TLObject object = null;
|
||||
ArrayList<TLRPC.PhotoSize> photoThumbs = null;
|
||||
boolean isVideo = false;
|
||||
if (media instanceof TLRPC.TL_messageMediaPhoto) {
|
||||
object = media.photo;
|
||||
photoThumbs = media.photo.sizes;
|
||||
} else if (media instanceof TLRPC.TL_messageMediaDocument) {
|
||||
isVideo = MessageObject.isVideoDocument(media.document);
|
||||
object = media.document;
|
||||
photoThumbs = media.document.thumbs;
|
||||
}
|
||||
|
||||
TLRPC.PhotoSize smallThumb = FileLoader.getClosestPhotoSizeWithSize(photoThumbs, 40);
|
||||
TLRPC.PhotoSize bigThumb = FileLoader.getClosestPhotoSizeWithSize(photoThumbs, AndroidUtilities.getPhotoSize(), false, null, true);
|
||||
if (smallThumb == bigThumb) {
|
||||
bigThumb = null;
|
||||
}
|
||||
TLRPC.PhotoSize selectedThumb = bigThumb;
|
||||
if (selectedThumb == null || DownloadController.getInstance(currentAccount).canDownloadMedia(message.messageOwner, media) == 0) {
|
||||
selectedThumb = smallThumb;
|
||||
}
|
||||
|
||||
if (smallThumb != null) {
|
||||
hasVideoThumb = hasVideoThumb || isVideo;
|
||||
if (thumbsCount < 3) {
|
||||
thumbsCount++;
|
||||
drawPlay[index] = isVideo;
|
||||
drawSpoiler[index] = false;
|
||||
int size = !isVideo && selectedThumb != null ? selectedThumb.size : 0;
|
||||
String filter = "20_20";
|
||||
thumbImage[index].setImage(ImageLocation.getForObject(selectedThumb, object), filter, ImageLocation.getForObject(smallThumb, object), filter, size, null, message, 0);
|
||||
thumbImage[index].setRoundRadius(dp(2));
|
||||
needEmoji = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void setThumb(int index, TLRPC.PhotoSize thumb) {
|
||||
if (thumb != null) {
|
||||
hasVideoThumb = false;
|
||||
if (thumbsCount < 3) {
|
||||
thumbsCount++;
|
||||
drawPlay[index] = false;
|
||||
drawSpoiler[index] = true;
|
||||
int size = 0;
|
||||
String filter = "2_2_b";
|
||||
thumbImage[index].setImage(ImageLocation.getForObject(thumb, message.messageOwner), filter, null, null, size, null, message, 0);
|
||||
thumbImage[index].setRoundRadius(dp(2));
|
||||
needEmoji = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public String getMessageNameString() {
|
||||
if (message == null) {
|
||||
return null;
|
||||
|
@ -5042,29 +4964,29 @@ public class DialogCell extends BaseCell implements StoriesListPlaceProvider.Ava
|
|||
|
||||
if (currentDialogId == selfId) {
|
||||
if (fromUser != null) {
|
||||
return AndroidUtilities.removeDiacritics(UserObject.getFirstName(fromUser).replace("\n", ""));
|
||||
return UserObject.getFirstName(fromUser).replace("\n", "");
|
||||
} else if (fromChat != null) {
|
||||
return AndroidUtilities.removeDiacritics(fromChat.title.replace("\n", ""));
|
||||
return fromChat.title.replace("\n", "");
|
||||
}
|
||||
return null;
|
||||
} else if (message.isOutOwner()) {
|
||||
return LocaleController.getString("FromYou", R.string.FromYou);
|
||||
} else if (!isSavedDialog && message != null && message.messageOwner != null && message.messageOwner.from_id instanceof TLRPC.TL_peerUser && (user = MessagesController.getInstance(currentAccount).getUser(message.messageOwner.from_id.user_id)) != null) {
|
||||
return AndroidUtilities.removeDiacritics(UserObject.getFirstName(user).replace("\n", ""));
|
||||
return UserObject.getFirstName(user).replace("\n", "");
|
||||
} else if (message != null && message.messageOwner != null && message.messageOwner.fwd_from != null && message.messageOwner.fwd_from.from_name != null) {
|
||||
return AndroidUtilities.removeDiacritics(message.messageOwner.fwd_from.from_name);
|
||||
return message.messageOwner.fwd_from.from_name;
|
||||
} else if (fromUser != null) {
|
||||
if (useForceThreeLines || SharedConfig.useThreeLinesLayout) {
|
||||
if (UserObject.isDeleted(fromUser)) {
|
||||
return LocaleController.getString("HiddenName", R.string.HiddenName);
|
||||
} else {
|
||||
return AndroidUtilities.removeDiacritics(ContactsController.formatName(fromUser.first_name, fromUser.last_name).replace("\n", ""));
|
||||
return ContactsController.formatName(fromUser.first_name, fromUser.last_name).replace("\n", "");
|
||||
}
|
||||
} else {
|
||||
return AndroidUtilities.removeDiacritics(UserObject.getFirstName(fromUser).replace("\n", ""));
|
||||
return UserObject.getFirstName(fromUser).replace("\n", "");
|
||||
}
|
||||
} else if (fromChat != null && fromChat.title != null) {
|
||||
return AndroidUtilities.removeDiacritics(fromChat.title.replace("\n", ""));
|
||||
return fromChat.title.replace("\n", "");
|
||||
} else {
|
||||
return "DELETED";
|
||||
}
|
||||
|
@ -5186,16 +5108,6 @@ public class DialogCell extends BaseCell implements StoriesListPlaceProvider.Ava
|
|||
} else {
|
||||
innerMessage = String.format("\uD83C\uDFA7 %s - %s", message.getMusicAuthor(), message.getMusicTitle());
|
||||
}
|
||||
} else if (message.messageOwner.media instanceof TLRPC.TL_messageMediaPaidMedia) {
|
||||
TLRPC.TL_messageMediaPaidMedia paidMedia = (TLRPC.TL_messageMediaPaidMedia) message.messageOwner.media;
|
||||
final int count = paidMedia.extended_media.size();
|
||||
if (hasVideoThumb) {
|
||||
innerMessage = count > 1 ? LocaleController.formatPluralString("Media", count) : LocaleController.getString(R.string.AttachVideo);
|
||||
} else {
|
||||
innerMessage = count > 1 ? LocaleController.formatPluralString("Photos", count) : LocaleController.getString(R.string.AttachPhoto);
|
||||
}
|
||||
innerMessage = StarsIntroActivity.replaceStars(LocaleController.formatString(R.string.AttachPaidMedia, innerMessage));
|
||||
colorKey = Theme.key_chats_actionMessage;
|
||||
} else if (thumbsCount > 1) {
|
||||
if (hasVideoThumb) {
|
||||
innerMessage = LocaleController.formatPluralString("Media", groupMessages == null ? 0 : groupMessages.size());
|
||||
|
|
|
@ -167,9 +167,9 @@ public class DialogsHintCell extends BlurredFrameLayout {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void dispatchDraw(Canvas canvas) {
|
||||
super.dispatchDraw(canvas);
|
||||
canvas.drawRect(0, getHeight() - 1, getWidth(), getHeight(), Theme.dividerPaint);
|
||||
protected void onDraw(Canvas canvas) {
|
||||
super.onDraw(canvas);
|
||||
canvas.drawLine(0, getHeight() - 1, getWidth(), getHeight() - 1, Theme.dividerPaint);
|
||||
}
|
||||
|
||||
private int height;
|
||||
|
|
|
@ -92,15 +92,14 @@ public class EditTextCell extends FrameLayout {
|
|||
}
|
||||
|
||||
public EditTextCell(Context context, String hint, boolean multiline) {
|
||||
this(context, hint, multiline, -1, null);
|
||||
this(context, hint, multiline, -1);
|
||||
}
|
||||
|
||||
public EditTextCell(
|
||||
Context context,
|
||||
String hint,
|
||||
boolean multiline,
|
||||
int maxLength,
|
||||
Theme.ResourcesProvider resourceProvider
|
||||
int maxLength
|
||||
) {
|
||||
super(context);
|
||||
this.maxLength = maxLength;
|
||||
|
@ -123,7 +122,7 @@ public class EditTextCell extends FrameLayout {
|
|||
@Override
|
||||
protected void dispatchDraw(Canvas canvas) {
|
||||
super.dispatchDraw(canvas);
|
||||
limit.setTextColor(limitColor.set(Theme.getColor(limitCount <= 0 ? Theme.key_text_RedRegular : Theme.key_dialogSearchHint, resourceProvider)));
|
||||
limit.setTextColor(limitColor.set(Theme.getColor(limitCount <= 0 ? Theme.key_text_RedRegular : Theme.key_dialogSearchHint, getResourcesProvider())));
|
||||
limit.setBounds(getScrollX(), 0, getScrollX() + getWidth() - getPaddingRight() + dp(42), getHeight());
|
||||
limit.draw(canvas);
|
||||
}
|
||||
|
@ -138,8 +137,8 @@ public class EditTextCell extends FrameLayout {
|
|||
};
|
||||
limit.setCallback(editText);
|
||||
editText.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 17);
|
||||
editText.setHintTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteHintText, resourceProvider));
|
||||
editText.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText, resourceProvider));
|
||||
editText.setHintTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteHintText));
|
||||
editText.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
|
||||
editText.setBackground(null);
|
||||
if (multiline) {
|
||||
editText.setMaxLines(5);
|
||||
|
@ -153,7 +152,7 @@ public class EditTextCell extends FrameLayout {
|
|||
editText.setInputType(InputType.TYPE_TEXT_FLAG_CAP_SENTENCES | InputType.TYPE_CLASS_TEXT | (multiline ? InputType.TYPE_TEXT_FLAG_MULTI_LINE : 0) | InputType.TYPE_TEXT_FLAG_AUTO_CORRECT | InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);
|
||||
editText.setRawInputType(InputType.TYPE_TEXT_FLAG_CAP_SENTENCES | InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_AUTO_CORRECT | InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);
|
||||
editText.setHint(hint);
|
||||
editText.setCursorColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText, resourceProvider));
|
||||
editText.setCursorColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
|
||||
editText.setCursorSize(dp(19));
|
||||
editText.setCursorWidth(1.5f);
|
||||
editText.addTextChangedListener(new TextWatcher() {
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -57,8 +57,7 @@ public class LocationCell extends FrameLayout {
|
|||
addView(imageView, LayoutHelper.createFrame(42, 42, Gravity.TOP | (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT), LocaleController.isRTL ? 0 : 15, 11, LocaleController.isRTL ? 15 : 0, 0));
|
||||
|
||||
nameTextView = new AnimatedTextView(context, true, true, true);
|
||||
nameTextView.setAnimationProperties(0.4f, 0, 350, CubicBezierInterpolator.EASE_OUT_QUINT);
|
||||
nameTextView.setScaleProperty(.6f);
|
||||
nameTextView.setAnimationProperties(0.4f, 0, 240, CubicBezierInterpolator.EASE_OUT_QUINT);
|
||||
nameTextView.setTextSize(AndroidUtilities.dp(16));
|
||||
nameTextView.setEllipsizeByGradient(true);
|
||||
nameTextView.setTextColor(getThemedColor(Theme.key_windowBackgroundWhiteBlackText));
|
||||
|
@ -69,8 +68,7 @@ public class LocationCell extends FrameLayout {
|
|||
addView(nameTextView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 22, Gravity.TOP | (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT), (LocaleController.isRTL ? 16 : 73), 10, (LocaleController.isRTL ? 73 : 16), 0));
|
||||
|
||||
addressTextView = new AnimatedTextView(context, true, true, true);
|
||||
addressTextView.setScaleProperty(.6f);
|
||||
addressTextView.setAnimationProperties(0.4f, 0, 350, CubicBezierInterpolator.EASE_OUT_QUINT);
|
||||
addressTextView.setAnimationProperties(0.4f, 0, 240, CubicBezierInterpolator.EASE_OUT_QUINT);
|
||||
addressTextView.setTextSize(AndroidUtilities.dp(14));
|
||||
addressTextView.setEllipsizeByGradient(true);
|
||||
addressTextView.setTextColor(getThemedColor(Theme.key_windowBackgroundWhiteGrayText3));
|
||||
|
|
|
@ -26,9 +26,6 @@ import android.graphics.drawable.Drawable;
|
|||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.SystemClock;
|
||||
import android.text.SpannableString;
|
||||
import android.text.SpannableStringBuilder;
|
||||
import android.text.Spanned;
|
||||
import android.text.TextUtils;
|
||||
import android.util.TypedValue;
|
||||
import android.view.Gravity;
|
||||
|
@ -57,13 +54,11 @@ import org.telegram.tgnet.TLRPC;
|
|||
import org.telegram.ui.ActionBar.Theme;
|
||||
import org.telegram.ui.Components.BackupImageView;
|
||||
import org.telegram.ui.Components.CheckBox2;
|
||||
import org.telegram.ui.Components.ColoredImageSpan;
|
||||
import org.telegram.ui.Components.CubicBezierInterpolator;
|
||||
import org.telegram.ui.Components.LayoutHelper;
|
||||
import org.telegram.ui.Components.spoilers.SpoilerEffect;
|
||||
import org.telegram.ui.Components.spoilers.SpoilerEffect2;
|
||||
import org.telegram.ui.PhotoViewer;
|
||||
import org.telegram.ui.Stars.StarsIntroActivity;
|
||||
|
||||
public class PhotoAttachPhotoCell extends FrameLayout {
|
||||
|
||||
|
@ -95,9 +90,6 @@ public class PhotoAttachPhotoCell extends FrameLayout {
|
|||
private SpoilerEffect2 spoilerEffect2;
|
||||
private boolean hasSpoiler;
|
||||
|
||||
private long stars;
|
||||
private boolean starsSelectedMultiple;
|
||||
|
||||
private Path path = new Path();
|
||||
private float spoilerRevealX;
|
||||
private float spoilerRevealY;
|
||||
|
@ -130,12 +122,9 @@ public class PhotoAttachPhotoCell extends FrameLayout {
|
|||
path.addCircle(spoilerRevealX, spoilerRevealY, spoilerMaxRadius * spoilerRevealProgress, Path.Direction.CW);
|
||||
canvas.clipPath(path, Region.Op.DIFFERENCE);
|
||||
}
|
||||
// float alphaProgress = CubicBezierInterpolator.DEFAULT.getInterpolation(1f - imageViewCrossfadeProgress);
|
||||
// float alpha = hasSpoiler ? alphaProgress : 1f - alphaProgress;
|
||||
float alphaProgress = CubicBezierInterpolator.DEFAULT.getInterpolation(1f - imageViewCrossfadeProgress);
|
||||
float alpha = hasSpoiler ? alphaProgress : 1f - alphaProgress;
|
||||
spoilerEffect2.draw(canvas, container, imageView.getMeasuredWidth(), imageView.getMeasuredHeight());
|
||||
if (photoEntry != null && photoEntry.starsAmount > 0) {
|
||||
imageView.drawBlurredText(canvas, 1f);
|
||||
}
|
||||
if (spoilerRevealProgress != 0f) {
|
||||
canvas.restore();
|
||||
}
|
||||
|
@ -311,40 +300,6 @@ public class PhotoAttachPhotoCell extends FrameLayout {
|
|||
}
|
||||
}
|
||||
|
||||
private SpannableString star, lock;
|
||||
public void setStarsPrice(long stars, boolean multiple) {
|
||||
if (multiple != starsSelectedMultiple || stars != this.stars) {
|
||||
this.stars = stars;
|
||||
this.starsSelectedMultiple = multiple;
|
||||
|
||||
SpannableStringBuilder s = null;
|
||||
if (stars > 0) {
|
||||
s = new SpannableStringBuilder();
|
||||
if (star == null) {
|
||||
star = new SpannableString("⭐");
|
||||
ColoredImageSpan span = new ColoredImageSpan(R.drawable.star_small_inner);
|
||||
span.setScale(.7f, .7f);
|
||||
star.setSpan(span, 0, star.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
}
|
||||
s.append(star);
|
||||
s.append(" ");
|
||||
if (multiple) {
|
||||
if (lock == null) {
|
||||
lock = new SpannableString("l");
|
||||
ColoredImageSpan span = new ColoredImageSpan(R.drawable.msg_mini_lock2);
|
||||
lock.setSpan(span, 0, lock.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
}
|
||||
s.append(lock);
|
||||
} else {
|
||||
s.append(Long.toString(stars));
|
||||
}
|
||||
}
|
||||
imageView.setBlurredText(s);
|
||||
imageView.invalidate();
|
||||
container.invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
private void updateSpoilers2(boolean hasSpoiler) {
|
||||
if (container == null || imageView == null || imageView.getMeasuredHeight() <= 0 || imageView.getMeasuredWidth() <= 0) {
|
||||
return;
|
||||
|
@ -441,7 +396,7 @@ public class PhotoAttachPhotoCell extends FrameLayout {
|
|||
return videoInfoContainer;
|
||||
}
|
||||
|
||||
public void setPhotoEntry(MediaController.PhotoEntry entry, boolean selectedMultiple, boolean needCheckShow, boolean last) {
|
||||
public void setPhotoEntry(MediaController.PhotoEntry entry, boolean needCheckShow, boolean last) {
|
||||
pressed = false;
|
||||
photoEntry = entry;
|
||||
isLast = last;
|
||||
|
@ -470,7 +425,6 @@ public class PhotoAttachPhotoCell extends FrameLayout {
|
|||
videoInfoContainer.setAlpha(showing ? 0.0f : 1.0f);
|
||||
requestLayout();
|
||||
setHasSpoiler(entry.hasSpoiler);
|
||||
setStarsPrice(entry.starsAmount, selectedMultiple);
|
||||
}
|
||||
|
||||
public void setPhotoEntry(MediaController.SearchImage searchImage, boolean needCheckShow, boolean last) {
|
||||
|
@ -510,7 +464,6 @@ public class PhotoAttachPhotoCell extends FrameLayout {
|
|||
videoInfoContainer.setAlpha(showing ? 0.0f : 1.0f);
|
||||
requestLayout();
|
||||
setHasSpoiler(false);
|
||||
setStarsPrice(0, false);
|
||||
}
|
||||
|
||||
public boolean isChecked() {
|
||||
|
@ -560,8 +513,8 @@ public class PhotoAttachPhotoCell extends FrameLayout {
|
|||
checkBox.setNum(num);
|
||||
}
|
||||
|
||||
public void setOnCheckClickListener(OnClickListener onCheckClickListener) {
|
||||
checkFrame.setOnClickListener(onCheckClickListener);
|
||||
public void setOnCheckClickLisnener(OnClickListener onCheckClickLisnener) {
|
||||
checkFrame.setOnClickListener(onCheckClickLisnener);
|
||||
}
|
||||
|
||||
public void setDelegate(PhotoAttachPhotoCellDelegate delegate) {
|
||||
|
@ -669,7 +622,7 @@ public class PhotoAttachPhotoCell extends FrameLayout {
|
|||
}
|
||||
if (photoEntry != null) {
|
||||
sb.append(". ");
|
||||
sb.append(LocaleController.getInstance().getFormatterStats().format(photoEntry.dateTaken * 1000L));
|
||||
sb.append(LocaleController.getInstance().formatterStats.format(photoEntry.dateTaken * 1000L));
|
||||
}
|
||||
info.setText(sb);
|
||||
if (checkBox.isChecked()) {
|
||||
|
|
|
@ -390,9 +390,9 @@ public class ProfileSearchCell extends BaseCell implements NotificationCenter.No
|
|||
} else {
|
||||
String nameString2 = "";
|
||||
if (chat != null) {
|
||||
nameString2 = AndroidUtilities.removeDiacritics(chat.title);
|
||||
nameString2 = chat.title;
|
||||
} else if (user != null) {
|
||||
nameString2 = AndroidUtilities.removeDiacritics(UserObject.getUserName(user));
|
||||
nameString2 = UserObject.getUserName(user);
|
||||
}
|
||||
nameString = nameString2.replace('\n', ' ');
|
||||
}
|
||||
|
|
|
@ -85,10 +85,10 @@ public class ReactedUserHolderView extends FrameLayout {
|
|||
public static final MessageSeenCheckDrawable forwardDrawable = new MessageSeenCheckDrawable(R.drawable.mini_forward_story, Theme.key_stories_circle1);
|
||||
|
||||
public ReactedUserHolderView(int style, int currentAccount, @NonNull Context context, Theme.ResourcesProvider resourcesProvider) {
|
||||
this(style, currentAccount, context, resourcesProvider, true, true);
|
||||
this(style, currentAccount, context, resourcesProvider, true);
|
||||
}
|
||||
|
||||
public ReactedUserHolderView(int style, int currentAccount, @NonNull Context context, Theme.ResourcesProvider resourcesProvider, boolean useOverlaySelector, boolean showReactionPreview) {
|
||||
public ReactedUserHolderView(int style, int currentAccount, @NonNull Context context, Theme.ResourcesProvider resourcesProvider, boolean useOverlaySelector) {
|
||||
super(context);
|
||||
this.style = style;
|
||||
this.currentAccount = currentAccount;
|
||||
|
@ -155,13 +155,11 @@ public class ReactedUserHolderView extends FrameLayout {
|
|||
topMargin = style == STYLE_STORY ? 24f : 19f;
|
||||
addView(subtitleView, LayoutHelper.createFrameRelatively(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.FILL_HORIZONTAL | Gravity.TOP, leftMargin, topMargin , 20, 0));
|
||||
|
||||
if (showReactionPreview) {
|
||||
reactView = new BackupImageView(context);
|
||||
addView(reactView, LayoutHelper.createFrameRelatively(24, 24, Gravity.END | Gravity.CENTER_VERTICAL, 0, 0, 12, 0));
|
||||
reactView = new BackupImageView(context);
|
||||
addView(reactView, LayoutHelper.createFrameRelatively(24, 24, Gravity.END | Gravity.CENTER_VERTICAL, 0, 0, 12, 0));
|
||||
|
||||
storyPreviewView = new BackupImageView(context);
|
||||
addView(storyPreviewView, LayoutHelper.createFrameRelatively(22, 35, Gravity.END | Gravity.CENTER_VERTICAL, 0, 0, 12, 0));
|
||||
}
|
||||
storyPreviewView = new BackupImageView(context);
|
||||
addView(storyPreviewView, LayoutHelper.createFrameRelatively(22, 35, Gravity.END | Gravity.CENTER_VERTICAL, 0, 0, 12, 0));
|
||||
|
||||
if (useOverlaySelector) {
|
||||
overlaySelectorView = new View(context);
|
||||
|
@ -203,12 +201,10 @@ public class ReactedUserHolderView extends FrameLayout {
|
|||
}
|
||||
avatarView.setImage(ImageLocation.getForUserOrChat(u, ImageLocation.TYPE_SMALL), "50_50", thumb, u);
|
||||
|
||||
String contentDescription = "";
|
||||
String contentDescription;
|
||||
boolean hasReactImage = false;
|
||||
if (like) {
|
||||
if (reactView != null) {
|
||||
reactView.setAnimatedEmojiDrawable(null);
|
||||
}
|
||||
reactView.setAnimatedEmojiDrawable(null);
|
||||
hasReactImage = true;
|
||||
Drawable likeDrawableFilled = ContextCompat.getDrawable(getContext(), R.drawable.media_like_active).mutate();
|
||||
reactView.setColorFilter(new PorterDuffColorFilter(0xFFFF2E38, PorterDuff.Mode.MULTIPLY));
|
||||
|
@ -217,57 +213,45 @@ public class ReactedUserHolderView extends FrameLayout {
|
|||
} else if (reaction != null) {
|
||||
ReactionsLayoutInBubble.VisibleReaction visibleReaction = ReactionsLayoutInBubble.VisibleReaction.fromTL(reaction);
|
||||
if (visibleReaction.emojicon != null) {
|
||||
if (reactView != null) {
|
||||
reactView.setAnimatedEmojiDrawable(null);
|
||||
}
|
||||
reactView.setAnimatedEmojiDrawable(null);
|
||||
TLRPC.TL_availableReaction r = MediaDataController.getInstance(currentAccount).getReactionsMap().get(visibleReaction.emojicon);
|
||||
if (reactView != null) {
|
||||
if (r != null) {
|
||||
SvgHelper.SvgDrawable svgThumb = DocumentObject.getSvgThumb(r.static_icon.thumbs, Theme.key_windowBackgroundGray, 1.0f);
|
||||
reactView.setImage(ImageLocation.getForDocument(r.center_icon), "40_40_lastreactframe", "webp", svgThumb, r);
|
||||
hasReactImage = true;
|
||||
} else {
|
||||
reactView.setImageDrawable(null);
|
||||
}
|
||||
reactView.setColorFilter(null);
|
||||
if (r != null) {
|
||||
SvgHelper.SvgDrawable svgThumb = DocumentObject.getSvgThumb(r.static_icon.thumbs, Theme.key_windowBackgroundGray, 1.0f);
|
||||
reactView.setImage(ImageLocation.getForDocument(r.center_icon), "40_40_lastreactframe", "webp", svgThumb, r);
|
||||
hasReactImage = true;
|
||||
} else {
|
||||
reactView.setImageDrawable(null);
|
||||
}
|
||||
reactView.setColorFilter(null);
|
||||
} else {
|
||||
AnimatedEmojiDrawable drawable = new AnimatedEmojiDrawable(AnimatedEmojiDrawable.CACHE_TYPE_MESSAGES, currentAccount, visibleReaction.documentId);
|
||||
drawable.setColorFilter(Theme.getAnimatedEmojiColorFilter(resourcesProvider));
|
||||
if (reactView != null) {
|
||||
reactView.setAnimatedEmojiDrawable(drawable);
|
||||
}
|
||||
reactView.setAnimatedEmojiDrawable(drawable);
|
||||
hasReactImage = true;
|
||||
}
|
||||
contentDescription = LocaleController.formatString("AccDescrReactedWith", R.string.AccDescrReactedWith, titleView.getText(), visibleReaction.emojicon != null ? visibleReaction.emojicon : reaction);
|
||||
} else {
|
||||
if (reactView != null) {
|
||||
reactView.setAnimatedEmojiDrawable(null);
|
||||
reactView.setImageDrawable(null);
|
||||
}
|
||||
reactView.setAnimatedEmojiDrawable(null);
|
||||
reactView.setImageDrawable(null);
|
||||
contentDescription = LocaleController.formatString("AccDescrPersonHasSeen", R.string.AccDescrPersonHasSeen, titleView.getText());
|
||||
}
|
||||
|
||||
if (storyItem != null) {
|
||||
storyId = storyItem.id;
|
||||
if (storyPreviewView != null) {
|
||||
if (storyItem.media != null && storyItem.media.photo != null) {
|
||||
final TLRPC.PhotoSize photoSize = FileLoader.getClosestPhotoSizeWithSize(storyItem.media.photo.sizes, 35, false, null, true);
|
||||
storyPreviewView.setImage(ImageLocation.getForPhoto(photoSize, storyItem.media.photo), "22_35", null, null, -1, storyItem);
|
||||
} else if (storyItem.media != null && storyItem.media.document != null) {
|
||||
final TLRPC.PhotoSize photoSize = FileLoader.getClosestPhotoSizeWithSize(storyItem.media.document.thumbs, 35, false, null, true);
|
||||
storyPreviewView.setImage(ImageLocation.getForDocument(photoSize, storyItem.media.document), "22_35", null, null, -1, storyItem);
|
||||
}
|
||||
storyPreviewView.setRoundRadius(AndroidUtilities.dp(3.33f));
|
||||
if (storyItem.media != null && storyItem.media.photo != null) {
|
||||
final TLRPC.PhotoSize photoSize = FileLoader.getClosestPhotoSizeWithSize(storyItem.media.photo.sizes, 35, false, null, true);
|
||||
storyPreviewView.setImage(ImageLocation.getForPhoto(photoSize, storyItem.media.photo), "22_35", null, null, -1, storyItem);
|
||||
} else if (storyItem.media != null && storyItem.media.document != null) {
|
||||
final TLRPC.PhotoSize photoSize = FileLoader.getClosestPhotoSizeWithSize(storyItem.media.document.thumbs, 35, false, null, true);
|
||||
storyPreviewView.setImage(ImageLocation.getForDocument(photoSize, storyItem.media.document), "22_35", null, null, -1, storyItem);
|
||||
}
|
||||
storyPreviewView.setRoundRadius(AndroidUtilities.dp(3.33f));
|
||||
if (date <= 0) {
|
||||
date = storyItem.date;
|
||||
}
|
||||
} else {
|
||||
storyId = -1;
|
||||
if (storyPreviewView != null) {
|
||||
storyPreviewView.setImageDrawable(null);
|
||||
}
|
||||
storyPreviewView.setImageDrawable(null);
|
||||
}
|
||||
|
||||
if (date != 0) {
|
||||
|
|
|
@ -350,10 +350,6 @@ public class SessionCell extends FrameLayout {
|
|||
iconId = R.drawable.filled_star_plus;
|
||||
colorKey = Theme.key_color_yellow;
|
||||
colorKey2 = Theme.key_color_orange;
|
||||
} else if (platform.contains("ads")) {
|
||||
iconId = R.drawable.msg_channel;
|
||||
colorKey = Theme.key_avatar_backgroundPink;
|
||||
colorKey2 = Theme.key_avatar_background2Pink;
|
||||
} else if (platform.equals("?")) {
|
||||
iconId = R.drawable.msg_emoji_question;
|
||||
colorKey = -1;
|
||||
|
|
|
@ -357,7 +357,7 @@ public class SharedDocumentCell extends FrameLayout implements DownloadControlle
|
|||
if (builder.length() > 0) {
|
||||
builder.append(", ");
|
||||
}
|
||||
builder.append(LocaleController.getInstance().getFormatterStats().format(entry.dateTaken));
|
||||
builder.append(LocaleController.getInstance().formatterStats.format(entry.dateTaken));
|
||||
dateTextView.setText(builder);
|
||||
placeholderImageView.setVisibility(GONE);
|
||||
}
|
||||
|
@ -518,7 +518,7 @@ public class SharedDocumentCell extends FrameLayout implements DownloadControlle
|
|||
.append(fromName));
|
||||
rightDateTextView.setText(LocaleController.stringForMessageListDate(message.messageOwner.date));
|
||||
} else {
|
||||
dateTextView.setText(String.format("%s, %s", fileSize, LocaleController.formatString("formatDateAtTime", R.string.formatDateAtTime, LocaleController.getInstance().getFormatterYear().format(new Date(date)), LocaleController.getInstance().getFormatterDay().format(new Date(date)))));
|
||||
dateTextView.setText(String.format("%s, %s", fileSize, LocaleController.formatString("formatDateAtTime", R.string.formatDateAtTime, LocaleController.getInstance().formatterYear.format(new Date(date)), LocaleController.getInstance().formatterDay.format(new Date(date)))));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -21,8 +21,6 @@ import android.graphics.drawable.ColorDrawable;
|
|||
import android.graphics.drawable.Drawable;
|
||||
import android.graphics.drawable.GradientDrawable;
|
||||
import android.text.Layout;
|
||||
import android.text.SpannableStringBuilder;
|
||||
import android.text.Spanned;
|
||||
import android.text.StaticLayout;
|
||||
import android.text.TextPaint;
|
||||
import android.text.TextUtils;
|
||||
|
@ -47,7 +45,6 @@ import org.telegram.messenger.R;
|
|||
import org.telegram.messenger.Utilities;
|
||||
import org.telegram.tgnet.TLRPC;
|
||||
import org.telegram.ui.ActionBar.Theme;
|
||||
import org.telegram.ui.AvatarSpan;
|
||||
import org.telegram.ui.Components.AnimatedFloat;
|
||||
import org.telegram.ui.Components.AnimatedTextView;
|
||||
import org.telegram.ui.Components.CanvasButton;
|
||||
|
@ -55,7 +52,6 @@ import org.telegram.ui.Components.CheckBoxBase;
|
|||
import org.telegram.ui.Components.CombinedDrawable;
|
||||
import org.telegram.ui.Components.CubicBezierInterpolator;
|
||||
import org.telegram.ui.Components.FlickerLoadingView;
|
||||
import org.telegram.ui.Components.Text;
|
||||
import org.telegram.ui.Components.spoilers.SpoilerEffect;
|
||||
import org.telegram.ui.Components.spoilers.SpoilerEffect2;
|
||||
import org.telegram.ui.PhotoViewer;
|
||||
|
@ -71,7 +67,6 @@ public class SharedPhotoVideoCell2 extends FrameLayout {
|
|||
public ImageReceiver blurImageReceiver = new ImageReceiver();
|
||||
public int storyId;
|
||||
int currentAccount;
|
||||
public boolean isSearchingHashtag;
|
||||
MessageObject currentMessageObject;
|
||||
int currentParentColumnsCount;
|
||||
FlickerLoadingView globalGradientView;
|
||||
|
@ -92,8 +87,6 @@ public class SharedPhotoVideoCell2 extends FrameLayout {
|
|||
AnimatedFloat viewsAlpha = new AnimatedFloat(this, 0, 350, CubicBezierInterpolator.EASE_OUT_QUINT);
|
||||
AnimatedTextView.AnimatedTextDrawable viewsText = new AnimatedTextView.AnimatedTextDrawable(false, true, true);
|
||||
|
||||
private Text authorText;
|
||||
|
||||
CheckBoxBase checkBoxBase;
|
||||
SharedResources sharedResources;
|
||||
private boolean attached;
|
||||
|
@ -178,12 +171,12 @@ public class SharedPhotoVideoCell2 extends FrameLayout {
|
|||
}
|
||||
|
||||
public void setMessageObject(MessageObject messageObject, int parentColumnsCount) {
|
||||
int oldParentColumnsCount = currentParentColumnsCount;
|
||||
int oldParentColumsCount = currentParentColumnsCount;
|
||||
currentParentColumnsCount = parentColumnsCount;
|
||||
if (currentMessageObject == null && messageObject == null) {
|
||||
return;
|
||||
}
|
||||
if (currentMessageObject != null && messageObject != null && currentMessageObject.getId() == messageObject.getId() && oldParentColumnsCount == parentColumnsCount && (privacyType == 100) == isStoryPinned) {
|
||||
if (currentMessageObject != null && messageObject != null && currentMessageObject.getId() == messageObject.getId() && oldParentColumsCount == parentColumnsCount && (privacyType == 100) == isStoryPinned) {
|
||||
return;
|
||||
}
|
||||
currentMessageObject = messageObject;
|
||||
|
@ -202,7 +195,6 @@ public class SharedPhotoVideoCell2 extends FrameLayout {
|
|||
gradientDrawable = null;
|
||||
privacyType = -1;
|
||||
privacyBitmap = null;
|
||||
authorText = null;
|
||||
return;
|
||||
} else {
|
||||
if (attached) {
|
||||
|
@ -339,16 +331,6 @@ public class SharedPhotoVideoCell2 extends FrameLayout {
|
|||
setPrivacyType(-1, 0);
|
||||
}
|
||||
|
||||
if (isSearchingHashtag) {
|
||||
final long did = messageObject.getDialogId();
|
||||
SpannableStringBuilder sb = new SpannableStringBuilder("x ");
|
||||
sb.append(MessagesController.getInstance(currentAccount).getPeerName(did));
|
||||
AvatarSpan avatar = new AvatarSpan(this, currentAccount, parentColumnsCount == 2 ? 16f : 13.66f);
|
||||
avatar.setDialogId(did);
|
||||
sb.setSpan(avatar, 0, 1, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
authorText = new Text(sb, parentColumnsCount == 2 ? 14f : 10.1666f, AndroidUtilities.bold());
|
||||
}
|
||||
|
||||
invalidate();
|
||||
}
|
||||
|
||||
|
@ -430,7 +412,7 @@ public class SharedPhotoVideoCell2 extends FrameLayout {
|
|||
canvas.save();
|
||||
}
|
||||
|
||||
if (((checkBoxBase != null && checkBoxBase.isChecked()) || PhotoViewer.isShowingImage(currentMessageObject))) {
|
||||
if ((checkBoxBase != null && checkBoxBase.isChecked()) || PhotoViewer.isShowingImage(currentMessageObject)) {
|
||||
canvas.drawRect(leftpadding, padding, leftpadding + imageWidth - rightpadding, imageHeight, sharedResources.backgroundPaint);
|
||||
}
|
||||
|
||||
|
@ -493,7 +475,7 @@ public class SharedPhotoVideoCell2 extends FrameLayout {
|
|||
|
||||
invalidate();
|
||||
}
|
||||
if (!isSearchingHashtag && highlightProgress > 0) {
|
||||
if (highlightProgress > 0) {
|
||||
sharedResources.highlightPaint.setColor(ColorUtils.setAlphaComponent(Color.BLACK, (int) (0.5f * highlightProgress * 255)));
|
||||
canvas.drawRect(imageReceiver.getDrawRegion(), sharedResources.highlightPaint);
|
||||
}
|
||||
|
@ -502,11 +484,7 @@ public class SharedPhotoVideoCell2 extends FrameLayout {
|
|||
bounds.set(imageReceiver.getImageX(), imageReceiver.getImageY(), imageReceiver.getImageX2(), imageReceiver.getImageY2());
|
||||
drawDuration(canvas, bounds, 1f);
|
||||
drawViews(canvas, bounds, 1f);
|
||||
if (!isSearchingHashtag) {
|
||||
drawPrivacy(canvas, bounds, 1f);
|
||||
} else {
|
||||
drawAuthor(canvas, bounds, 1f);
|
||||
}
|
||||
drawPrivacy(canvas, bounds, 1f);
|
||||
|
||||
if (checkBoxBase != null && (style == STYLE_CACHE || checkBoxBase.getProgress() != 0)) {
|
||||
canvas.save();
|
||||
|
@ -618,17 +596,6 @@ public class SharedPhotoVideoCell2 extends FrameLayout {
|
|||
canvas.restore();
|
||||
}
|
||||
|
||||
public void drawAuthor(Canvas canvas, RectF bounds, float alpha) {
|
||||
if (!isStory || imageReceiver != null && !imageReceiver.getVisible() || !isSearchingHashtag || authorText == null) return;
|
||||
|
||||
final float p = dp(5.33f);
|
||||
authorText
|
||||
.ellipsize((int) (bounds.width() - p * 2))
|
||||
.setVerticalClipPadding(dp(14))
|
||||
.setShadow(.4f * alpha)
|
||||
.draw(canvas, bounds.left + p, bounds.top + dp(currentParentColumnsCount <= 2 ? 15 : 11.33f), Theme.multAlpha(0xFFFFFFFF, alpha), 1f);
|
||||
}
|
||||
|
||||
public void drawViews(Canvas canvas, RectF bounds, float alpha) {
|
||||
if (!isStory || imageReceiver != null && !imageReceiver.getVisible() || currentParentColumnsCount >= 5) {
|
||||
return;
|
||||
|
|
|
@ -235,8 +235,8 @@ public class StatisticPostInfoCell extends FrameLayout {
|
|||
views.setText(String.format(LocaleController.getPluralString("Views", postInfo.getViews()), AndroidUtilities.formatWholeNumber(postInfo.getViews(), 0)));
|
||||
|
||||
Date time = new Date(postInfo.getDate() * 1000L);
|
||||
String monthTxt = LocaleController.getInstance().getFormatterYear().format(time);
|
||||
String timeTxt = LocaleController.getInstance().getFormatterDay().format(time);
|
||||
String monthTxt = LocaleController.getInstance().formatterYear.format(time);
|
||||
String timeTxt = LocaleController.getInstance().formatterDay.format(time);
|
||||
date.setText(LocaleController.formatString("formatDateAtTime", R.string.formatDateAtTime, monthTxt, timeTxt));
|
||||
|
||||
shares.setText(AndroidUtilities.formatWholeNumber(postInfo.getForwards(), 0));
|
||||
|
|
|
@ -2204,7 +2204,7 @@ public abstract class TextSelectionHelper<Cell extends TextSelectionHelper.Selec
|
|||
MessageObject.TextLayoutBlocks captionLayout = cell.getCaptionLayout();
|
||||
for (int i = 0; i < captionLayout.textLayoutBlocks.size(); i++) {
|
||||
MessageObject.TextLayoutBlock block = captionLayout.textLayoutBlocks.get(i);
|
||||
if (y >= block.textYOffset(captionLayout.textLayoutBlocks) && y <= block.textYOffset(captionLayout.textLayoutBlocks) + block.padTop + block.height(cell.transitionParams)) {
|
||||
if (y >= block.textYOffset(captionLayout.textLayoutBlocks) && y <= block.textYOffset(captionLayout.textLayoutBlocks) + block.padTop + block.height) {
|
||||
layoutBlock.layout = block.textLayout;
|
||||
layoutBlock.yOffset = block.textYOffset(captionLayout.textLayoutBlocks) + block.padTop;
|
||||
int offsetX = 0;
|
||||
|
@ -2224,7 +2224,7 @@ public abstract class TextSelectionHelper<Cell extends TextSelectionHelper.Selec
|
|||
|
||||
for (int i = 0; i < messageObject.textLayoutBlocks.size(); i++) {
|
||||
MessageObject.TextLayoutBlock block = messageObject.textLayoutBlocks.get(i);
|
||||
if (y >= block.textYOffset(messageObject.textLayoutBlocks) && y <= block.textYOffset(messageObject.textLayoutBlocks) + block.padTop + block.height(cell.transitionParams)) {
|
||||
if (y >= block.textYOffset(messageObject.textLayoutBlocks) && y <= block.textYOffset(messageObject.textLayoutBlocks) + block.padTop + block.height) {
|
||||
layoutBlock.layout = block.textLayout;
|
||||
layoutBlock.yOffset = block.textYOffset(messageObject.textLayoutBlocks) + block.padTop;
|
||||
int offsetX = 0;
|
||||
|
@ -2498,10 +2498,6 @@ public abstract class TextSelectionHelper<Cell extends TextSelectionHelper.Selec
|
|||
clear(true);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isMenuEmpty() {
|
||||
return !canCopy() && !canShowQuote();
|
||||
}
|
||||
}
|
||||
|
||||
public static class ArticleTextSelectionHelper extends TextSelectionHelper<ArticleSelectableView> {
|
||||
|
|
|
@ -52,9 +52,9 @@ public class TopicSearchCell extends FrameLayout {
|
|||
public void setTopic(TLRPC.TL_forumTopic topic) {
|
||||
this.topic = topic;
|
||||
if (TextUtils.isEmpty(topic.searchQuery)) {
|
||||
textView.setText(AndroidUtilities.removeDiacritics(topic.title));
|
||||
textView.setText(topic.title);
|
||||
} else {
|
||||
textView.setText(AndroidUtilities.highlightText(AndroidUtilities.removeDiacritics(topic.title), topic.searchQuery, null));
|
||||
textView.setText(AndroidUtilities.highlightText(topic.title, topic.searchQuery, null));
|
||||
}
|
||||
ForumUtilities.setTopicIcon(backupImageView, topic);
|
||||
if (backupImageView != null && backupImageView.getImageReceiver() != null && backupImageView.getImageReceiver().getDrawable() instanceof ForumUtilities.GeneralTopicDrawable) {
|
||||
|
|
|
@ -56,6 +56,8 @@ import org.telegram.ui.Stories.StoriesUtilities;
|
|||
|
||||
public class UserCell extends FrameLayout implements NotificationCenter.NotificationCenterDelegate {
|
||||
|
||||
|
||||
public ImageView newImageView;
|
||||
public BackupImageView avatarImageView;
|
||||
protected SimpleTextView nameTextView;
|
||||
protected SimpleTextView statusTextView;
|
||||
|
@ -125,6 +127,17 @@ public class UserCell extends FrameLayout implements NotificationCenter.Notifica
|
|||
super(context);
|
||||
this.resourcesProvider = resourcesProvider;
|
||||
|
||||
|
||||
|
||||
newImageView = new ImageView(context);
|
||||
// newImageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
|
||||
|
||||
// newImageView.setImageResource(R.drawable.app_ic_background); // Replace with your image resource
|
||||
|
||||
addView(newImageView, LayoutHelper.createFrame(24, 24, (LocaleController.isRTL ? Gravity.LEFT : Gravity.RIGHT) | Gravity.TOP, 0, 15, 20, 0));
|
||||
|
||||
|
||||
|
||||
int additionalPadding;
|
||||
if (needAddButton) {
|
||||
addButton = new TextView(context);
|
||||
|
@ -273,6 +286,15 @@ public class UserCell extends FrameLayout implements NotificationCenter.Notifica
|
|||
}
|
||||
|
||||
public void setData(Object object, TLRPC.EncryptedChat ec, CharSequence name, CharSequence status, int resId, boolean divider) {
|
||||
|
||||
TLRPC.User a = (TLRPC.User) object;
|
||||
|
||||
if (a.mutual_contact == true){
|
||||
newImageView.setImageResource(R.drawable.connected_contact_ic);
|
||||
}else {
|
||||
newImageView.setImageResource(0);
|
||||
}
|
||||
|
||||
if (object == null && name == null && status == null) {
|
||||
currentStatus = null;
|
||||
currentName = null;
|
||||
|
@ -466,9 +488,9 @@ public class UserCell extends FrameLayout implements NotificationCenter.Notifica
|
|||
}
|
||||
if (!continueUpdate && currentName == null && lastName != null && (mask & MessagesController.UPDATE_MASK_NAME) != 0) {
|
||||
if (currentUser != null) {
|
||||
newName = AndroidUtilities.removeDiacritics(UserObject.getUserName(currentUser));
|
||||
newName = UserObject.getUserName(currentUser);
|
||||
} else {
|
||||
newName = AndroidUtilities.removeDiacritics(currentChat == null ? "" : currentChat.title);
|
||||
newName = currentChat.title;
|
||||
}
|
||||
if (!newName.equals(lastName)) {
|
||||
continueUpdate = true;
|
||||
|
@ -547,9 +569,9 @@ public class UserCell extends FrameLayout implements NotificationCenter.Notifica
|
|||
nameTextView.setText(currentName);
|
||||
} else {
|
||||
if (currentUser != null) {
|
||||
lastName = AndroidUtilities.removeDiacritics(newName == null ? UserObject.getUserName(currentUser) : newName);
|
||||
lastName = newName == null ? UserObject.getUserName(currentUser) : newName;
|
||||
} else if (currentChat != null) {
|
||||
lastName = AndroidUtilities.removeDiacritics(newName == null ? currentChat.title : newName);
|
||||
lastName = newName == null ? currentChat.title : newName;
|
||||
} else {
|
||||
lastName = "";
|
||||
}
|
||||
|
|
|
@ -2432,7 +2432,6 @@ public class ChannelAdminLogActivity extends BaseFragment implements Notificatio
|
|||
@Override
|
||||
public void onRemoveFromParent() {
|
||||
MediaController.getInstance().setTextureView(videoTextureView, null, null, false);
|
||||
super.onRemoveFromParent();
|
||||
}
|
||||
|
||||
private void hideFloatingDateView(boolean animated) {
|
||||
|
@ -2904,7 +2903,7 @@ public class ChannelAdminLogActivity extends BaseFragment implements Notificatio
|
|||
}
|
||||
|
||||
@Override
|
||||
public void didPressChannelAvatar(ChatMessageCell cell, TLRPC.Chat chat, int postId, float touchX, float touchY, boolean asForward) {
|
||||
public void didPressChannelAvatar(ChatMessageCell cell, TLRPC.Chat chat, int postId, float touchX, float touchY) {
|
||||
if (chat != null && chat != currentChat) {
|
||||
Bundle args = new Bundle();
|
||||
args.putLong("chat_id", chat.id);
|
||||
|
@ -2923,7 +2922,7 @@ public class ChannelAdminLogActivity extends BaseFragment implements Notificatio
|
|||
}
|
||||
|
||||
@Override
|
||||
public void didPressUserAvatar(ChatMessageCell cell, TLRPC.User user, float touchX, float touchY, boolean asForward) {
|
||||
public void didPressUserAvatar(ChatMessageCell cell, TLRPC.User user, float touchX, float touchY) {
|
||||
if (user != null && user.id != UserConfig.getInstance(currentAccount).getClientUserId()) {
|
||||
openProfile(user);
|
||||
}
|
||||
|
@ -3164,7 +3163,7 @@ public class ChannelAdminLogActivity extends BaseFragment implements Notificatio
|
|||
}
|
||||
}
|
||||
try {
|
||||
AndroidUtilities.openForView(message, getParentActivity(), null, false);
|
||||
AndroidUtilities.openForView(message, getParentActivity(), null);
|
||||
} catch (Exception e) {
|
||||
alertUserOpenError(message);
|
||||
}
|
||||
|
|
|
@ -254,9 +254,9 @@ public class ChannelBoostLayout extends FrameLayout {
|
|||
overviewCell.setData(0, Integer.toString(boostsStatus.level), null, LocaleController.getString("BoostsLevel2", R.string.BoostsLevel2));
|
||||
if (boostsStatus.premium_audience != null && boostsStatus.premium_audience.total != 0) {
|
||||
float percent = (((float) boostsStatus.premium_audience.part / (float) boostsStatus.premium_audience.total) * 100f);
|
||||
overviewCell.setData(1, "≈" + (int) boostsStatus.premium_audience.part, String.format(Locale.US, "%.1f", percent) + "%", LocaleController.getString(isChannel() ? R.string.PremiumSubscribers : R.string.PremiumMembers));
|
||||
overviewCell.setData(1, "~" + (int) boostsStatus.premium_audience.part, String.format(Locale.US, "%.1f", percent) + "%", LocaleController.getString(isChannel() ? R.string.PremiumSubscribers : R.string.PremiumMembers));
|
||||
} else {
|
||||
overviewCell.setData(1, "≈0", "0%", LocaleController.getString(isChannel() ? R.string.PremiumSubscribers : R.string.PremiumMembers));
|
||||
overviewCell.setData(1, "~0", "0%", LocaleController.getString(isChannel() ? R.string.PremiumSubscribers : R.string.PremiumMembers));
|
||||
}
|
||||
overviewCell.setData(2, String.valueOf(boostsStatus.boosts), null, LocaleController.getString("BoostsExisting", R.string.BoostsExisting));
|
||||
overviewCell.setData(3, String.valueOf(Math.max(0, boostsStatus.next_level_boosts - boostsStatus.boosts)), null, LocaleController.getString("BoostsToLevel", R.string.BoostsToLevel));
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -3,7 +3,6 @@ package org.telegram.ui.Charts;
|
|||
import android.content.Context;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Paint;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.core.graphics.ColorUtils;
|
||||
|
||||
|
@ -106,12 +105,12 @@ public class BarChartView extends BaseChartView<ChartData, BarViewData> {
|
|||
line.lineColor, line.blendColor, 0));
|
||||
}
|
||||
|
||||
paint.setAlpha((int) (0xFF * transitionAlpha));
|
||||
paint.setAlpha((int) (transitionAlpha * 255));
|
||||
canvas.drawLines(line.linesPath, 0, j, paint);
|
||||
|
||||
if (selected) {
|
||||
line.paint.setStrokeWidth(p);
|
||||
line.paint.setAlpha((int) (0xFF * transitionAlpha));
|
||||
line.paint.setAlpha((int) (transitionAlpha * 255));
|
||||
canvas.drawLine(selectedX, selectedY,
|
||||
selectedX, getMeasuredHeight() - chartBottom,
|
||||
line.paint
|
||||
|
@ -180,7 +179,7 @@ public class BarChartView extends BaseChartView<ChartData, BarViewData> {
|
|||
|
||||
@Override
|
||||
public BarViewData createLineViewData(ChartData.Line line) {
|
||||
return new BarViewData(line, resourcesProvider);
|
||||
return new BarViewData(line);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1126,7 +1126,7 @@ public abstract class BaseChartView<T extends ChartData, L extends LineViewData>
|
|||
}
|
||||
|
||||
public void moveLegend(float offset) {
|
||||
if (chartData == null || selectedIndex < 0 || selectedIndex >= chartData.x.length || !legendShowing) return;
|
||||
if (chartData == null || selectedIndex == -1 || !legendShowing) return;
|
||||
legendSignatureView.setData(selectedIndex, chartData.x[selectedIndex], (ArrayList<LineViewData>) lines, false, chartData.yTooltipFormatter, chartData.yRate);
|
||||
legendSignatureView.setVisibility(VISIBLE);
|
||||
legendSignatureView.measure(
|
||||
|
@ -1174,10 +1174,8 @@ public abstract class BaseChartView<T extends ChartData, L extends LineViewData>
|
|||
return minValue;
|
||||
}
|
||||
|
||||
public boolean setData(T chartData) {
|
||||
boolean updated = false;
|
||||
public void setData(T chartData) {
|
||||
if (this.chartData != chartData) {
|
||||
updated = true;
|
||||
invalidate();
|
||||
lines.clear();
|
||||
if (chartData != null && chartData.lines != null) {
|
||||
|
@ -1212,7 +1210,7 @@ public abstract class BaseChartView<T extends ChartData, L extends LineViewData>
|
|||
pickerMaxHeight = 0;
|
||||
pickerMinHeight = Integer.MAX_VALUE;
|
||||
initPickerMaxHeight();
|
||||
if (chartData.yTooltipFormatter == ChartData.FORMATTER_TON || chartData.yTooltipFormatter == ChartData.FORMATTER_XTR) {
|
||||
if (chartData.yTooltipFormatter == ChartData.FORMATTER_TON) {
|
||||
legendSignatureView.setSize(2 * lines.size());
|
||||
} else {
|
||||
legendSignatureView.setSize(lines.size());
|
||||
|
@ -1237,7 +1235,6 @@ public abstract class BaseChartView<T extends ChartData, L extends LineViewData>
|
|||
alphaAnimator.cancel();
|
||||
}
|
||||
}
|
||||
return updated;
|
||||
}
|
||||
|
||||
protected float getMinDistance() {
|
||||
|
|
|
@ -233,12 +233,6 @@ public class ChartPickerDelegate {
|
|||
return true;
|
||||
}
|
||||
|
||||
public void set(float start, float end) {
|
||||
pickerStart = start;
|
||||
pickerEnd = end;
|
||||
view.onPickerDataChanged();
|
||||
}
|
||||
|
||||
public boolean uncapture(MotionEvent event, int pointerIndex) {
|
||||
if (pointerIndex == 0) {
|
||||
if (tryMoveTo) {
|
||||
|
|
|
@ -3,7 +3,6 @@ package org.telegram.ui.Charts;
|
|||
import android.content.Context;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Paint;
|
||||
import android.util.Log;
|
||||
|
||||
import org.telegram.ui.Charts.data.ChartData;
|
||||
import org.telegram.ui.Charts.view_data.LineViewData;
|
||||
|
@ -112,7 +111,7 @@ public class LinearBarChartView extends BaseChartView<ChartData, LineViewData> {
|
|||
transitionAlpha = transitionParams.progress;
|
||||
}
|
||||
line.paint.setAlpha((int) (255 * line.alpha * transitionAlpha));
|
||||
if (endXIndex - startXIndex > 100) {
|
||||
if(endXIndex - startXIndex > 100){
|
||||
line.paint.setStrokeCap(Paint.Cap.SQUARE);
|
||||
} else {
|
||||
line.paint.setStrokeCap(Paint.Cap.ROUND);
|
||||
|
|
|
@ -312,14 +312,13 @@ public class PieChartView extends StackLinearChartView<PieChartViewData> {
|
|||
|
||||
|
||||
@Override
|
||||
public boolean setData(StackLinearChartData chartData) {
|
||||
boolean u = super.setData(chartData);
|
||||
public void setData(StackLinearChartData chartData) {
|
||||
super.setData(chartData);
|
||||
if (chartData != null) {
|
||||
values = new float[chartData.lines.size()];
|
||||
darawingValuesPercentage = new float[chartData.lines.size()];
|
||||
onPickerDataChanged(false, true, false);
|
||||
}
|
||||
return u;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -10,7 +10,6 @@ import org.json.JSONException;
|
|||
import org.json.JSONObject;
|
||||
import org.telegram.messenger.SegmentTree;
|
||||
import org.telegram.ui.ActionBar.ThemeColors;
|
||||
import org.telegram.ui.Stars.StarsController;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
|
@ -31,7 +30,6 @@ public class ChartData {
|
|||
public float oneDayPercentage = 0f;
|
||||
|
||||
public static final int FORMATTER_TON = 1;
|
||||
public static final int FORMATTER_XTR = 2;
|
||||
|
||||
public int xTickFormatter = 0;
|
||||
public int xTooltipFormatter = 0;
|
||||
|
@ -114,7 +112,6 @@ public class ChartData {
|
|||
public int getFormatter(String value) {
|
||||
if (TextUtils.isEmpty(value)) return 0;
|
||||
if (value.contains("TON")) return FORMATTER_TON;
|
||||
if (value.contains(StarsController.currency)) return FORMATTER_XTR;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -2,23 +2,17 @@ package org.telegram.ui.Charts.view_data;
|
|||
|
||||
import android.graphics.Paint;
|
||||
|
||||
import androidx.core.graphics.ColorUtils;
|
||||
|
||||
import org.telegram.ui.ActionBar.Theme;
|
||||
import org.telegram.ui.Charts.data.ChartData;
|
||||
|
||||
public class BarViewData extends LineViewData {
|
||||
|
||||
|
||||
private Theme.ResourcesProvider resourcesProvider;
|
||||
|
||||
public final Paint unselectedPaint = new Paint();
|
||||
|
||||
public int blendColor = 0;
|
||||
|
||||
public BarViewData(ChartData.Line line, Theme.ResourcesProvider resourcesProvider) {
|
||||
public BarViewData(ChartData.Line line) {
|
||||
super(line, false);
|
||||
this.resourcesProvider = resourcesProvider;
|
||||
paint.setStyle(Paint.Style.STROKE);
|
||||
unselectedPaint.setStyle(Paint.Style.STROKE);
|
||||
paint.setAntiAlias(false);
|
||||
|
@ -26,6 +20,5 @@ public class BarViewData extends LineViewData {
|
|||
|
||||
public void updateColors() {
|
||||
super.updateColors();
|
||||
blendColor = ColorUtils.blendARGB(Theme.getColor(Theme.key_windowBackgroundWhite, resourcesProvider), lineColor,0.3f);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -111,9 +111,9 @@ public class ChartHeaderView extends FrameLayout {
|
|||
}
|
||||
final String newText;
|
||||
if (end - start >= 86400000L) {
|
||||
newText = LocaleController.getInstance().getFormatterYear().format(new Date(start)) + " — " + LocaleController.getInstance().getFormatterYear().format(new Date(end));
|
||||
newText = LocaleController.getInstance().formatterYear.format(new Date(start)) + " — " + LocaleController.getInstance().formatterYear.format(new Date(end));
|
||||
} else {
|
||||
newText = LocaleController.getInstance().getFormatterYear().format(new Date(start));
|
||||
newText = LocaleController.getInstance().formatterYear.format(new Date(start));
|
||||
}
|
||||
|
||||
dates.setText(newText);
|
||||
|
|
|
@ -9,12 +9,10 @@ import android.text.TextPaint;
|
|||
|
||||
import org.telegram.messenger.AndroidUtilities;
|
||||
import org.telegram.messenger.BillingController;
|
||||
import org.telegram.messenger.LocaleController;
|
||||
import org.telegram.ui.ActionBar.Theme;
|
||||
import org.telegram.ui.ChannelMonetizationLayout;
|
||||
import org.telegram.ui.Charts.data.ChartData;
|
||||
import org.telegram.ui.Components.AnimatedEmojiSpan;
|
||||
import org.telegram.ui.Stars.StarsIntroActivity;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
import java.text.DecimalFormatSymbols;
|
||||
|
@ -73,7 +71,7 @@ public class ChartHorizontalLinesData {
|
|||
if (k > 0) {
|
||||
float v2 = (values[i] / k);
|
||||
if (skipFloatValues) {
|
||||
if (v2 - ((long) v2) < 0.01f || formatter == ChartData.FORMATTER_TON || formatter == ChartData.FORMATTER_XTR) {
|
||||
if (v2 - ((long) v2) < 0.01f || formatter == ChartData.FORMATTER_TON) {
|
||||
valuesStr2[i] = format(1, secondTextPaint, (long) v2, formatter);
|
||||
} else {
|
||||
valuesStr2[i] = "";
|
||||
|
@ -121,7 +119,7 @@ public class ChartHorizontalLinesData {
|
|||
if (k > 0) {
|
||||
float v = (values[i] / k);
|
||||
if (skipFloatValues) {
|
||||
if (v - ((long) v) < 0.01f || formatter == ChartData.FORMATTER_TON || formatter == ChartData.FORMATTER_XTR) {
|
||||
if (v - ((long) v) < 0.01f || formatter == ChartData.FORMATTER_TON) {
|
||||
valuesStr2[i] = format(1, secondTextPaint, (long) v, formatter);
|
||||
} else {
|
||||
valuesStr2[i] = "";
|
||||
|
@ -138,7 +136,7 @@ public class ChartHorizontalLinesData {
|
|||
public CharSequence format(int a, TextPaint paint, long v, int formatter) {
|
||||
if (formatter == ChartData.FORMATTER_TON) {
|
||||
if (a == 1) {
|
||||
return "≈" + BillingController.getInstance().formatCurrency(v, "USD");
|
||||
return "~" + BillingController.getInstance().formatCurrency(v, "USD");
|
||||
}
|
||||
if (formatterTON == null) {
|
||||
DecimalFormatSymbols symbols = new DecimalFormatSymbols(Locale.US);
|
||||
|
@ -150,11 +148,6 @@ public class ChartHorizontalLinesData {
|
|||
}
|
||||
formatterTON.setMaximumFractionDigits(v > 1_000_000_000 ? 2 : 6);
|
||||
return ChannelMonetizationLayout.replaceTON("TON " + formatterTON.format(v / 1_000_000_000.0), paint, .8f, -dp(.66f), false);
|
||||
} else if (formatter == ChartData.FORMATTER_XTR) {
|
||||
if (a == 1) {
|
||||
return "≈" + BillingController.getInstance().formatCurrency(v, "USD");
|
||||
}
|
||||
return StarsIntroActivity.replaceStarsWithPlain("XTR " + LocaleController.formatNumber(v, ' '), .65f);
|
||||
}
|
||||
return AndroidUtilities.formatWholeNumber((int) v, 0);
|
||||
}
|
||||
|
|
|
@ -28,7 +28,6 @@ import org.telegram.ui.Components.AnimatedEmojiSpan;
|
|||
import org.telegram.ui.Components.CombinedDrawable;
|
||||
import org.telegram.ui.Components.LayoutHelper;
|
||||
import org.telegram.ui.Components.RadialProgressView;
|
||||
import org.telegram.ui.Stars.StarsIntroActivity;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
import java.text.DecimalFormatSymbols;
|
||||
|
@ -178,7 +177,7 @@ public class LegendSignatureView extends FrameLayout {
|
|||
for (int i = 0; i < n; i++) {
|
||||
Holder h = holders[i];
|
||||
int formatterIndex = i % 2;
|
||||
LineViewData l = lines.get(formatter == ChartData.FORMATTER_TON || formatter == ChartData.FORMATTER_XTR ? i / 2 : i);
|
||||
LineViewData l = lines.get(formatter == ChartData.FORMATTER_TON ? i / 2 : i);
|
||||
|
||||
if (!l.enabled) {
|
||||
h.root.setVisibility(View.GONE);
|
||||
|
@ -189,9 +188,7 @@ public class LegendSignatureView extends FrameLayout {
|
|||
h.root.setVisibility(View.VISIBLE);
|
||||
h.value.setText(formatWholeNumber(l.line.y[index], formatter, formatterIndex, h.value, k));
|
||||
if (formatter == ChartData.FORMATTER_TON) {
|
||||
h.signature.setText(LocaleController.formatString(formatterIndex == 0 ? R.string.ChartInTON : R.string.ChartInUSD, l.line.name));
|
||||
} else if (formatter == ChartData.FORMATTER_XTR) {
|
||||
h.signature.setText(StarsIntroActivity.replaceStarsWithPlain(LocaleController.formatString(formatterIndex == 0 ? R.string.ChartInXTR : R.string.ChartInUSD, l.line.name), .7f));
|
||||
h.signature.setText(LocaleController.formatString(formatterIndex == 0 ? R.string.MonetizationChartInTON : R.string.MonetizationChartInUSD, l.line.name));
|
||||
} else {
|
||||
h.signature.setText(l.line.name);
|
||||
}
|
||||
|
@ -250,13 +247,7 @@ public class LegendSignatureView extends FrameLayout {
|
|||
formatterTON.setMaximumFractionDigits(v > 1_000_000_000 ? 2 : 6);
|
||||
return ChannelMonetizationLayout.replaceTON("TON " + formatterTON.format(v / 1_000_000_000.), textView.getPaint(), .82f, false);
|
||||
} else {
|
||||
return "≈" + BillingController.getInstance().formatCurrency((long) (v / k), "USD");
|
||||
}
|
||||
} else if (formatter == ChartData.FORMATTER_XTR) {
|
||||
if (formatterIndex == 0) {
|
||||
return StarsIntroActivity.replaceStarsWithPlain("XTR " + LocaleController.formatNumber(v, ' '), .7f);
|
||||
} else {
|
||||
return "≈" + BillingController.getInstance().formatCurrency((long) (v / k), "USD");
|
||||
return "~" + BillingController.getInstance().formatCurrency((long) (v / k), "USD");
|
||||
}
|
||||
}
|
||||
float num_ = v;
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -8,7 +8,6 @@
|
|||
|
||||
package org.telegram.ui;
|
||||
|
||||
import static org.telegram.messenger.AndroidUtilities.dp;
|
||||
import static org.telegram.messenger.LocaleController.getString;
|
||||
|
||||
import android.animation.Animator;
|
||||
|
@ -30,7 +29,6 @@ import android.text.Editable;
|
|||
import android.text.InputFilter;
|
||||
import android.text.InputType;
|
||||
import android.text.SpannableString;
|
||||
import android.text.SpannableStringBuilder;
|
||||
import android.text.Spanned;
|
||||
import android.text.TextPaint;
|
||||
import android.text.TextUtils;
|
||||
|
@ -66,7 +64,6 @@ import org.telegram.tgnet.TLRPC;
|
|||
import org.telegram.tgnet.tl.TL_stories;
|
||||
import org.telegram.ui.ActionBar.ActionBar;
|
||||
import org.telegram.ui.ActionBar.ActionBarMenu;
|
||||
import org.telegram.ui.ActionBar.ActionBarPopupWindow;
|
||||
import org.telegram.ui.ActionBar.AlertDialog;
|
||||
import org.telegram.ui.ActionBar.BaseFragment;
|
||||
import org.telegram.ui.ActionBar.BottomSheet;
|
||||
|
@ -91,21 +88,16 @@ import org.telegram.ui.Components.EditTextBoldCursor;
|
|||
import org.telegram.ui.Components.EditTextEmoji;
|
||||
import org.telegram.ui.Components.ImageUpdater;
|
||||
import org.telegram.ui.Components.LayoutHelper;
|
||||
import org.telegram.ui.Components.LoadingSpan;
|
||||
import org.telegram.ui.Components.RLottieDrawable;
|
||||
import org.telegram.ui.Components.RadialProgressView;
|
||||
import org.telegram.ui.Components.Reactions.ChatCustomReactionsEditActivity;
|
||||
import org.telegram.ui.Components.Reactions.ReactionsUtils;
|
||||
import org.telegram.ui.Components.SizeNotifierFrameLayout;
|
||||
import org.telegram.ui.Components.UndoView;
|
||||
import org.telegram.ui.Stars.BotStarsActivity;
|
||||
import org.telegram.ui.Stars.BotStarsController;
|
||||
import org.telegram.ui.Stars.StarsController;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
|
||||
public class ChatEditActivity extends BaseFragment implements ImageUpdater.ImageUpdaterDelegate, NotificationCenter.NotificationCenterDelegate {
|
||||
|
@ -161,7 +153,6 @@ public class ChatEditActivity extends BaseFragment implements ImageUpdater.Image
|
|||
private ShadowSectionCell deleteInfoCell;
|
||||
|
||||
private TextCell publicLinkCell;
|
||||
private TextCell balanceCell;
|
||||
private TextCell editIntroCell;
|
||||
private TextCell editCommandsCell;
|
||||
private TextCell changeBotSettingsCell;
|
||||
|
@ -264,9 +255,9 @@ public class ChatEditActivity extends BaseFragment implements ImageUpdater.Image
|
|||
hasUploadedPhoto = true;
|
||||
|
||||
if (cameraDrawable == null) {
|
||||
cameraDrawable = new RLottieDrawable(R.raw.camera_outline, "" + R.raw.camera_outline, dp(50), dp(50), false, null);
|
||||
cameraDrawable = new RLottieDrawable(R.raw.camera_outline, "" + R.raw.camera_outline, AndroidUtilities.dp(50), AndroidUtilities.dp(50), false, null);
|
||||
}
|
||||
setAvatarCell.imageView.setTranslationX(-dp(8));
|
||||
setAvatarCell.imageView.setTranslationX(-AndroidUtilities.dp(8));
|
||||
setAvatarCell.imageView.setAnimation(cameraDrawable);
|
||||
}));
|
||||
|
||||
|
@ -353,9 +344,6 @@ public class ChatEditActivity extends BaseFragment implements ImageUpdater.Image
|
|||
forum = false;
|
||||
canForum = false;
|
||||
NotificationCenter.getInstance(currentAccount).addObserver(this, NotificationCenter.userInfoDidLoad);
|
||||
if (currentUser.bot) {
|
||||
NotificationCenter.getInstance(currentAccount).addObserver(this, NotificationCenter.botStarsUpdated);
|
||||
}
|
||||
}
|
||||
imageUpdater.parentFragment = this;
|
||||
imageUpdater.setDelegate(this);
|
||||
|
@ -393,9 +381,6 @@ public class ChatEditActivity extends BaseFragment implements ImageUpdater.Image
|
|||
NotificationCenter.getInstance(currentAccount).removeObserver(this, NotificationCenter.chatAvailableReactionsUpdated);
|
||||
} else {
|
||||
NotificationCenter.getInstance(currentAccount).removeObserver(this, NotificationCenter.userInfoDidLoad);
|
||||
if (currentUser.bot) {
|
||||
NotificationCenter.getInstance(currentAccount).removeObserver(this, NotificationCenter.botStarsUpdated);
|
||||
}
|
||||
}
|
||||
NotificationCenter.getInstance(currentAccount).removeObserver(this, NotificationCenter.updateInterfaces);
|
||||
if (nameTextView != null) {
|
||||
|
@ -500,7 +485,7 @@ public class ChatEditActivity extends BaseFragment implements ImageUpdater.Image
|
|||
measureChildWithMargins(actionBar, widthMeasureSpec, 0, heightMeasureSpec, 0);
|
||||
|
||||
int keyboardSize = measureKeyboardHeight();
|
||||
if (keyboardSize > dp(20)) {
|
||||
if (keyboardSize > AndroidUtilities.dp(20)) {
|
||||
ignoreLayout = true;
|
||||
nameTextView.hideEmojiView();
|
||||
ignoreLayout = false;
|
||||
|
@ -515,7 +500,7 @@ public class ChatEditActivity extends BaseFragment implements ImageUpdater.Image
|
|||
if (nameTextView != null && nameTextView.isPopupView(child)) {
|
||||
if (AndroidUtilities.isInMultiwindow || AndroidUtilities.isTablet()) {
|
||||
if (AndroidUtilities.isTablet()) {
|
||||
child.measure(MeasureSpec.makeMeasureSpec(widthSize, MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(Math.min(dp(AndroidUtilities.isTablet() ? 200 : 320), heightSize - AndroidUtilities.statusBarHeight + getPaddingTop()), MeasureSpec.EXACTLY));
|
||||
child.measure(MeasureSpec.makeMeasureSpec(widthSize, MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(Math.min(AndroidUtilities.dp(AndroidUtilities.isTablet() ? 200 : 320), heightSize - AndroidUtilities.statusBarHeight + getPaddingTop()), MeasureSpec.EXACTLY));
|
||||
} else {
|
||||
child.measure(MeasureSpec.makeMeasureSpec(widthSize, MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(heightSize - AndroidUtilities.statusBarHeight + getPaddingTop(), MeasureSpec.EXACTLY));
|
||||
}
|
||||
|
@ -533,7 +518,7 @@ public class ChatEditActivity extends BaseFragment implements ImageUpdater.Image
|
|||
final int count = getChildCount();
|
||||
|
||||
int keyboardSize = measureKeyboardHeight();
|
||||
int paddingBottom = keyboardSize <= dp(20) && !AndroidUtilities.isInMultiwindow && !AndroidUtilities.isTablet() ? nameTextView.getEmojiPadding() : 0;
|
||||
int paddingBottom = keyboardSize <= AndroidUtilities.dp(20) && !AndroidUtilities.isInMultiwindow && !AndroidUtilities.isTablet() ? nameTextView.getEmojiPadding() : 0;
|
||||
setBottomClip(paddingBottom);
|
||||
|
||||
for (int i = 0; i < count; i++) {
|
||||
|
@ -644,7 +629,7 @@ public class ChatEditActivity extends BaseFragment implements ImageUpdater.Image
|
|||
super.invalidate(l, t, r, b);
|
||||
}
|
||||
};
|
||||
avatarImage.setRoundRadius(forum ? dp(16) : dp(32));
|
||||
avatarImage.setRoundRadius(forum ? AndroidUtilities.dp(16) : AndroidUtilities.dp(32));
|
||||
|
||||
if (currentUser != null || ChatObject.canChangeChatInfo(currentChat)) {
|
||||
frameLayout.addView(avatarImage, LayoutHelper.createFrame(64, 64, Gravity.TOP | (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT), LocaleController.isRTL ? 0 : 16, 12, LocaleController.isRTL ? 16 : 0, 8));
|
||||
|
@ -664,7 +649,7 @@ public class ChatEditActivity extends BaseFragment implements ImageUpdater.Image
|
|||
frameLayout.addView(avatarOverlay, LayoutHelper.createFrame(64, 64, Gravity.TOP | (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT), LocaleController.isRTL ? 0 : 16, 12, LocaleController.isRTL ? 16 : 0, 8));
|
||||
|
||||
avatarProgressView = new RadialProgressView(context);
|
||||
avatarProgressView.setSize(dp(30));
|
||||
avatarProgressView.setSize(AndroidUtilities.dp(30));
|
||||
avatarProgressView.setProgressColor(0xffffffff);
|
||||
avatarProgressView.setNoProgress(false);
|
||||
frameLayout.addView(avatarProgressView, LayoutHelper.createFrame(64, 64, Gravity.TOP | (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT), LocaleController.isRTL ? 0 : 16, 12, LocaleController.isRTL ? 16 : 0, 8));
|
||||
|
@ -749,7 +734,7 @@ public class ChatEditActivity extends BaseFragment implements ImageUpdater.Image
|
|||
setAvatarCell = new TextCell(context) {
|
||||
@Override
|
||||
protected void onDraw(Canvas canvas) {
|
||||
canvas.drawLine(LocaleController.isRTL ? 0 : dp(20), getMeasuredHeight() - 1, getMeasuredWidth() - (LocaleController.isRTL ? dp(20) : 0), getMeasuredHeight() - 1, Theme.dividerPaint);
|
||||
canvas.drawLine(LocaleController.isRTL ? 0 : AndroidUtilities.dp(20), getMeasuredHeight() - 1, getMeasuredWidth() - (LocaleController.isRTL ? AndroidUtilities.dp(20) : 0), getMeasuredHeight() - 1, Theme.dividerPaint);
|
||||
}
|
||||
};
|
||||
setAvatarCell.setBackgroundDrawable(Theme.getSelectorDrawable(false));
|
||||
|
@ -775,9 +760,9 @@ public class ChatEditActivity extends BaseFragment implements ImageUpdater.Image
|
|||
hasUploadedPhoto = true;
|
||||
|
||||
if (cameraDrawable == null) {
|
||||
cameraDrawable = new RLottieDrawable(R.raw.camera_outline, "" + R.raw.camera_outline, dp(50), dp(50), false, null);
|
||||
cameraDrawable = new RLottieDrawable(R.raw.camera_outline, "" + R.raw.camera_outline, AndroidUtilities.dp(50), AndroidUtilities.dp(50), false, null);
|
||||
}
|
||||
setAvatarCell.imageView.setTranslationX(-dp(8));
|
||||
setAvatarCell.imageView.setTranslationX(-AndroidUtilities.dp(8));
|
||||
setAvatarCell.imageView.setAnimation(cameraDrawable);
|
||||
}));
|
||||
}
|
||||
|
@ -805,7 +790,7 @@ public class ChatEditActivity extends BaseFragment implements ImageUpdater.Image
|
|||
descriptionTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16);
|
||||
descriptionTextView.setHintTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteHintText));
|
||||
descriptionTextView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
|
||||
descriptionTextView.setPadding(0, 0, 0, dp(6));
|
||||
descriptionTextView.setPadding(0, 0, 0, AndroidUtilities.dp(6));
|
||||
descriptionTextView.setBackgroundDrawable(null);
|
||||
descriptionTextView.setGravity(LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT);
|
||||
descriptionTextView.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_CAP_SENTENCES | InputType.TYPE_TEXT_FLAG_MULTI_LINE | InputType.TYPE_TEXT_FLAG_AUTO_CORRECT);
|
||||
|
@ -817,7 +802,7 @@ public class ChatEditActivity extends BaseFragment implements ImageUpdater.Image
|
|||
descriptionTextView.setFilters(inputFilters);
|
||||
descriptionTextView.setHint(getString("DescriptionOptionalPlaceholder", R.string.DescriptionOptionalPlaceholder));
|
||||
descriptionTextView.setCursorColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
|
||||
descriptionTextView.setCursorSize(dp(20));
|
||||
descriptionTextView.setCursorSize(AndroidUtilities.dp(20));
|
||||
descriptionTextView.setCursorWidth(1.5f);
|
||||
if (descriptionTextView.isEnabled()) {
|
||||
settingsContainer.addView(descriptionTextView, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, 23, 15, 23, 9));
|
||||
|
@ -1010,7 +995,7 @@ public class ChatEditActivity extends BaseFragment implements ImageUpdater.Image
|
|||
return;
|
||||
}
|
||||
forum = !forum;
|
||||
avatarImage.animateToRoundRadius(forum ? dp(16) : dp(32));
|
||||
avatarImage.animateToRoundRadius(forum ? AndroidUtilities.dp(16) : AndroidUtilities.dp(32));
|
||||
((TextCell) v).setChecked(forum);
|
||||
updateFields(false, true);
|
||||
});
|
||||
|
@ -1021,7 +1006,7 @@ public class ChatEditActivity extends BaseFragment implements ImageUpdater.Image
|
|||
|
||||
ActionBarMenu menu = actionBar.createMenu();
|
||||
if (currentUser != null || ChatObject.canChangeChatInfo(currentChat) || signCell != null || historyCell != null) {
|
||||
doneButton = menu.addItemWithWidth(done_button, R.drawable.ic_ab_done, dp(56));
|
||||
doneButton = menu.addItemWithWidth(done_button, R.drawable.ic_ab_done, AndroidUtilities.dp(56));
|
||||
doneButton.setContentDescription(getString("Done", R.string.Done));
|
||||
}
|
||||
|
||||
|
@ -1165,32 +1150,8 @@ public class ChatEditActivity extends BaseFragment implements ImageUpdater.Image
|
|||
presentFragment(new ChangeUsernameActivity(args));
|
||||
});
|
||||
|
||||
if (currentUser.bot && currentUser.bot_can_edit) {
|
||||
balanceCell = new TextCell(context);
|
||||
balanceCell.setBackground(Theme.getSelectorDrawable(false));
|
||||
balanceCell.setPrioritizeTitleOverValue(true);
|
||||
infoContainer.addView(balanceCell, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT));
|
||||
BotStarsController c = BotStarsController.getInstance(currentAccount);
|
||||
balanceCell.setOnClickListener(v -> {
|
||||
if (!c.isBalanceAvailable(userId))
|
||||
return;
|
||||
presentFragment(new BotStarsActivity(userId));
|
||||
});
|
||||
if (!c.isBalanceAvailable(userId)) {
|
||||
SpannableStringBuilder loadingStr = new SpannableStringBuilder("x");
|
||||
loadingStr.setSpan(new LoadingSpan(balanceCell.valueTextView, dp(30)), 0, loadingStr.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
balanceCell.setTextAndValueAndIcon(getString(R.string.BotBalance), loadingStr, R.drawable.menu_premium_main, false);
|
||||
} else {
|
||||
balanceCell.setTextAndValueAndIcon(getString(R.string.BotBalance), LocaleController.formatNumber(c.getBalance(userId), ' '), R.drawable.menu_premium_main, false);
|
||||
}
|
||||
balanceCell.setVisibility(c.hasStars(userId) ? View.VISIBLE : View.GONE);
|
||||
}
|
||||
updatePublicLinksCount();
|
||||
|
||||
ActionBarPopupWindow.GapView gap = new ActionBarPopupWindow.GapView(context, getResourceProvider(), Theme.key_windowBackgroundGray);
|
||||
gap.setTag(R.id.fit_width_tag, 1);
|
||||
infoContainer.addView(gap, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, 8));
|
||||
|
||||
editIntroCell = new TextCell(context);
|
||||
editIntroCell.setBackground(Theme.getSelectorDrawable(false));
|
||||
editIntroCell.setTextAndIcon(getString(R.string.BotEditIntro), R.drawable.msg_log, true);
|
||||
|
@ -1286,7 +1247,7 @@ public class ChatEditActivity extends BaseFragment implements ImageUpdater.Image
|
|||
undoView = new UndoView(context);
|
||||
sizeNotifierFrameLayout.addView(undoView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.BOTTOM | Gravity.LEFT, 8, 0, 8, 8));
|
||||
|
||||
nameTextView.setText(Emoji.replaceEmoji(currentUser != null ? ContactsController.formatName(currentUser) : currentChat.title, nameTextView.getEditText().getPaint().getFontMetricsInt(), dp(16), true));
|
||||
nameTextView.setText(Emoji.replaceEmoji(currentUser != null ? ContactsController.formatName(currentUser) : currentChat.title, nameTextView.getEditText().getPaint().getFontMetricsInt(), AndroidUtilities.dp(16), true));
|
||||
nameTextView.setSelection(nameTextView.length());
|
||||
if (info != null) {
|
||||
descriptionTextView.setText(info.about);
|
||||
|
@ -1311,9 +1272,9 @@ public class ChatEditActivity extends BaseFragment implements ImageUpdater.Image
|
|||
}
|
||||
}
|
||||
|
||||
publicLinkCell.setTextAndValueAndIcon(getString(R.string.BotPublicLinks), LocaleController.formatString(R.string.BotPublicLinksCount, usernamesActive, currentUser.usernames.size()), R.drawable.msg_link2, balanceCell != null && balanceCell.getVisibility() == View.VISIBLE);
|
||||
publicLinkCell.setTextAndValueAndIcon(getString(R.string.BotPublicLinks), LocaleController.formatString(R.string.BotPublicLinksCount, usernamesActive, currentUser.usernames.size()), R.drawable.msg_link2, true);
|
||||
} else {
|
||||
publicLinkCell.setTextAndValueAndIcon(getString(R.string.BotPublicLink), "t.me/" + currentUser.username, R.drawable.msg_link2, balanceCell != null && balanceCell.getVisibility() == View.VISIBLE);
|
||||
publicLinkCell.setTextAndValueAndIcon(getString(R.string.BotPublicLink), "t.me/" + currentUser.username, R.drawable.msg_link2, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1362,9 +1323,9 @@ public class ChatEditActivity extends BaseFragment implements ImageUpdater.Image
|
|||
setAvatarCell.setTextAndIcon(getString("ChatSetPhotoOrVideo", R.string.ChatSetPhotoOrVideo), R.drawable.msg_addphoto, true);
|
||||
}
|
||||
if (cameraDrawable == null) {
|
||||
cameraDrawable = new RLottieDrawable(R.raw.camera_outline, "" + R.raw.camera_outline, dp(50), dp(50), false, null);
|
||||
cameraDrawable = new RLottieDrawable(R.raw.camera_outline, "" + R.raw.camera_outline, AndroidUtilities.dp(50), AndroidUtilities.dp(50), false, null);
|
||||
}
|
||||
setAvatarCell.imageView.setTranslationX(-dp(8));
|
||||
setAvatarCell.imageView.setTranslationX(-AndroidUtilities.dp(8));
|
||||
setAvatarCell.imageView.setAnimation(cameraDrawable);
|
||||
}
|
||||
if (PhotoViewer.hasInstance() && PhotoViewer.getInstance().isVisible()) {
|
||||
|
@ -1417,17 +1378,6 @@ public class ChatEditActivity extends BaseFragment implements ImageUpdater.Image
|
|||
}
|
||||
updateReactionsCell(true);
|
||||
}
|
||||
} else if (id == NotificationCenter.botStarsUpdated) {
|
||||
if ((long) args[0] == userId) {
|
||||
if (balanceCell != null) {
|
||||
BotStarsController c = BotStarsController.getInstance(currentAccount);
|
||||
balanceCell.setVisibility(c.hasStars(userId) ? View.VISIBLE : View.GONE);
|
||||
balanceCell.setValue(LocaleController.formatNumber(c.getBalance(userId), ' '), true);
|
||||
if (publicLinkCell != null) {
|
||||
publicLinkCell.setNeedDivider(c.hasStars(userId));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1505,9 +1455,9 @@ public class ChatEditActivity extends BaseFragment implements ImageUpdater.Image
|
|||
avatarImage.setImage(ImageLocation.getForLocal(avatar), "50_50", avatarDrawable, currentUser != null ? currentUser : currentChat);
|
||||
setAvatarCell.setTextAndIcon(getString("ChatSetNewPhoto", R.string.ChatSetNewPhoto), R.drawable.msg_addphoto, true);
|
||||
if (cameraDrawable == null) {
|
||||
cameraDrawable = new RLottieDrawable(R.raw.camera_outline, "" + R.raw.camera_outline, dp(50), dp(50), false, null);
|
||||
cameraDrawable = new RLottieDrawable(R.raw.camera_outline, "" + R.raw.camera_outline, AndroidUtilities.dp(50), AndroidUtilities.dp(50), false, null);
|
||||
}
|
||||
setAvatarCell.imageView.setTranslationX(-dp(8));
|
||||
setAvatarCell.imageView.setTranslationX(-AndroidUtilities.dp(8));
|
||||
setAvatarCell.imageView.setAnimation(cameraDrawable);
|
||||
showAvatarProgress(true, false);
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue