mirror of
https://github.com/DrKLO/Telegram.git
synced 2024-12-22 14:35:03 +01:00
Update to 6.1.1 (1945)
This commit is contained in:
parent
73e5ba43d6
commit
dbf81a34af
25 changed files with 1081 additions and 604 deletions
|
@ -19,14 +19,14 @@ configurations.all {
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation 'androidx.core:core:1.1.0-beta01'
|
implementation 'androidx.core:core:1.1.0-beta01'
|
||||||
implementation 'androidx.palette:palette:1.0.0'
|
implementation 'androidx.palette:palette:1.0.0'
|
||||||
implementation 'androidx.exifinterface:exifinterface:1.1.0'
|
implementation 'androidx.exifinterface:exifinterface:1.2.0'
|
||||||
implementation 'androidx.dynamicanimation:dynamicanimation:1.0.0'
|
implementation 'androidx.dynamicanimation:dynamicanimation:1.0.0'
|
||||||
implementation 'com.android.support:multidex:1.0.3'
|
implementation 'com.android.support:multidex:1.0.3'
|
||||||
|
|
||||||
compileOnly 'org.checkerframework:checker-qual:2.5.2'
|
compileOnly 'org.checkerframework:checker-qual:2.5.2'
|
||||||
compileOnly 'org.checkerframework:checker-compat-qual:2.5.0'
|
compileOnly 'org.checkerframework:checker-compat-qual:2.5.0'
|
||||||
implementation 'com.google.firebase:firebase-messaging:20.1.4'
|
implementation 'com.google.firebase:firebase-messaging:20.1.6'
|
||||||
implementation 'com.google.firebase:firebase-config:19.1.3'
|
implementation 'com.google.firebase:firebase-config:19.1.4'
|
||||||
implementation 'com.google.android.gms:play-services-maps:17.0.0'
|
implementation 'com.google.android.gms:play-services-maps:17.0.0'
|
||||||
implementation 'com.google.android.gms:play-services-auth:17.0.0'
|
implementation 'com.google.android.gms:play-services-auth:17.0.0'
|
||||||
implementation 'com.google.android.gms:play-services-vision:16.2.0'
|
implementation 'com.google.android.gms:play-services-vision:16.2.0'
|
||||||
|
@ -286,7 +286,7 @@ android {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
defaultConfig.versionCode = 1941
|
defaultConfig.versionCode = 1945
|
||||||
|
|
||||||
def tgVoipDexFileName = "libtgvoip.dex"
|
def tgVoipDexFileName = "libtgvoip.dex"
|
||||||
def tgVoipDexClasses = ["AudioRecordJNI", "AudioTrackJNI", "NativeTgVoipDelegate", "NativeTgVoipInstance", "TgVoipNativeLoader", "Resampler", "VLog"]
|
def tgVoipDexClasses = ["AudioRecordJNI", "AudioTrackJNI", "NativeTgVoipDelegate", "NativeTgVoipInstance", "TgVoipNativeLoader", "Resampler", "VLog"]
|
||||||
|
@ -381,7 +381,7 @@ android {
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
minSdkVersion 16
|
minSdkVersion 16
|
||||||
targetSdkVersion 28
|
targetSdkVersion 28
|
||||||
versionName "6.1.0"
|
versionName "6.1.1"
|
||||||
|
|
||||||
vectorDrawables.generatedDensities = ['mdpi', 'hdpi', 'xhdpi', 'xxhdpi']
|
vectorDrawables.generatedDensities = ['mdpi', 'hdpi', 'xhdpi', 'xxhdpi']
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@ public class BuildVars {
|
||||||
public static boolean USE_CLOUD_STRINGS = true;
|
public static boolean USE_CLOUD_STRINGS = true;
|
||||||
public static boolean CHECK_UPDATES = true;
|
public static boolean CHECK_UPDATES = true;
|
||||||
public static boolean TON_WALLET_STANDALONE = false;
|
public static boolean TON_WALLET_STANDALONE = false;
|
||||||
public static int BUILD_VERSION = 1941;
|
public static int BUILD_VERSION = 1945;
|
||||||
public static String BUILD_VERSION_STRING = "6.1.0";
|
public static String BUILD_VERSION_STRING = "6.1.0";
|
||||||
public static int APP_ID = 4;
|
public static int APP_ID = 4;
|
||||||
public static String APP_HASH = "014b35b6184100b085b0d0572f9b5103";
|
public static String APP_HASH = "014b35b6184100b085b0d0572f9b5103";
|
||||||
|
|
|
@ -957,6 +957,17 @@ public class LocaleController {
|
||||||
return getInstance().getStringInternal(key, res);
|
return getInstance().getStringInternal(key, res);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String getString(String key) {
|
||||||
|
if (TextUtils.isEmpty(key)) {
|
||||||
|
return "LOC_ERR:" + key;
|
||||||
|
}
|
||||||
|
int resourceId = ApplicationLoader.applicationContext.getResources().getIdentifier(key, "string", ApplicationLoader.applicationContext.getPackageName());
|
||||||
|
if (resourceId != 0) {
|
||||||
|
return getString(key, resourceId);
|
||||||
|
}
|
||||||
|
return getServerString(key);
|
||||||
|
}
|
||||||
|
|
||||||
public static String getPluralString(String key, int plural) {
|
public static String getPluralString(String key, int plural) {
|
||||||
if (key == null || key.length() == 0 || getInstance().currentPluralRules == null) {
|
if (key == null || key.length() == 0 || getInstance().currentPluralRules == null) {
|
||||||
return "LOC_ERR:" + key;
|
return "LOC_ERR:" + key;
|
||||||
|
|
|
@ -9,7 +9,6 @@
|
||||||
package org.telegram.messenger;
|
package org.telegram.messenger;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.Dialog;
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
|
@ -54,7 +53,6 @@ import org.telegram.ui.Components.Bulletin;
|
||||||
import org.telegram.ui.Components.StickerSetBulletinLayout;
|
import org.telegram.ui.Components.StickerSetBulletinLayout;
|
||||||
import org.telegram.ui.Components.StickersArchiveAlert;
|
import org.telegram.ui.Components.StickersArchiveAlert;
|
||||||
import org.telegram.ui.Components.TextStyleSpan;
|
import org.telegram.ui.Components.TextStyleSpan;
|
||||||
import org.telegram.ui.Components.TrendingStickersAlert;
|
|
||||||
import org.telegram.ui.Components.URLSpanReplacement;
|
import org.telegram.ui.Components.URLSpanReplacement;
|
||||||
import org.telegram.ui.Components.URLSpanUserMention;
|
import org.telegram.ui.Components.URLSpanUserMention;
|
||||||
import org.telegram.ui.LaunchActivity;
|
import org.telegram.ui.LaunchActivity;
|
||||||
|
|
|
@ -195,13 +195,16 @@ public class MessagesController extends BaseController implements NotificationCe
|
||||||
private int loadingNotificationSettings;
|
private int loadingNotificationSettings;
|
||||||
private boolean loadingNotificationSignUpSettings;
|
private boolean loadingNotificationSignUpSettings;
|
||||||
|
|
||||||
private int nextProxyInfoCheckTime;
|
private int nextPromoInfoCheckTime;
|
||||||
private boolean checkingProxyInfo;
|
private boolean checkingPromoInfo;
|
||||||
private int checkingProxyInfoRequestId;
|
private int checkingPromoInfoRequestId;
|
||||||
private int lastCheckProxyId;
|
private int lastCheckPromoId;
|
||||||
private TLRPC.Dialog proxyDialog;
|
private TLRPC.Dialog promoDialog;
|
||||||
private boolean isLeftProxyChannel;
|
private boolean isLeftPromoChannel;
|
||||||
private long proxyDialogId;
|
private long promoDialogId;
|
||||||
|
public int promoDialogType;
|
||||||
|
public String promoPsaMessage;
|
||||||
|
public String promoPsaType;
|
||||||
private String proxyDialogAddress;
|
private String proxyDialogAddress;
|
||||||
|
|
||||||
private boolean checkingTosUpdate;
|
private boolean checkingTosUpdate;
|
||||||
|
@ -324,6 +327,10 @@ public class MessagesController extends BaseController implements NotificationCe
|
||||||
public static final int UPDATE_MASK_REORDER = 131072;
|
public static final int UPDATE_MASK_REORDER = 131072;
|
||||||
public static final int UPDATE_MASK_ALL = UPDATE_MASK_AVATAR | UPDATE_MASK_STATUS | UPDATE_MASK_NAME | UPDATE_MASK_CHAT_AVATAR | UPDATE_MASK_CHAT_NAME | UPDATE_MASK_CHAT_MEMBERS | UPDATE_MASK_USER_PRINT | UPDATE_MASK_USER_PHONE | UPDATE_MASK_READ_DIALOG_MESSAGE | UPDATE_MASK_PHONE;
|
public static final int UPDATE_MASK_ALL = UPDATE_MASK_AVATAR | UPDATE_MASK_STATUS | UPDATE_MASK_NAME | UPDATE_MASK_CHAT_AVATAR | UPDATE_MASK_CHAT_NAME | UPDATE_MASK_CHAT_MEMBERS | UPDATE_MASK_USER_PRINT | UPDATE_MASK_USER_PHONE | UPDATE_MASK_READ_DIALOG_MESSAGE | UPDATE_MASK_PHONE;
|
||||||
|
|
||||||
|
public static final int PROMO_TYPE_PROXY = 0;
|
||||||
|
public static final int PROMO_TYPE_PSA = 1;
|
||||||
|
public static final int PROMO_TYPE_OTHER = 2;
|
||||||
|
|
||||||
private static class ReadTask {
|
private static class ReadTask {
|
||||||
public long dialogId;
|
public long dialogId;
|
||||||
public int maxId;
|
public int maxId;
|
||||||
|
@ -537,7 +544,11 @@ public class MessagesController extends BaseController implements NotificationCe
|
||||||
youtubePipType = mainPreferences.getString("youtubePipType", "disabled");
|
youtubePipType = mainPreferences.getString("youtubePipType", "disabled");
|
||||||
keepAliveService = mainPreferences.getBoolean("keepAliveService", false);
|
keepAliveService = mainPreferences.getBoolean("keepAliveService", false);
|
||||||
backgroundConnection = mainPreferences.getBoolean("keepAliveService", false);
|
backgroundConnection = mainPreferences.getBoolean("keepAliveService", false);
|
||||||
proxyDialogId = mainPreferences.getLong("proxy_dialog", 0);
|
promoDialogId = mainPreferences.getLong("proxy_dialog", 0);
|
||||||
|
nextPromoInfoCheckTime = mainPreferences.getInt("nextPromoInfoCheckTime", 0);
|
||||||
|
promoDialogType = mainPreferences.getInt("promo_dialog_type", 0);
|
||||||
|
promoPsaMessage = mainPreferences.getString("promo_psa_message", null);
|
||||||
|
promoPsaType = mainPreferences.getString("promo_psa_type", null);
|
||||||
proxyDialogAddress = mainPreferences.getString("proxyDialogAddress", null);
|
proxyDialogAddress = mainPreferences.getString("proxyDialogAddress", null);
|
||||||
nextTosCheckTime = notificationsPreferences.getInt("nextTosCheckTime", 0);
|
nextTosCheckTime = notificationsPreferences.getInt("nextTosCheckTime", 0);
|
||||||
venueSearchBot = mainPreferences.getString("venueSearchBot", "foursquare");
|
venueSearchBot = mainPreferences.getString("venueSearchBot", "foursquare");
|
||||||
|
@ -710,7 +721,7 @@ public class MessagesController extends BaseController implements NotificationCe
|
||||||
TLRPC.Message message = pinnedDialogs.messages.get(a);
|
TLRPC.Message message = pinnedDialogs.messages.get(a);
|
||||||
if (message.to_id.channel_id != 0) {
|
if (message.to_id.channel_id != 0) {
|
||||||
TLRPC.Chat chat = chatsDict.get(message.to_id.channel_id);
|
TLRPC.Chat chat = chatsDict.get(message.to_id.channel_id);
|
||||||
if (chat != null && chat.left && (proxyDialogId == 0 || proxyDialogId != -chat.id)) {
|
if (chat != null && chat.left && (promoDialogId == 0 || promoDialogId != -chat.id)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (chat != null && chat.megagroup) {
|
if (chat != null && chat.megagroup) {
|
||||||
|
@ -739,8 +750,8 @@ public class MessagesController extends BaseController implements NotificationCe
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (proxyDialogId != 0 && proxyDialogId == d.id) {
|
if (promoDialogId != 0 && promoDialogId == d.id) {
|
||||||
proxyDialog = d;
|
promoDialog = d;
|
||||||
}
|
}
|
||||||
if (d.last_message_date == 0) {
|
if (d.last_message_date == 0) {
|
||||||
MessageObject mess = new_dialogMessage.get(d.id);
|
MessageObject mess = new_dialogMessage.get(d.id);
|
||||||
|
@ -751,7 +762,7 @@ public class MessagesController extends BaseController implements NotificationCe
|
||||||
if (DialogObject.isChannel(d)) {
|
if (DialogObject.isChannel(d)) {
|
||||||
TLRPC.Chat chat = chatsDict.get(-(int) d.id);
|
TLRPC.Chat chat = chatsDict.get(-(int) d.id);
|
||||||
if (chat != null) {
|
if (chat != null) {
|
||||||
if (chat.left && (proxyDialogId == 0 || proxyDialogId != d.id)) {
|
if (chat.left && (promoDialogId == 0 || promoDialogId != d.id)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1867,8 +1878,8 @@ public class MessagesController extends BaseController implements NotificationCe
|
||||||
|
|
||||||
checkingTosUpdate = false;
|
checkingTosUpdate = false;
|
||||||
nextTosCheckTime = 0;
|
nextTosCheckTime = 0;
|
||||||
nextProxyInfoCheckTime = 0;
|
nextPromoInfoCheckTime = 0;
|
||||||
checkingProxyInfo = false;
|
checkingPromoInfo = false;
|
||||||
loadingUnreadDialogs = false;
|
loadingUnreadDialogs = false;
|
||||||
|
|
||||||
currentDeletingTaskTime = 0;
|
currentDeletingTaskTime = 0;
|
||||||
|
@ -3724,6 +3735,24 @@ public class MessagesController extends BaseController implements NotificationCe
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void hidePromoDialog() {
|
||||||
|
if (promoDialog == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
TLRPC.TL_help_hidePromoData req = new TLRPC.TL_help_hidePromoData();
|
||||||
|
req.peer = getInputPeer((int) promoDialog.id);
|
||||||
|
getConnectionsManager().sendRequest(req, (response, error) -> {
|
||||||
|
|
||||||
|
});
|
||||||
|
Utilities.stageQueue.postRunnable(() -> {
|
||||||
|
promoDialogId = 0;
|
||||||
|
proxyDialogAddress = null;
|
||||||
|
nextPromoInfoCheckTime = getConnectionsManager().getCurrentTime() + 60 * 60;
|
||||||
|
getGlobalMainSettings().edit().putLong("proxy_dialog", promoDialogId).remove("proxyDialogAddress").putInt("nextPromoInfoCheckTime", nextPromoInfoCheckTime).commit();
|
||||||
|
});
|
||||||
|
removePromoDialog();
|
||||||
|
}
|
||||||
|
|
||||||
public void deleteDialog(final long did, final int onlyHistory) {
|
public void deleteDialog(final long did, final int onlyHistory) {
|
||||||
deleteDialog(did, onlyHistory, false);
|
deleteDialog(did, onlyHistory, false);
|
||||||
}
|
}
|
||||||
|
@ -3752,7 +3781,7 @@ public class MessagesController extends BaseController implements NotificationCe
|
||||||
int max_id_delete = max_id;
|
int max_id_delete = max_id;
|
||||||
|
|
||||||
if (first) {
|
if (first) {
|
||||||
boolean isProxyDialog = false;
|
boolean isPromoDialog = false;
|
||||||
boolean emptyMax = max_id_delete == 0;
|
boolean emptyMax = max_id_delete == 0;
|
||||||
if (emptyMax) {
|
if (emptyMax) {
|
||||||
int max = getMessagesStorage().getDialogMaxMessageId(did);
|
int max = getMessagesStorage().getDialogMaxMessageId(did);
|
||||||
|
@ -3772,10 +3801,10 @@ public class MessagesController extends BaseController implements NotificationCe
|
||||||
max_id_delete = Math.max(max_id_delete, dialog.read_outbox_max_id);
|
max_id_delete = Math.max(max_id_delete, dialog.read_outbox_max_id);
|
||||||
}
|
}
|
||||||
if (onlyHistory == 0 || onlyHistory == 3) {
|
if (onlyHistory == 0 || onlyHistory == 3) {
|
||||||
if (isProxyDialog = (proxyDialog != null && proxyDialog.id == did)) {
|
if (isPromoDialog = (promoDialog != null && promoDialog.id == did)) {
|
||||||
isLeftProxyChannel = true;
|
isLeftPromoChannel = true;
|
||||||
if (proxyDialog.id < 0) {
|
if (promoDialog.id < 0) {
|
||||||
TLRPC.Chat chat = getChat(-(int) proxyDialog.id);
|
TLRPC.Chat chat = getChat(-(int) promoDialog.id);
|
||||||
if (chat != null) {
|
if (chat != null) {
|
||||||
chat.left = true;
|
chat.left = true;
|
||||||
}
|
}
|
||||||
|
@ -3791,7 +3820,7 @@ public class MessagesController extends BaseController implements NotificationCe
|
||||||
} else {
|
} else {
|
||||||
dialog.unread_count = 0;
|
dialog.unread_count = 0;
|
||||||
}
|
}
|
||||||
if (!isProxyDialog) {
|
if (!isPromoDialog) {
|
||||||
int lastMessageId;
|
int lastMessageId;
|
||||||
MessageObject object = dialogMessage.get(dialog.id);
|
MessageObject object = dialogMessage.get(dialog.id);
|
||||||
dialogMessage.remove(dialog.id);
|
dialogMessage.remove(dialog.id);
|
||||||
|
@ -3852,7 +3881,7 @@ public class MessagesController extends BaseController implements NotificationCe
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!dialogsInTransaction) {
|
if (!dialogsInTransaction) {
|
||||||
if (isProxyDialog) {
|
if (isPromoDialog) {
|
||||||
getNotificationCenter().postNotificationName(NotificationCenter.dialogsNeedReload, true);
|
getNotificationCenter().postNotificationName(NotificationCenter.dialogsNeedReload, true);
|
||||||
} else {
|
} else {
|
||||||
getNotificationCenter().postNotificationName(NotificationCenter.dialogsNeedReload);
|
getNotificationCenter().postNotificationName(NotificationCenter.dialogsNeedReload);
|
||||||
|
@ -4326,7 +4355,7 @@ public class MessagesController extends BaseController implements NotificationCe
|
||||||
GcmPushListenerService.sendRegistrationToServer(SharedConfig.pushString);
|
GcmPushListenerService.sendRegistrationToServer(SharedConfig.pushString);
|
||||||
}
|
}
|
||||||
getLocationController().update();
|
getLocationController().update();
|
||||||
checkProxyInfoInternal(false);
|
checkPromoInfoInternal(false);
|
||||||
checkTosUpdate();
|
checkTosUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4352,268 +4381,283 @@ public class MessagesController extends BaseController implements NotificationCe
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void checkProxyInfo(final boolean reset) {
|
public void checkPromoInfo(final boolean reset) {
|
||||||
Utilities.stageQueue.postRunnable(() -> checkProxyInfoInternal(reset));
|
Utilities.stageQueue.postRunnable(() -> checkPromoInfoInternal(reset));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkProxyInfoInternal(boolean reset) {
|
private void checkPromoInfoInternal(boolean reset) {
|
||||||
if (reset && checkingProxyInfo) {
|
if (reset && checkingPromoInfo) {
|
||||||
checkingProxyInfo = false;
|
checkingPromoInfo = false;
|
||||||
}
|
}
|
||||||
if (!reset && nextProxyInfoCheckTime > getConnectionsManager().getCurrentTime() || checkingProxyInfo) {
|
if (!reset && nextPromoInfoCheckTime > getConnectionsManager().getCurrentTime() || checkingPromoInfo) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (checkingProxyInfoRequestId != 0) {
|
if (checkingPromoInfoRequestId != 0) {
|
||||||
getConnectionsManager().cancelRequest(checkingProxyInfoRequestId, true);
|
getConnectionsManager().cancelRequest(checkingPromoInfoRequestId, true);
|
||||||
checkingProxyInfoRequestId = 0;
|
checkingPromoInfoRequestId = 0;
|
||||||
}
|
}
|
||||||
SharedPreferences preferences = getGlobalMainSettings();
|
SharedPreferences preferences = getGlobalMainSettings();
|
||||||
boolean enabled = preferences.getBoolean("proxy_enabled", false);
|
boolean enabled = preferences.getBoolean("proxy_enabled", false);
|
||||||
String proxyAddress = preferences.getString("proxy_ip", "");
|
String proxyAddress = preferences.getString("proxy_ip", "");
|
||||||
String proxySecret = preferences.getString("proxy_secret", "");
|
String proxySecret = preferences.getString("proxy_secret", "");
|
||||||
int removeCurrent = 0;
|
int removeCurrent = 0;
|
||||||
if (proxyDialogId != 0 && proxyDialogAddress != null && !proxyDialogAddress.equals(proxyAddress + proxySecret)) {
|
if (promoDialogId != 0 && promoDialogType == PROMO_TYPE_PROXY && proxyDialogAddress != null && !proxyDialogAddress.equals(proxyAddress + proxySecret)) {
|
||||||
removeCurrent = 1;
|
removeCurrent = 1;
|
||||||
}
|
}
|
||||||
lastCheckProxyId++;
|
lastCheckPromoId++;
|
||||||
if (enabled && !TextUtils.isEmpty(proxyAddress) && !TextUtils.isEmpty(proxySecret)) {
|
|
||||||
checkingProxyInfo = true;
|
|
||||||
int checkProxyId = lastCheckProxyId;
|
|
||||||
TLRPC.TL_help_getProxyData req = new TLRPC.TL_help_getProxyData();
|
|
||||||
checkingProxyInfoRequestId = getConnectionsManager().sendRequest(req, (response, error) -> {
|
|
||||||
if (checkProxyId != lastCheckProxyId) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
boolean noDialog = false;
|
|
||||||
if (response instanceof TLRPC.TL_help_proxyDataEmpty) {
|
|
||||||
TLRPC.TL_help_proxyDataEmpty res = (TLRPC.TL_help_proxyDataEmpty) response;
|
|
||||||
nextProxyInfoCheckTime = res.expires;
|
|
||||||
noDialog = true;
|
|
||||||
} else if (response instanceof TLRPC.TL_help_proxyDataPromo) {
|
|
||||||
final TLRPC.TL_help_proxyDataPromo res = (TLRPC.TL_help_proxyDataPromo) response;
|
|
||||||
|
|
||||||
final long did;
|
checkingPromoInfo = true;
|
||||||
if (res.peer.user_id != 0) {
|
int checkPromoId = lastCheckPromoId;
|
||||||
did = res.peer.user_id;
|
TLRPC.TL_help_getPromoData req = new TLRPC.TL_help_getPromoData();
|
||||||
} else if (res.peer.chat_id != 0) {
|
checkingPromoInfoRequestId = getConnectionsManager().sendRequest(req, (response, error) -> {
|
||||||
did = -res.peer.chat_id;
|
if (checkPromoId != lastCheckPromoId) {
|
||||||
for (int a = 0; a < res.chats.size(); a++) {
|
return;
|
||||||
TLRPC.Chat chat = res.chats.get(a);
|
}
|
||||||
if (chat.id == res.peer.chat_id) {
|
boolean noDialog = false;
|
||||||
if (chat.kicked || chat.restricted) {
|
if (response instanceof TLRPC.TL_help_promoDataEmpty) {
|
||||||
noDialog = true;
|
TLRPC.TL_help_promoDataEmpty res = (TLRPC.TL_help_promoDataEmpty) response;
|
||||||
}
|
nextPromoInfoCheckTime = res.expires;
|
||||||
break;
|
noDialog = true;
|
||||||
|
} else if (response instanceof TLRPC.TL_help_promoData) {
|
||||||
|
final TLRPC.TL_help_promoData res = (TLRPC.TL_help_promoData) response;
|
||||||
|
|
||||||
|
final long did;
|
||||||
|
if (res.peer.user_id != 0) {
|
||||||
|
did = res.peer.user_id;
|
||||||
|
} else if (res.peer.chat_id != 0) {
|
||||||
|
did = -res.peer.chat_id;
|
||||||
|
for (int a = 0; a < res.chats.size(); a++) {
|
||||||
|
TLRPC.Chat chat = res.chats.get(a);
|
||||||
|
if (chat.id == res.peer.chat_id) {
|
||||||
|
if (chat.kicked || chat.restricted) {
|
||||||
|
noDialog = true;
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
did = -res.peer.channel_id;
|
|
||||||
for (int a = 0; a < res.chats.size(); a++) {
|
|
||||||
TLRPC.Chat chat = res.chats.get(a);
|
|
||||||
if (chat.id == res.peer.channel_id) {
|
|
||||||
if (chat.kicked || chat.restricted) {
|
|
||||||
noDialog = true;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
proxyDialogId = did;
|
|
||||||
proxyDialogAddress = proxyAddress + proxySecret;
|
|
||||||
getGlobalMainSettings().edit().putLong("proxy_dialog", proxyDialogId).putString("proxyDialogAddress", proxyDialogAddress).commit();
|
|
||||||
nextProxyInfoCheckTime = res.expires;
|
|
||||||
if (!noDialog) {
|
|
||||||
AndroidUtilities.runOnUIThread(() -> {
|
|
||||||
if (proxyDialog != null && did != proxyDialog.id) {
|
|
||||||
removeProxyDialog();
|
|
||||||
}
|
|
||||||
proxyDialog = dialogs_dict.get(did);
|
|
||||||
|
|
||||||
if (proxyDialog != null) {
|
|
||||||
checkingProxyInfo = false;
|
|
||||||
sortDialogs(null);
|
|
||||||
getNotificationCenter().postNotificationName(NotificationCenter.dialogsNeedReload, true);
|
|
||||||
} else {
|
|
||||||
final SparseArray<TLRPC.User> usersDict = new SparseArray<>();
|
|
||||||
final SparseArray<TLRPC.Chat> chatsDict = new SparseArray<>();
|
|
||||||
for (int a = 0; a < res.users.size(); a++) {
|
|
||||||
TLRPC.User u = res.users.get(a);
|
|
||||||
usersDict.put(u.id, u);
|
|
||||||
}
|
|
||||||
for (int a = 0; a < res.chats.size(); a++) {
|
|
||||||
TLRPC.Chat c = res.chats.get(a);
|
|
||||||
chatsDict.put(c.id, c);
|
|
||||||
}
|
|
||||||
|
|
||||||
TLRPC.TL_messages_getPeerDialogs req1 = new TLRPC.TL_messages_getPeerDialogs();
|
|
||||||
TLRPC.TL_inputDialogPeer peer = new TLRPC.TL_inputDialogPeer();
|
|
||||||
if (res.peer.user_id != 0) {
|
|
||||||
peer.peer = new TLRPC.TL_inputPeerUser();
|
|
||||||
peer.peer.user_id = res.peer.user_id;
|
|
||||||
TLRPC.User user = usersDict.get(res.peer.user_id);
|
|
||||||
if (user != null) {
|
|
||||||
peer.peer.access_hash = user.access_hash;
|
|
||||||
}
|
|
||||||
} else if (res.peer.chat_id != 0) {
|
|
||||||
peer.peer = new TLRPC.TL_inputPeerChat();
|
|
||||||
peer.peer.chat_id = res.peer.chat_id;
|
|
||||||
TLRPC.Chat chat = chatsDict.get(res.peer.chat_id);
|
|
||||||
if (chat != null) {
|
|
||||||
peer.peer.access_hash = chat.access_hash;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
peer.peer = new TLRPC.TL_inputPeerChannel();
|
|
||||||
peer.peer.channel_id = res.peer.channel_id;
|
|
||||||
TLRPC.Chat chat = chatsDict.get(res.peer.channel_id);
|
|
||||||
if (chat != null) {
|
|
||||||
peer.peer.access_hash = chat.access_hash;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
req1.peers.add(peer);
|
|
||||||
checkingProxyInfoRequestId = getConnectionsManager().sendRequest(req1, (response1, error1) -> {
|
|
||||||
if (checkProxyId != lastCheckProxyId) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
checkingProxyInfoRequestId = 0;
|
|
||||||
final TLRPC.TL_messages_peerDialogs res2 = (TLRPC.TL_messages_peerDialogs) response1;
|
|
||||||
if (res2 != null && !res2.dialogs.isEmpty()) {
|
|
||||||
getMessagesStorage().putUsersAndChats(res.users, res.chats, true, true);
|
|
||||||
TLRPC.TL_messages_dialogs dialogs = new TLRPC.TL_messages_dialogs();
|
|
||||||
dialogs.chats = res2.chats;
|
|
||||||
dialogs.users = res2.users;
|
|
||||||
dialogs.dialogs = res2.dialogs;
|
|
||||||
dialogs.messages = res2.messages;
|
|
||||||
getMessagesStorage().putDialogs(dialogs, 2);
|
|
||||||
AndroidUtilities.runOnUIThread(() -> {
|
|
||||||
putUsers(res.users, false);
|
|
||||||
putChats(res.chats, false);
|
|
||||||
putUsers(res2.users, false);
|
|
||||||
putChats(res2.chats, false);
|
|
||||||
|
|
||||||
if (proxyDialog != null) {
|
|
||||||
int lowerId = (int) proxyDialog.id;
|
|
||||||
if (lowerId < 0) {
|
|
||||||
TLRPC.Chat chat = getChat(-lowerId);
|
|
||||||
if (ChatObject.isNotInChat(chat) || chat.restricted) {
|
|
||||||
removeDialog(proxyDialog);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
removeDialog(proxyDialog);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
proxyDialog = res2.dialogs.get(0);
|
|
||||||
proxyDialog.id = did;
|
|
||||||
proxyDialog.folder_id = 0;
|
|
||||||
if (DialogObject.isChannel(proxyDialog)) {
|
|
||||||
channelsPts.put(-(int) proxyDialog.id, proxyDialog.pts);
|
|
||||||
}
|
|
||||||
Integer value = dialogs_read_inbox_max.get(proxyDialog.id);
|
|
||||||
if (value == null) {
|
|
||||||
value = 0;
|
|
||||||
}
|
|
||||||
dialogs_read_inbox_max.put(proxyDialog.id, Math.max(value, proxyDialog.read_inbox_max_id));
|
|
||||||
value = dialogs_read_outbox_max.get(proxyDialog.id);
|
|
||||||
if (value == null) {
|
|
||||||
value = 0;
|
|
||||||
}
|
|
||||||
dialogs_read_outbox_max.put(proxyDialog.id, Math.max(value, proxyDialog.read_outbox_max_id));
|
|
||||||
dialogs_dict.put(did, proxyDialog);
|
|
||||||
if (!res2.messages.isEmpty()) {
|
|
||||||
final SparseArray<TLRPC.User> usersDict1 = new SparseArray<>();
|
|
||||||
final SparseArray<TLRPC.Chat> chatsDict1 = new SparseArray<>();
|
|
||||||
for (int a = 0; a < res2.users.size(); a++) {
|
|
||||||
TLRPC.User u = res2.users.get(a);
|
|
||||||
usersDict1.put(u.id, u);
|
|
||||||
}
|
|
||||||
for (int a = 0; a < res2.chats.size(); a++) {
|
|
||||||
TLRPC.Chat c = res2.chats.get(a);
|
|
||||||
chatsDict1.put(c.id, c);
|
|
||||||
}
|
|
||||||
MessageObject messageObject = new MessageObject(currentAccount, res2.messages.get(0), usersDict1, chatsDict1, false);
|
|
||||||
dialogMessage.put(did, messageObject);
|
|
||||||
if (proxyDialog.last_message_date == 0) {
|
|
||||||
proxyDialog.last_message_date = messageObject.messageOwner.date;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
sortDialogs(null);
|
|
||||||
getNotificationCenter().postNotificationName(NotificationCenter.dialogsNeedReload, true);
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
AndroidUtilities.runOnUIThread(() -> {
|
|
||||||
if (proxyDialog != null) {
|
|
||||||
int lowerId = (int) proxyDialog.id;
|
|
||||||
if (lowerId < 0) {
|
|
||||||
TLRPC.Chat chat = getChat(-lowerId);
|
|
||||||
if (ChatObject.isNotInChat(chat) || chat.restricted) {
|
|
||||||
removeDialog(proxyDialog);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
removeDialog(proxyDialog);
|
|
||||||
}
|
|
||||||
proxyDialog = null;
|
|
||||||
sortDialogs(null);
|
|
||||||
getNotificationCenter().postNotificationName(NotificationCenter.dialogsNeedReload);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
checkingProxyInfo = false;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
nextProxyInfoCheckTime = getConnectionsManager().getCurrentTime() + 60 * 60;
|
did = -res.peer.channel_id;
|
||||||
noDialog = true;
|
for (int a = 0; a < res.chats.size(); a++) {
|
||||||
|
TLRPC.Chat chat = res.chats.get(a);
|
||||||
|
if (chat.id == res.peer.channel_id) {
|
||||||
|
if (chat.kicked || chat.restricted) {
|
||||||
|
noDialog = true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (noDialog) {
|
promoDialogId = did;
|
||||||
proxyDialogId = 0;
|
if (res.proxy) {
|
||||||
getGlobalMainSettings().edit().putLong("proxy_dialog", proxyDialogId).remove("proxyDialogAddress").commit();
|
promoDialogType = PROMO_TYPE_PROXY;
|
||||||
checkingProxyInfoRequestId = 0;
|
} else if (!TextUtils.isEmpty(res.psa_type)) {
|
||||||
checkingProxyInfo = false;
|
promoDialogType = PROMO_TYPE_PSA;
|
||||||
AndroidUtilities.runOnUIThread(this::removeProxyDialog);
|
promoPsaType = res.psa_type;
|
||||||
|
} else {
|
||||||
|
promoDialogType = PROMO_TYPE_OTHER;
|
||||||
}
|
}
|
||||||
});
|
proxyDialogAddress = proxyAddress + proxySecret;
|
||||||
} else {
|
promoPsaMessage = res.psa_message;
|
||||||
removeCurrent = 2;
|
nextPromoInfoCheckTime = res.expires;
|
||||||
}
|
SharedPreferences.Editor editor = getGlobalMainSettings().edit();
|
||||||
if (removeCurrent != 0) {
|
editor.putLong("proxy_dialog", promoDialogId);
|
||||||
proxyDialogId = 0;
|
editor.putString("proxyDialogAddress", proxyDialogAddress);
|
||||||
proxyDialogAddress = null;
|
editor.putInt("promo_dialog_type", promoDialogType);
|
||||||
getGlobalMainSettings().edit().putLong("proxy_dialog", proxyDialogId).remove("proxyDialogAddress").commit();
|
if (promoPsaMessage != null) {
|
||||||
nextProxyInfoCheckTime = getConnectionsManager().getCurrentTime() + 60 * 60;
|
editor.putString("promo_psa_message", promoPsaMessage);
|
||||||
if (removeCurrent == 2) {
|
} else {
|
||||||
checkingProxyInfo = false;
|
editor.remove("promo_psa_message");
|
||||||
if (checkingProxyInfoRequestId != 0) {
|
|
||||||
getConnectionsManager().cancelRequest(checkingProxyInfoRequestId, true);
|
|
||||||
checkingProxyInfoRequestId = 0;
|
|
||||||
}
|
}
|
||||||
|
if (promoPsaType != null) {
|
||||||
|
editor.putString("promo_psa_type", promoPsaType);
|
||||||
|
} else {
|
||||||
|
editor.remove("promo_psa_type");
|
||||||
|
}
|
||||||
|
editor.putInt("nextPromoInfoCheckTime", nextPromoInfoCheckTime);
|
||||||
|
editor.commit();
|
||||||
|
|
||||||
|
if (!noDialog) {
|
||||||
|
AndroidUtilities.runOnUIThread(() -> {
|
||||||
|
if (promoDialog != null && did != promoDialog.id) {
|
||||||
|
removePromoDialog();
|
||||||
|
}
|
||||||
|
promoDialog = dialogs_dict.get(did);
|
||||||
|
|
||||||
|
if (promoDialog != null) {
|
||||||
|
checkingPromoInfo = false;
|
||||||
|
sortDialogs(null);
|
||||||
|
getNotificationCenter().postNotificationName(NotificationCenter.dialogsNeedReload, true);
|
||||||
|
} else {
|
||||||
|
final SparseArray<TLRPC.User> usersDict = new SparseArray<>();
|
||||||
|
final SparseArray<TLRPC.Chat> chatsDict = new SparseArray<>();
|
||||||
|
for (int a = 0; a < res.users.size(); a++) {
|
||||||
|
TLRPC.User u = res.users.get(a);
|
||||||
|
usersDict.put(u.id, u);
|
||||||
|
}
|
||||||
|
for (int a = 0; a < res.chats.size(); a++) {
|
||||||
|
TLRPC.Chat c = res.chats.get(a);
|
||||||
|
chatsDict.put(c.id, c);
|
||||||
|
}
|
||||||
|
|
||||||
|
TLRPC.TL_messages_getPeerDialogs req1 = new TLRPC.TL_messages_getPeerDialogs();
|
||||||
|
TLRPC.TL_inputDialogPeer peer = new TLRPC.TL_inputDialogPeer();
|
||||||
|
if (res.peer.user_id != 0) {
|
||||||
|
peer.peer = new TLRPC.TL_inputPeerUser();
|
||||||
|
peer.peer.user_id = res.peer.user_id;
|
||||||
|
TLRPC.User user = usersDict.get(res.peer.user_id);
|
||||||
|
if (user != null) {
|
||||||
|
peer.peer.access_hash = user.access_hash;
|
||||||
|
}
|
||||||
|
} else if (res.peer.chat_id != 0) {
|
||||||
|
peer.peer = new TLRPC.TL_inputPeerChat();
|
||||||
|
peer.peer.chat_id = res.peer.chat_id;
|
||||||
|
TLRPC.Chat chat = chatsDict.get(res.peer.chat_id);
|
||||||
|
if (chat != null) {
|
||||||
|
peer.peer.access_hash = chat.access_hash;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
peer.peer = new TLRPC.TL_inputPeerChannel();
|
||||||
|
peer.peer.channel_id = res.peer.channel_id;
|
||||||
|
TLRPC.Chat chat = chatsDict.get(res.peer.channel_id);
|
||||||
|
if (chat != null) {
|
||||||
|
peer.peer.access_hash = chat.access_hash;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
req1.peers.add(peer);
|
||||||
|
checkingPromoInfoRequestId = getConnectionsManager().sendRequest(req1, (response1, error1) -> {
|
||||||
|
if (checkPromoId != lastCheckPromoId) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
checkingPromoInfoRequestId = 0;
|
||||||
|
final TLRPC.TL_messages_peerDialogs res2 = (TLRPC.TL_messages_peerDialogs) response1;
|
||||||
|
if (res2 != null && !res2.dialogs.isEmpty()) {
|
||||||
|
getMessagesStorage().putUsersAndChats(res.users, res.chats, true, true);
|
||||||
|
TLRPC.TL_messages_dialogs dialogs = new TLRPC.TL_messages_dialogs();
|
||||||
|
dialogs.chats = res2.chats;
|
||||||
|
dialogs.users = res2.users;
|
||||||
|
dialogs.dialogs = res2.dialogs;
|
||||||
|
dialogs.messages = res2.messages;
|
||||||
|
getMessagesStorage().putDialogs(dialogs, 2);
|
||||||
|
AndroidUtilities.runOnUIThread(() -> {
|
||||||
|
putUsers(res.users, false);
|
||||||
|
putChats(res.chats, false);
|
||||||
|
putUsers(res2.users, false);
|
||||||
|
putChats(res2.chats, false);
|
||||||
|
|
||||||
|
if (promoDialog != null) {
|
||||||
|
int lowerId = (int) promoDialog.id;
|
||||||
|
if (lowerId < 0) {
|
||||||
|
TLRPC.Chat chat = getChat(-lowerId);
|
||||||
|
if (ChatObject.isNotInChat(chat) || chat.restricted) {
|
||||||
|
removeDialog(promoDialog);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
removeDialog(promoDialog);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
promoDialog = res2.dialogs.get(0);
|
||||||
|
promoDialog.id = did;
|
||||||
|
promoDialog.folder_id = 0;
|
||||||
|
if (DialogObject.isChannel(promoDialog)) {
|
||||||
|
channelsPts.put(-(int) promoDialog.id, promoDialog.pts);
|
||||||
|
}
|
||||||
|
Integer value = dialogs_read_inbox_max.get(promoDialog.id);
|
||||||
|
if (value == null) {
|
||||||
|
value = 0;
|
||||||
|
}
|
||||||
|
dialogs_read_inbox_max.put(promoDialog.id, Math.max(value, promoDialog.read_inbox_max_id));
|
||||||
|
value = dialogs_read_outbox_max.get(promoDialog.id);
|
||||||
|
if (value == null) {
|
||||||
|
value = 0;
|
||||||
|
}
|
||||||
|
dialogs_read_outbox_max.put(promoDialog.id, Math.max(value, promoDialog.read_outbox_max_id));
|
||||||
|
dialogs_dict.put(did, promoDialog);
|
||||||
|
if (!res2.messages.isEmpty()) {
|
||||||
|
final SparseArray<TLRPC.User> usersDict1 = new SparseArray<>();
|
||||||
|
final SparseArray<TLRPC.Chat> chatsDict1 = new SparseArray<>();
|
||||||
|
for (int a = 0; a < res2.users.size(); a++) {
|
||||||
|
TLRPC.User u = res2.users.get(a);
|
||||||
|
usersDict1.put(u.id, u);
|
||||||
|
}
|
||||||
|
for (int a = 0; a < res2.chats.size(); a++) {
|
||||||
|
TLRPC.Chat c = res2.chats.get(a);
|
||||||
|
chatsDict1.put(c.id, c);
|
||||||
|
}
|
||||||
|
MessageObject messageObject = new MessageObject(currentAccount, res2.messages.get(0), usersDict1, chatsDict1, false);
|
||||||
|
dialogMessage.put(did, messageObject);
|
||||||
|
if (promoDialog.last_message_date == 0) {
|
||||||
|
promoDialog.last_message_date = messageObject.messageOwner.date;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
sortDialogs(null);
|
||||||
|
getNotificationCenter().postNotificationName(NotificationCenter.dialogsNeedReload, true);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
AndroidUtilities.runOnUIThread(() -> {
|
||||||
|
if (promoDialog != null) {
|
||||||
|
int lowerId = (int) promoDialog.id;
|
||||||
|
if (lowerId < 0) {
|
||||||
|
TLRPC.Chat chat = getChat(-lowerId);
|
||||||
|
if (ChatObject.isNotInChat(chat) || chat.restricted) {
|
||||||
|
removeDialog(promoDialog);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
removeDialog(promoDialog);
|
||||||
|
}
|
||||||
|
promoDialog = null;
|
||||||
|
sortDialogs(null);
|
||||||
|
getNotificationCenter().postNotificationName(NotificationCenter.dialogsNeedReload);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
checkingPromoInfo = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
nextPromoInfoCheckTime = getConnectionsManager().getCurrentTime() + 60 * 60;
|
||||||
|
noDialog = true;
|
||||||
}
|
}
|
||||||
AndroidUtilities.runOnUIThread(this::removeProxyDialog);
|
if (noDialog) {
|
||||||
|
promoDialogId = 0;
|
||||||
|
getGlobalMainSettings().edit().putLong("proxy_dialog", promoDialogId).remove("proxyDialogAddress").putInt("nextPromoInfoCheckTime", nextPromoInfoCheckTime).commit();
|
||||||
|
checkingPromoInfoRequestId = 0;
|
||||||
|
checkingPromoInfo = false;
|
||||||
|
AndroidUtilities.runOnUIThread(this::removePromoDialog);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (removeCurrent != 0) {
|
||||||
|
promoDialogId = 0;
|
||||||
|
proxyDialogAddress = null;
|
||||||
|
nextPromoInfoCheckTime = getConnectionsManager().getCurrentTime() + 60 * 60;
|
||||||
|
getGlobalMainSettings().edit().putLong("proxy_dialog", promoDialogId).remove("proxyDialogAddress").putInt("nextPromoInfoCheckTime", nextPromoInfoCheckTime).commit();
|
||||||
|
AndroidUtilities.runOnUIThread(this::removePromoDialog);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void removeProxyDialog() {
|
private void removePromoDialog() {
|
||||||
if (proxyDialog == null) {
|
if (promoDialog == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int lowerId = (int) proxyDialog.id;
|
int lowerId = (int) promoDialog.id;
|
||||||
if (lowerId < 0) {
|
if (lowerId < 0) {
|
||||||
TLRPC.Chat chat = getChat(-lowerId);
|
TLRPC.Chat chat = getChat(-lowerId);
|
||||||
if (ChatObject.isNotInChat(chat) || chat.restricted) {
|
if (ChatObject.isNotInChat(chat) || chat.restricted) {
|
||||||
removeDialog(proxyDialog);
|
removeDialog(promoDialog);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
removeDialog(proxyDialog);
|
removeDialog(promoDialog);
|
||||||
}
|
}
|
||||||
proxyDialog = null;
|
promoDialog = null;
|
||||||
sortDialogs(null);
|
sortDialogs(null);
|
||||||
getNotificationCenter().postNotificationName(NotificationCenter.dialogsNeedReload);
|
getNotificationCenter().postNotificationName(NotificationCenter.dialogsNeedReload);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isProxyDialog(long did, boolean checkLeft) {
|
public boolean isPromoDialog(long did, boolean checkLeft) {
|
||||||
return proxyDialog != null && proxyDialog.id == did && (!checkLeft || isLeftProxyChannel);
|
return promoDialog != null && promoDialog.id == did && (!checkLeft || isLeftPromoChannel);
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getUserNameForTyping(TLRPC.User user) {
|
private String getUserNameForTyping(TLRPC.User user) {
|
||||||
|
@ -5250,7 +5294,7 @@ public class MessagesController extends BaseController implements NotificationCe
|
||||||
for (int a = 0; a < allDialogs.size(); a++) {
|
for (int a = 0; a < allDialogs.size(); a++) {
|
||||||
TLRPC.Dialog d = allDialogs.get(a);
|
TLRPC.Dialog d = allDialogs.get(a);
|
||||||
if (!d.pinned) {
|
if (!d.pinned) {
|
||||||
if (d.id != proxyDialogId) {
|
if (d.id != promoDialogId) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
|
@ -5317,7 +5361,7 @@ public class MessagesController extends BaseController implements NotificationCe
|
||||||
if (!DialogObject.isPeerDialogId(dialogId) && !DialogObject.isSecretDialogId(dialogId)) {
|
if (!DialogObject.isPeerDialogId(dialogId) && !DialogObject.isSecretDialogId(dialogId)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (folderId == 1 && (dialogId == selfUserId || dialogId == 777000 || isProxyDialog(dialogId, false))) {
|
if (folderId == 1 && (dialogId == selfUserId || dialogId == 777000 || isPromoDialog(dialogId, false))) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
TLRPC.Dialog dialog = dialogs_dict.get(dialogId);
|
TLRPC.Dialog dialog = dialogs_dict.get(dialogId);
|
||||||
|
@ -6204,7 +6248,7 @@ public class MessagesController extends BaseController implements NotificationCe
|
||||||
}
|
}
|
||||||
if (message.to_id.channel_id != 0) {
|
if (message.to_id.channel_id != 0) {
|
||||||
TLRPC.Chat chat = chatsDict.get(message.to_id.channel_id);
|
TLRPC.Chat chat = chatsDict.get(message.to_id.channel_id);
|
||||||
if (chat != null && chat.left && (proxyDialogId == 0 || proxyDialogId != -chat.id)) {
|
if (chat != null && chat.left && (promoDialogId == 0 || promoDialogId != -chat.id)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (chat != null && chat.megagroup) {
|
if (chat != null && chat.megagroup) {
|
||||||
|
@ -6294,8 +6338,8 @@ public class MessagesController extends BaseController implements NotificationCe
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (proxyDialogId != 0 && proxyDialogId == d.id) {
|
if (promoDialogId != 0 && promoDialogId == d.id) {
|
||||||
proxyDialog = d;
|
promoDialog = d;
|
||||||
}
|
}
|
||||||
if (d.last_message_date == 0) {
|
if (d.last_message_date == 0) {
|
||||||
MessageObject mess = new_dialogMessage.get(d.id);
|
MessageObject mess = new_dialogMessage.get(d.id);
|
||||||
|
@ -6310,7 +6354,7 @@ public class MessagesController extends BaseController implements NotificationCe
|
||||||
if (!chat.megagroup) {
|
if (!chat.megagroup) {
|
||||||
allowCheck = false;
|
allowCheck = false;
|
||||||
}
|
}
|
||||||
if (chat.left && (proxyDialogId == 0 || proxyDialogId != d.id)) {
|
if (chat.left && (promoDialogId == 0 || promoDialogId != d.id)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6863,7 +6907,7 @@ public class MessagesController extends BaseController implements NotificationCe
|
||||||
|
|
||||||
for (int a = 0; a < dialogsRes.messages.size(); a++) {
|
for (int a = 0; a < dialogsRes.messages.size(); a++) {
|
||||||
TLRPC.Message message = dialogsRes.messages.get(a);
|
TLRPC.Message message = dialogsRes.messages.get(a);
|
||||||
if (proxyDialogId == 0 || proxyDialogId != message.dialog_id) {
|
if (promoDialogId == 0 || promoDialogId != message.dialog_id) {
|
||||||
if (message.to_id.channel_id != 0) {
|
if (message.to_id.channel_id != 0) {
|
||||||
TLRPC.Chat chat = chatsDict.get(message.to_id.channel_id);
|
TLRPC.Chat chat = chatsDict.get(message.to_id.channel_id);
|
||||||
if (chat != null && chat.left) {
|
if (chat != null && chat.left) {
|
||||||
|
@ -6882,7 +6926,7 @@ public class MessagesController extends BaseController implements NotificationCe
|
||||||
for (int a = 0; a < dialogsRes.dialogs.size(); a++) {
|
for (int a = 0; a < dialogsRes.dialogs.size(); a++) {
|
||||||
TLRPC.Dialog d = dialogsRes.dialogs.get(a);
|
TLRPC.Dialog d = dialogsRes.dialogs.get(a);
|
||||||
DialogObject.initDialog(d);
|
DialogObject.initDialog(d);
|
||||||
if (proxyDialogId == 0 || proxyDialogId != d.id) {
|
if (promoDialogId == 0 || promoDialogId != d.id) {
|
||||||
if (DialogObject.isChannel(d)) {
|
if (DialogObject.isChannel(d)) {
|
||||||
TLRPC.Chat chat = chatsDict.get(-(int) d.id);
|
TLRPC.Chat chat = chatsDict.get(-(int) d.id);
|
||||||
if (chat != null && chat.left) {
|
if (chat != null && chat.left) {
|
||||||
|
@ -8970,7 +9014,7 @@ public class MessagesController extends BaseController implements NotificationCe
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!dialog.pinned) {
|
if (!dialog.pinned) {
|
||||||
if (dialog.id != proxyDialogId) {
|
if (dialog.id != promoDialogId) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
|
@ -9027,7 +9071,7 @@ public class MessagesController extends BaseController implements NotificationCe
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!d.pinned) {
|
if (!d.pinned) {
|
||||||
if (d.id != proxyDialogId) {
|
if (d.id != promoDialogId) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
|
@ -9193,7 +9237,7 @@ public class MessagesController extends BaseController implements NotificationCe
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!dialog.pinned) {
|
if (!dialog.pinned) {
|
||||||
if (dialog.id != proxyDialogId) {
|
if (dialog.id != promoDialogId) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
|
@ -11321,7 +11365,7 @@ public class MessagesController extends BaseController implements NotificationCe
|
||||||
if (chat != null) {
|
if (chat != null) {
|
||||||
if (dialog == null && chat instanceof TLRPC.TL_channel && !chat.left) {
|
if (dialog == null && chat instanceof TLRPC.TL_channel && !chat.left) {
|
||||||
Utilities.stageQueue.postRunnable(() -> getChannelDifference(update.channel_id, 1, 0, null));
|
Utilities.stageQueue.postRunnable(() -> getChannelDifference(update.channel_id, 1, 0, null));
|
||||||
} else if (chat.left && dialog != null && (proxyDialog == null || proxyDialog.id != dialog.id)) {
|
} else if (chat.left && dialog != null && (promoDialog == null || promoDialog.id != dialog.id)) {
|
||||||
deleteDialog(dialog.id, 0);
|
deleteDialog(dialog.id, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11822,7 +11866,13 @@ public class MessagesController extends BaseController implements NotificationCe
|
||||||
public boolean isDialogMuted(long dialog_id, TLRPC.Chat chat) {
|
public boolean isDialogMuted(long dialog_id, TLRPC.Chat chat) {
|
||||||
int mute_type = notificationsPreferences.getInt("notify2_" + dialog_id, -1);
|
int mute_type = notificationsPreferences.getInt("notify2_" + dialog_id, -1);
|
||||||
if (mute_type == -1) {
|
if (mute_type == -1) {
|
||||||
return !getNotificationsController().isGlobalNotificationsEnabled(dialog_id, ChatObject.isChannel(chat) && !chat.megagroup);
|
Boolean forceChannel;
|
||||||
|
if (chat != null) {
|
||||||
|
forceChannel = ChatObject.isChannel(chat) && !chat.megagroup;
|
||||||
|
} else {
|
||||||
|
forceChannel = null;
|
||||||
|
}
|
||||||
|
return !getNotificationsController().isGlobalNotificationsEnabled(dialog_id, forceChannel);
|
||||||
}
|
}
|
||||||
if (mute_type == 2) {
|
if (mute_type == 2) {
|
||||||
return true;
|
return true;
|
||||||
|
@ -12157,11 +12207,11 @@ public class MessagesController extends BaseController implements NotificationCe
|
||||||
}
|
}
|
||||||
|
|
||||||
Collections.sort(allDialogs, dialogComparator);
|
Collections.sort(allDialogs, dialogComparator);
|
||||||
isLeftProxyChannel = true;
|
isLeftPromoChannel = true;
|
||||||
if (proxyDialog != null && proxyDialog.id < 0) {
|
if (promoDialog != null && promoDialog.id < 0) {
|
||||||
TLRPC.Chat chat = getChat(-(int) proxyDialog.id);
|
TLRPC.Chat chat = getChat(-(int) promoDialog.id);
|
||||||
if (chat != null && !chat.left) {
|
if (chat != null && !chat.left) {
|
||||||
isLeftProxyChannel = false;
|
isLeftPromoChannel = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (int a = 0, N = allDialogs.size(); a < N; a++) {
|
for (int a = 0, N = allDialogs.size(); a < N; a++) {
|
||||||
|
@ -12215,7 +12265,7 @@ public class MessagesController extends BaseController implements NotificationCe
|
||||||
if ((d.unread_count != 0 || d.unread_mark) && !isDialogMuted(d.id)) {
|
if ((d.unread_count != 0 || d.unread_mark) && !isDialogMuted(d.id)) {
|
||||||
unreadUnmutedDialogs++;
|
unreadUnmutedDialogs++;
|
||||||
}
|
}
|
||||||
if (proxyDialog != null && d.id == proxyDialog.id && isLeftProxyChannel) {
|
if (promoDialog != null && d.id == promoDialog.id && isLeftPromoChannel) {
|
||||||
allDialogs.remove(a);
|
allDialogs.remove(a);
|
||||||
a--;
|
a--;
|
||||||
N--;
|
N--;
|
||||||
|
@ -12223,9 +12273,9 @@ public class MessagesController extends BaseController implements NotificationCe
|
||||||
}
|
}
|
||||||
addDialogToItsFolder(-1, d);
|
addDialogToItsFolder(-1, d);
|
||||||
}
|
}
|
||||||
if (proxyDialog != null && isLeftProxyChannel) {
|
if (promoDialog != null && isLeftPromoChannel) {
|
||||||
allDialogs.add(0, proxyDialog);
|
allDialogs.add(0, promoDialog);
|
||||||
addDialogToItsFolder(-2, proxyDialog);
|
addDialogToItsFolder(-2, promoDialog);
|
||||||
}
|
}
|
||||||
if (!selfAdded) {
|
if (!selfAdded) {
|
||||||
TLRPC.User user = getUserConfig().getCurrentUser();
|
TLRPC.User user = getUserConfig().getCurrentUser();
|
||||||
|
|
|
@ -3627,7 +3627,7 @@ public class MessagesStorage extends BaseController {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateFiltersReadCounter(LongSparseArray<Integer> dialogsToUpdate, LongSparseArray<Integer> dialogsToUpdateMentions, boolean read) throws Exception {
|
private void updateFiltersReadCounter(LongSparseArray<Integer> dialogsToUpdate, LongSparseArray<Integer> dialogsToUpdateMentions, boolean read) throws Exception {
|
||||||
if (dialogFilters.isEmpty() || (dialogsToUpdate == null || dialogsToUpdate.size() == 0) && (dialogsToUpdateMentions == null || dialogsToUpdateMentions.size() == 0)) {
|
if ((dialogsToUpdate == null || dialogsToUpdate.size() == 0) && (dialogsToUpdateMentions == null || dialogsToUpdateMentions.size() == 0)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (int a = 0; a < 2; a++) {
|
for (int a = 0; a < 2; a++) {
|
||||||
|
|
|
@ -639,7 +639,7 @@ public class ConnectionsManager extends BaseController {
|
||||||
}
|
}
|
||||||
AccountInstance accountInstance = AccountInstance.getInstance(a);
|
AccountInstance accountInstance = AccountInstance.getInstance(a);
|
||||||
if (accountInstance.getUserConfig().isClientActivated()) {
|
if (accountInstance.getUserConfig().isClientActivated()) {
|
||||||
accountInstance.getMessagesController().checkProxyInfo(true);
|
accountInstance.getMessagesController().checkPromoInfo(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,7 +61,7 @@ public class TLRPC {
|
||||||
public static final int MESSAGE_FLAG_EDITED = 0x00008000;
|
public static final int MESSAGE_FLAG_EDITED = 0x00008000;
|
||||||
public static final int MESSAGE_FLAG_MEGAGROUP = 0x80000000;
|
public static final int MESSAGE_FLAG_MEGAGROUP = 0x80000000;
|
||||||
|
|
||||||
public static final int LAYER = 112;
|
public static final int LAYER = 113;
|
||||||
|
|
||||||
public static class TL_chatBannedRights extends TLObject {
|
public static class TL_chatBannedRights extends TLObject {
|
||||||
public static int constructor = 0x9f120418;
|
public static int constructor = 0x9f120418;
|
||||||
|
@ -20469,105 +20469,6 @@ public class TLRPC {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static abstract class help_ProxyData extends TLObject {
|
|
||||||
|
|
||||||
public static help_ProxyData TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) {
|
|
||||||
help_ProxyData result = null;
|
|
||||||
switch (constructor) {
|
|
||||||
case 0xe09e1fb8:
|
|
||||||
result = new TL_help_proxyDataEmpty();
|
|
||||||
break;
|
|
||||||
case 0x2bf7ee23:
|
|
||||||
result = new TL_help_proxyDataPromo();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (result == null && exception) {
|
|
||||||
throw new RuntimeException(String.format("can't parse magic %x in help_ProxyData", constructor));
|
|
||||||
}
|
|
||||||
if (result != null) {
|
|
||||||
result.readParams(stream, exception);
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class TL_help_proxyDataEmpty extends help_ProxyData {
|
|
||||||
public static int constructor = 0xe09e1fb8;
|
|
||||||
|
|
||||||
public int expires;
|
|
||||||
|
|
||||||
public void readParams(AbstractSerializedData stream, boolean exception) {
|
|
||||||
expires = stream.readInt32(exception);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void serializeToStream(AbstractSerializedData stream) {
|
|
||||||
stream.writeInt32(constructor);
|
|
||||||
stream.writeInt32(expires);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class TL_help_proxyDataPromo extends help_ProxyData {
|
|
||||||
public static int constructor = 0x2bf7ee23;
|
|
||||||
|
|
||||||
public int expires;
|
|
||||||
public Peer peer;
|
|
||||||
public ArrayList<Chat> chats = new ArrayList<>();
|
|
||||||
public ArrayList<User> users = new ArrayList<>();
|
|
||||||
|
|
||||||
public void readParams(AbstractSerializedData stream, boolean exception) {
|
|
||||||
expires = stream.readInt32(exception);
|
|
||||||
peer = Peer.TLdeserialize(stream, stream.readInt32(exception), exception);
|
|
||||||
int magic = stream.readInt32(exception);
|
|
||||||
if (magic != 0x1cb5c415) {
|
|
||||||
if (exception) {
|
|
||||||
throw new RuntimeException(String.format("wrong Vector magic, got %x", magic));
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
int count = stream.readInt32(exception);
|
|
||||||
for (int a = 0; a < count; a++) {
|
|
||||||
Chat object = 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++) {
|
|
||||||
User object = User.TLdeserialize(stream, stream.readInt32(exception), exception);
|
|
||||||
if (object == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
users.add(object);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void serializeToStream(AbstractSerializedData stream) {
|
|
||||||
stream.writeInt32(constructor);
|
|
||||||
stream.writeInt32(expires);
|
|
||||||
peer.serializeToStream(stream);
|
|
||||||
stream.writeInt32(0x1cb5c415);
|
|
||||||
int 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 abstract class MessageUserVote extends TLObject {
|
public static abstract class MessageUserVote extends TLObject {
|
||||||
|
|
||||||
public int user_id;
|
public int user_id;
|
||||||
|
@ -26730,6 +26631,125 @@ public class TLRPC {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static abstract class help_PromoData extends TLObject {
|
||||||
|
|
||||||
|
public static help_PromoData TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) {
|
||||||
|
help_PromoData result = null;
|
||||||
|
switch (constructor) {
|
||||||
|
case 0x8c39793f:
|
||||||
|
result = new TL_help_promoData();
|
||||||
|
break;
|
||||||
|
case 0x98f6ac75:
|
||||||
|
result = new TL_help_promoDataEmpty();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (result == null && exception) {
|
||||||
|
throw new RuntimeException(String.format("can't parse magic %x in help_PromoData", constructor));
|
||||||
|
}
|
||||||
|
if (result != null) {
|
||||||
|
result.readParams(stream, exception);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class TL_help_promoData extends help_PromoData {
|
||||||
|
public static int constructor = 0x8c39793f;
|
||||||
|
|
||||||
|
public int flags;
|
||||||
|
public boolean proxy;
|
||||||
|
public int expires;
|
||||||
|
public Peer peer;
|
||||||
|
public ArrayList<Chat> chats = new ArrayList<>();
|
||||||
|
public ArrayList<User> users = new ArrayList<>();
|
||||||
|
public String psa_type;
|
||||||
|
public String psa_message;
|
||||||
|
|
||||||
|
public void readParams(AbstractSerializedData stream, boolean exception) {
|
||||||
|
flags = stream.readInt32(exception);
|
||||||
|
proxy = (flags & 1) != 0;
|
||||||
|
expires = stream.readInt32(exception);
|
||||||
|
peer = Peer.TLdeserialize(stream, stream.readInt32(exception), exception);
|
||||||
|
int magic = stream.readInt32(exception);
|
||||||
|
if (magic != 0x1cb5c415) {
|
||||||
|
if (exception) {
|
||||||
|
throw new RuntimeException(String.format("wrong Vector magic, got %x", magic));
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
int count = stream.readInt32(exception);
|
||||||
|
for (int a = 0; a < count; a++) {
|
||||||
|
Chat object = 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++) {
|
||||||
|
User object = User.TLdeserialize(stream, stream.readInt32(exception), exception);
|
||||||
|
if (object == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
users.add(object);
|
||||||
|
}
|
||||||
|
if ((flags & 2) != 0) {
|
||||||
|
psa_type = stream.readString(exception);
|
||||||
|
}
|
||||||
|
if ((flags & 4) != 0) {
|
||||||
|
psa_message = stream.readString(exception);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void serializeToStream(AbstractSerializedData stream) {
|
||||||
|
stream.writeInt32(constructor);
|
||||||
|
flags = proxy ? (flags | 1) : (flags &~ 1);
|
||||||
|
stream.writeInt32(flags);
|
||||||
|
stream.writeInt32(expires);
|
||||||
|
peer.serializeToStream(stream);
|
||||||
|
stream.writeInt32(0x1cb5c415);
|
||||||
|
int 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);
|
||||||
|
}
|
||||||
|
if ((flags & 2) != 0) {
|
||||||
|
stream.writeString(psa_type);
|
||||||
|
}
|
||||||
|
if ((flags & 4) != 0) {
|
||||||
|
stream.writeString(psa_message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class TL_help_promoDataEmpty extends help_PromoData {
|
||||||
|
public static int constructor = 0x98f6ac75;
|
||||||
|
|
||||||
|
public int expires;
|
||||||
|
|
||||||
|
public void readParams(AbstractSerializedData stream, boolean exception) {
|
||||||
|
expires = stream.readInt32(exception);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void serializeToStream(AbstractSerializedData stream) {
|
||||||
|
stream.writeInt32(constructor);
|
||||||
|
stream.writeInt32(expires);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static abstract class ChannelParticipant extends TLObject {
|
public static abstract class ChannelParticipant extends TLObject {
|
||||||
public int user_id;
|
public int user_id;
|
||||||
public int kicked_by;
|
public int kicked_by;
|
||||||
|
@ -31092,6 +31112,7 @@ public class TLRPC {
|
||||||
public String post_author;
|
public String post_author;
|
||||||
public Peer saved_from_peer;
|
public Peer saved_from_peer;
|
||||||
public int saved_from_msg_id;
|
public int saved_from_msg_id;
|
||||||
|
public String psa_type;
|
||||||
|
|
||||||
public static MessageFwdHeader TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) {
|
public static MessageFwdHeader TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) {
|
||||||
MessageFwdHeader result = null;
|
MessageFwdHeader result = null;
|
||||||
|
@ -31099,9 +31120,12 @@ public class TLRPC {
|
||||||
case 0xc786ddcb:
|
case 0xc786ddcb:
|
||||||
result = new TL_messageFwdHeader_layer68();
|
result = new TL_messageFwdHeader_layer68();
|
||||||
break;
|
break;
|
||||||
case 0xec338270:
|
case 0x353a686b:
|
||||||
result = new TL_messageFwdHeader();
|
result = new TL_messageFwdHeader();
|
||||||
break;
|
break;
|
||||||
|
case 0xec338270:
|
||||||
|
result = new TL_messageFwdHeader_layer112();
|
||||||
|
break;
|
||||||
case 0xfadff4ac:
|
case 0xfadff4ac:
|
||||||
result = new TL_messageFwdHeader_layer72();
|
result = new TL_messageFwdHeader_layer72();
|
||||||
break;
|
break;
|
||||||
|
@ -31154,6 +31178,70 @@ public class TLRPC {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class TL_messageFwdHeader extends MessageFwdHeader {
|
public static class TL_messageFwdHeader extends MessageFwdHeader {
|
||||||
|
public static int constructor = 0x353a686b;
|
||||||
|
|
||||||
|
|
||||||
|
public void readParams(AbstractSerializedData stream, boolean exception) {
|
||||||
|
flags = stream.readInt32(exception);
|
||||||
|
if ((flags & 1) != 0) {
|
||||||
|
from_id = stream.readInt32(exception);
|
||||||
|
}
|
||||||
|
if ((flags & 32) != 0) {
|
||||||
|
from_name = stream.readString(exception);
|
||||||
|
}
|
||||||
|
date = stream.readInt32(exception);
|
||||||
|
if ((flags & 2) != 0) {
|
||||||
|
channel_id = stream.readInt32(exception);
|
||||||
|
}
|
||||||
|
if ((flags & 4) != 0) {
|
||||||
|
channel_post = stream.readInt32(exception);
|
||||||
|
}
|
||||||
|
if ((flags & 8) != 0) {
|
||||||
|
post_author = stream.readString(exception);
|
||||||
|
}
|
||||||
|
if ((flags & 16) != 0) {
|
||||||
|
saved_from_peer = Peer.TLdeserialize(stream, stream.readInt32(exception), exception);
|
||||||
|
}
|
||||||
|
if ((flags & 16) != 0) {
|
||||||
|
saved_from_msg_id = stream.readInt32(exception);
|
||||||
|
}
|
||||||
|
if ((flags & 64) != 0) {
|
||||||
|
psa_type = stream.readString(exception);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void serializeToStream(AbstractSerializedData stream) {
|
||||||
|
stream.writeInt32(constructor);
|
||||||
|
stream.writeInt32(flags);
|
||||||
|
if ((flags & 1) != 0) {
|
||||||
|
stream.writeInt32(from_id);
|
||||||
|
}
|
||||||
|
if ((flags & 32) != 0) {
|
||||||
|
stream.writeString(from_name);
|
||||||
|
}
|
||||||
|
stream.writeInt32(date);
|
||||||
|
if ((flags & 2) != 0) {
|
||||||
|
stream.writeInt32(channel_id);
|
||||||
|
}
|
||||||
|
if ((flags & 4) != 0) {
|
||||||
|
stream.writeInt32(channel_post);
|
||||||
|
}
|
||||||
|
if ((flags & 8) != 0) {
|
||||||
|
stream.writeString(post_author);
|
||||||
|
}
|
||||||
|
if ((flags & 16) != 0) {
|
||||||
|
saved_from_peer.serializeToStream(stream);
|
||||||
|
}
|
||||||
|
if ((flags & 16) != 0) {
|
||||||
|
stream.writeInt32(saved_from_msg_id);
|
||||||
|
}
|
||||||
|
if ((flags & 64) != 0) {
|
||||||
|
stream.writeString(psa_type);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class TL_messageFwdHeader_layer112 extends TL_messageFwdHeader {
|
||||||
public static int constructor = 0xec338270;
|
public static int constructor = 0xec338270;
|
||||||
|
|
||||||
|
|
||||||
|
@ -35258,6 +35346,34 @@ public class TLRPC {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static class TL_help_getPromoData extends TLObject {
|
||||||
|
public static int constructor = 0xc0977421;
|
||||||
|
|
||||||
|
|
||||||
|
public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) {
|
||||||
|
return help_PromoData.TLdeserialize(stream, constructor, exception);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void serializeToStream(AbstractSerializedData stream) {
|
||||||
|
stream.writeInt32(constructor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class TL_help_hidePromoData extends TLObject {
|
||||||
|
public static int constructor = 0x1e251c95;
|
||||||
|
|
||||||
|
public InputPeer peer;
|
||||||
|
|
||||||
|
public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) {
|
||||||
|
return Bool.TLdeserialize(stream, constructor, exception);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void serializeToStream(AbstractSerializedData stream) {
|
||||||
|
stream.writeInt32(constructor);
|
||||||
|
peer.serializeToStream(stream);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static class TL_messages_readHistory extends TLObject {
|
public static class TL_messages_readHistory extends TLObject {
|
||||||
public static int constructor = 0xe306d3a;
|
public static int constructor = 0xe306d3a;
|
||||||
|
|
||||||
|
@ -39228,19 +39344,6 @@ public class TLRPC {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class TL_help_getProxyData extends TLObject {
|
|
||||||
public static int constructor = 0x3d7758e1;
|
|
||||||
|
|
||||||
|
|
||||||
public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) {
|
|
||||||
return help_ProxyData.TLdeserialize(stream, constructor, exception);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void serializeToStream(AbstractSerializedData stream) {
|
|
||||||
stream.writeInt32(constructor);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class TL_help_getDeepLinkInfo extends TLObject {
|
public static class TL_help_getDeepLinkInfo extends TLObject {
|
||||||
public static int constructor = 0x3fedc75f;
|
public static int constructor = 0x3fedc75f;
|
||||||
|
|
||||||
|
|
|
@ -1995,7 +1995,9 @@ public class Theme {
|
||||||
public static RLottieDrawable dialogs_unarchiveDrawable;
|
public static RLottieDrawable dialogs_unarchiveDrawable;
|
||||||
public static RLottieDrawable dialogs_pinArchiveDrawable;
|
public static RLottieDrawable dialogs_pinArchiveDrawable;
|
||||||
public static RLottieDrawable dialogs_unpinArchiveDrawable;
|
public static RLottieDrawable dialogs_unpinArchiveDrawable;
|
||||||
|
public static RLottieDrawable dialogs_hidePsaDrawable;
|
||||||
public static boolean dialogs_archiveDrawableRecolored;
|
public static boolean dialogs_archiveDrawableRecolored;
|
||||||
|
public static boolean dialogs_hidePsaDrawableRecolored;
|
||||||
public static boolean dialogs_archiveAvatarDrawableRecolored;
|
public static boolean dialogs_archiveAvatarDrawableRecolored;
|
||||||
private static int dialogs_holidayDrawableOffsetX;
|
private static int dialogs_holidayDrawableOffsetX;
|
||||||
private static int dialogs_holidayDrawableOffsetY;
|
private static int dialogs_holidayDrawableOffsetY;
|
||||||
|
@ -2121,6 +2123,7 @@ public class Theme {
|
||||||
public static Drawable[] chat_pollCheckDrawable = new Drawable[2];
|
public static Drawable[] chat_pollCheckDrawable = new Drawable[2];
|
||||||
public static Drawable[] chat_pollCrossDrawable = new Drawable[2];
|
public static Drawable[] chat_pollCrossDrawable = new Drawable[2];
|
||||||
public static Drawable[] chat_pollHintDrawable = new Drawable[2];
|
public static Drawable[] chat_pollHintDrawable = new Drawable[2];
|
||||||
|
public static Drawable[] chat_psaHelpDrawable = new Drawable[2];
|
||||||
|
|
||||||
public static Drawable chat_msgCallUpGreenDrawable;
|
public static Drawable chat_msgCallUpGreenDrawable;
|
||||||
public static Drawable chat_msgCallDownRedDrawable;
|
public static Drawable chat_msgCallDownRedDrawable;
|
||||||
|
@ -2508,6 +2511,8 @@ public class Theme {
|
||||||
public static final String key_chat_botProgress = "chat_botProgress";
|
public static final String key_chat_botProgress = "chat_botProgress";
|
||||||
public static final String key_chat_inForwardedNameText = "chat_inForwardedNameText";
|
public static final String key_chat_inForwardedNameText = "chat_inForwardedNameText";
|
||||||
public static final String key_chat_outForwardedNameText = "chat_outForwardedNameText";
|
public static final String key_chat_outForwardedNameText = "chat_outForwardedNameText";
|
||||||
|
public static final String key_chat_inPsaNameText = "chat_inPsaNameText";
|
||||||
|
public static final String key_chat_outPsaNameText = "chat_outPsaNameText";
|
||||||
public static final String key_chat_inViaBotNameText = "chat_inViaBotNameText";
|
public static final String key_chat_inViaBotNameText = "chat_inViaBotNameText";
|
||||||
public static final String key_chat_outViaBotNameText = "chat_outViaBotNameText";
|
public static final String key_chat_outViaBotNameText = "chat_outViaBotNameText";
|
||||||
public static final String key_chat_stickerViaBotNameText = "chat_stickerViaBotNameText";
|
public static final String key_chat_stickerViaBotNameText = "chat_stickerViaBotNameText";
|
||||||
|
@ -3218,6 +3223,8 @@ public class Theme {
|
||||||
defaultColors.put(key_chat_botProgress, 0xffffffff);
|
defaultColors.put(key_chat_botProgress, 0xffffffff);
|
||||||
defaultColors.put(key_chat_inForwardedNameText, 0xff3886c7);
|
defaultColors.put(key_chat_inForwardedNameText, 0xff3886c7);
|
||||||
defaultColors.put(key_chat_outForwardedNameText, 0xff55ab4f);
|
defaultColors.put(key_chat_outForwardedNameText, 0xff55ab4f);
|
||||||
|
defaultColors.put(key_chat_inPsaNameText, 0xff5a9c39);
|
||||||
|
defaultColors.put(key_chat_outPsaNameText, 0xff5a9c39);
|
||||||
defaultColors.put(key_chat_inViaBotNameText, 0xff3a8ccf);
|
defaultColors.put(key_chat_inViaBotNameText, 0xff3a8ccf);
|
||||||
defaultColors.put(key_chat_outViaBotNameText, 0xff55ab4f);
|
defaultColors.put(key_chat_outViaBotNameText, 0xff55ab4f);
|
||||||
defaultColors.put(key_chat_stickerViaBotNameText, 0xffffffff);
|
defaultColors.put(key_chat_stickerViaBotNameText, 0xffffffff);
|
||||||
|
@ -3707,6 +3714,9 @@ public class Theme {
|
||||||
fallbackKeys.put(key_chat_attachLocationText, key_chat_attachLocationBackground);
|
fallbackKeys.put(key_chat_attachLocationText, key_chat_attachLocationBackground);
|
||||||
fallbackKeys.put(key_chat_attachPollText, key_chat_attachPollBackground);
|
fallbackKeys.put(key_chat_attachPollText, key_chat_attachPollBackground);
|
||||||
|
|
||||||
|
fallbackKeys.put(key_chat_inPsaNameText, key_avatar_nameInMessageGreen);
|
||||||
|
fallbackKeys.put(key_chat_outPsaNameText, key_avatar_nameInMessageGreen);
|
||||||
|
|
||||||
themeAccentExclusionKeys.addAll(Arrays.asList(keys_avatar_background));
|
themeAccentExclusionKeys.addAll(Arrays.asList(keys_avatar_background));
|
||||||
themeAccentExclusionKeys.addAll(Arrays.asList(keys_avatar_nameInMessage));
|
themeAccentExclusionKeys.addAll(Arrays.asList(keys_avatar_nameInMessage));
|
||||||
themeAccentExclusionKeys.add(key_chat_attachFileBackground);
|
themeAccentExclusionKeys.add(key_chat_attachFileBackground);
|
||||||
|
@ -6403,11 +6413,15 @@ public class Theme {
|
||||||
if (dialogs_unpinArchiveDrawable != null) {
|
if (dialogs_unpinArchiveDrawable != null) {
|
||||||
dialogs_unpinArchiveDrawable.recycle();
|
dialogs_unpinArchiveDrawable.recycle();
|
||||||
}
|
}
|
||||||
|
if (dialogs_hidePsaDrawable != null) {
|
||||||
|
dialogs_hidePsaDrawable.recycle();
|
||||||
|
}
|
||||||
dialogs_archiveAvatarDrawable = new RLottieDrawable(R.raw.chats_archiveavatar, "chats_archiveavatar", AndroidUtilities.dp(36), AndroidUtilities.dp(36), false, null);
|
dialogs_archiveAvatarDrawable = new RLottieDrawable(R.raw.chats_archiveavatar, "chats_archiveavatar", AndroidUtilities.dp(36), AndroidUtilities.dp(36), false, null);
|
||||||
dialogs_archiveDrawable = new RLottieDrawable(R.raw.chats_archive, "chats_archive", AndroidUtilities.dp(36), AndroidUtilities.dp(36));
|
dialogs_archiveDrawable = new RLottieDrawable(R.raw.chats_archive, "chats_archive", AndroidUtilities.dp(36), AndroidUtilities.dp(36));
|
||||||
dialogs_unarchiveDrawable = new RLottieDrawable(R.raw.chats_unarchive, "chats_unarchive", AndroidUtilities.dp(AndroidUtilities.dp(36)), AndroidUtilities.dp(36));
|
dialogs_unarchiveDrawable = new RLottieDrawable(R.raw.chats_unarchive, "chats_unarchive", AndroidUtilities.dp(AndroidUtilities.dp(36)), AndroidUtilities.dp(36));
|
||||||
dialogs_pinArchiveDrawable = new RLottieDrawable(R.raw.chats_hide, "chats_hide", AndroidUtilities.dp(36), AndroidUtilities.dp(36));
|
dialogs_pinArchiveDrawable = new RLottieDrawable(R.raw.chats_hide, "chats_hide", AndroidUtilities.dp(36), AndroidUtilities.dp(36));
|
||||||
dialogs_unpinArchiveDrawable = new RLottieDrawable(R.raw.chats_unhide, "chats_unhide", AndroidUtilities.dp(36), AndroidUtilities.dp(36));
|
dialogs_unpinArchiveDrawable = new RLottieDrawable(R.raw.chats_unhide, "chats_unhide", AndroidUtilities.dp(36), AndroidUtilities.dp(36));
|
||||||
|
dialogs_hidePsaDrawable = new RLottieDrawable(R.raw.chat_audio_record_delete, "chats_psahide", AndroidUtilities.dp(30), AndroidUtilities.dp(30));
|
||||||
|
|
||||||
applyCommonTheme();
|
applyCommonTheme();
|
||||||
}
|
}
|
||||||
|
@ -6443,6 +6457,15 @@ public class Theme {
|
||||||
dialogs_unpinArchiveDrawable.setLayerColor("Line.**", getNonAnimatedColor(key_chats_archiveIcon));
|
dialogs_unpinArchiveDrawable.setLayerColor("Line.**", getNonAnimatedColor(key_chats_archiveIcon));
|
||||||
dialogs_unpinArchiveDrawable.commitApplyLayerColors();
|
dialogs_unpinArchiveDrawable.commitApplyLayerColors();
|
||||||
|
|
||||||
|
dialogs_hidePsaDrawable.beginApplyLayerColors();
|
||||||
|
dialogs_hidePsaDrawable.setLayerColor("Line 1.**", getNonAnimatedColor(key_chats_archiveBackground));
|
||||||
|
dialogs_hidePsaDrawable.setLayerColor("Line 2.**", getNonAnimatedColor(key_chats_archiveBackground));
|
||||||
|
dialogs_hidePsaDrawable.setLayerColor("Line 3.**", getNonAnimatedColor(key_chats_archiveBackground));
|
||||||
|
dialogs_hidePsaDrawable.setLayerColor("Cup Red.**", getNonAnimatedColor(key_chats_archiveIcon));
|
||||||
|
dialogs_hidePsaDrawable.setLayerColor("Box.**", getNonAnimatedColor(key_chats_archiveIcon));
|
||||||
|
dialogs_hidePsaDrawable.commitApplyLayerColors();
|
||||||
|
dialogs_hidePsaDrawableRecolored = false;
|
||||||
|
|
||||||
dialogs_archiveDrawable.beginApplyLayerColors();
|
dialogs_archiveDrawable.beginApplyLayerColors();
|
||||||
dialogs_archiveDrawable.setLayerColor("Arrow.**", getNonAnimatedColor(key_chats_archiveBackground));
|
dialogs_archiveDrawable.setLayerColor("Arrow.**", getNonAnimatedColor(key_chats_archiveBackground));
|
||||||
dialogs_archiveDrawable.setLayerColor("Box2.**", getNonAnimatedColor(key_chats_archiveIcon));
|
dialogs_archiveDrawable.setLayerColor("Box2.**", getNonAnimatedColor(key_chats_archiveIcon));
|
||||||
|
@ -6730,6 +6753,7 @@ public class Theme {
|
||||||
chat_pollCheckDrawable[a] = resources.getDrawable(R.drawable.poll_right).mutate();
|
chat_pollCheckDrawable[a] = resources.getDrawable(R.drawable.poll_right).mutate();
|
||||||
chat_pollCrossDrawable[a] = resources.getDrawable(R.drawable.poll_wrong).mutate();
|
chat_pollCrossDrawable[a] = resources.getDrawable(R.drawable.poll_wrong).mutate();
|
||||||
chat_pollHintDrawable[a] = resources.getDrawable(R.drawable.smiles_panel_objects).mutate();
|
chat_pollHintDrawable[a] = resources.getDrawable(R.drawable.smiles_panel_objects).mutate();
|
||||||
|
chat_psaHelpDrawable[a] = resources.getDrawable(R.drawable.msg_psa).mutate();
|
||||||
}
|
}
|
||||||
|
|
||||||
calllog_msgCallUpRedDrawable = resources.getDrawable(R.drawable.ic_call_made_green_18dp).mutate();
|
calllog_msgCallUpRedDrawable = resources.getDrawable(R.drawable.ic_call_made_green_18dp).mutate();
|
||||||
|
@ -7111,6 +7135,9 @@ public class Theme {
|
||||||
setDrawableColor(chat_pollHintDrawable[0], getColor(key_chat_inPreviewInstantText));
|
setDrawableColor(chat_pollHintDrawable[0], getColor(key_chat_inPreviewInstantText));
|
||||||
setDrawableColor(chat_pollHintDrawable[1], getColor(key_chat_outPreviewInstantText));
|
setDrawableColor(chat_pollHintDrawable[1], getColor(key_chat_outPreviewInstantText));
|
||||||
|
|
||||||
|
setDrawableColor(chat_psaHelpDrawable[0], getColor(key_chat_inViews));
|
||||||
|
setDrawableColor(chat_psaHelpDrawable[1], getColor(key_chat_outViews));
|
||||||
|
|
||||||
setDrawableColorByKey(chat_composeShadowDrawable, key_chat_messagePanelShadow);
|
setDrawableColorByKey(chat_composeShadowDrawable, key_chat_messagePanelShadow);
|
||||||
|
|
||||||
int color = getColor(key_chat_outAudioSeekbarFill);
|
int color = getColor(key_chat_outAudioSeekbarFill);
|
||||||
|
|
|
@ -177,7 +177,7 @@ public class DialogsSearchAdapter extends RecyclerListView.SelectionAdapter {
|
||||||
searchResultMessages.clear();
|
searchResultMessages.clear();
|
||||||
}
|
}
|
||||||
searchWas = true;
|
searchWas = true;
|
||||||
if (!searchAdapterHelper.isSearchInProgress() && delegate != null) {
|
if (!searchAdapterHelper.isSearchInProgress() && delegate != null && reqId == 0) {
|
||||||
delegate.searchStateChanged(false);
|
delegate.searchStateChanged(false);
|
||||||
}
|
}
|
||||||
notifyDataSetChanged();
|
notifyDataSetChanged();
|
||||||
|
@ -220,6 +220,9 @@ public class DialogsSearchAdapter extends RecyclerListView.SelectionAdapter {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void loadMoreSearchMessages() {
|
public void loadMoreSearchMessages() {
|
||||||
|
if (reqId != 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
searchMessagesInternal(lastMessagesSearchString, lastMessagesSearchId);
|
searchMessagesInternal(lastMessagesSearchString, lastMessagesSearchId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -315,10 +318,10 @@ public class DialogsSearchAdapter extends RecyclerListView.SelectionAdapter {
|
||||||
notifyDataSetChanged();
|
notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (delegate != null) {
|
reqId = 0;
|
||||||
|
if (!searchAdapterHelper.isSearchInProgress() && delegate != null) {
|
||||||
delegate.searchStateChanged(false);
|
delegate.searchStateChanged(false);
|
||||||
}
|
}
|
||||||
reqId = 0;
|
|
||||||
}), ConnectionsManager.RequestFlagFailOnServerErrors);
|
}), ConnectionsManager.RequestFlagFailOnServerErrors);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -175,7 +175,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||||
default void didPressInstantButton(ChatMessageCell cell, int type) {
|
default void didPressInstantButton(ChatMessageCell cell, int type) {
|
||||||
}
|
}
|
||||||
|
|
||||||
default void didPressPollHint(ChatMessageCell cell, int x, int y) {
|
default void didPressHint(ChatMessageCell cell, int type) {
|
||||||
}
|
}
|
||||||
|
|
||||||
default String getAdminRank(int uid) {
|
default String getAdminRank(int uid) {
|
||||||
|
@ -327,6 +327,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||||
private int noSoundCenterX;
|
private int noSoundCenterX;
|
||||||
private int forwardNameCenterX;
|
private int forwardNameCenterX;
|
||||||
private long lastAnimationTime;
|
private long lastAnimationTime;
|
||||||
|
private long lastNamesAnimationTime;
|
||||||
private int documentAttachType;
|
private int documentAttachType;
|
||||||
private TLRPC.Document documentAttach;
|
private TLRPC.Document documentAttach;
|
||||||
private boolean drawPhotoImage;
|
private boolean drawPhotoImage;
|
||||||
|
@ -495,6 +496,13 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||||
private boolean hintButtonVisible;
|
private boolean hintButtonVisible;
|
||||||
private float hintButtonProgress;
|
private float hintButtonProgress;
|
||||||
|
|
||||||
|
private boolean hasPsaHint;
|
||||||
|
private int psaHelpX;
|
||||||
|
private int psaHelpY;
|
||||||
|
private boolean psaHintPressed;
|
||||||
|
private boolean psaButtonVisible;
|
||||||
|
private float psaButtonProgress;
|
||||||
|
|
||||||
private TLRPC.TL_messageReactions lastReactions;
|
private TLRPC.TL_messageReactions lastReactions;
|
||||||
|
|
||||||
private boolean autoPlayingMedia;
|
private boolean autoPlayingMedia;
|
||||||
|
@ -1255,7 +1263,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||||
if (event.getAction() == MotionEvent.ACTION_UP) {
|
if (event.getAction() == MotionEvent.ACTION_UP) {
|
||||||
if (pollHintPressed) {
|
if (pollHintPressed) {
|
||||||
playSoundEffect(SoundEffectConstants.CLICK);
|
playSoundEffect(SoundEffectConstants.CLICK);
|
||||||
delegate.didPressPollHint(this, pollHintX + AndroidUtilities.dp(12), pollHintY);
|
delegate.didPressHint(this, 0);
|
||||||
pollHintPressed = false;
|
pollHintPressed = false;
|
||||||
if (Build.VERSION.SDK_INT >= 21 && selectorDrawable != null) {
|
if (Build.VERSION.SDK_INT >= 21 && selectorDrawable != null) {
|
||||||
selectorDrawable.setState(StateSet.NOTHING);
|
selectorDrawable.setState(StateSet.NOTHING);
|
||||||
|
@ -1691,6 +1699,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||||
pressedBotButton = -1;
|
pressedBotButton = -1;
|
||||||
pressedVoteButton = -1;
|
pressedVoteButton = -1;
|
||||||
pollHintPressed = false;
|
pollHintPressed = false;
|
||||||
|
psaHintPressed = false;
|
||||||
linkPreviewPressed = false;
|
linkPreviewPressed = false;
|
||||||
otherPressed = false;
|
otherPressed = false;
|
||||||
sharePressed = false;
|
sharePressed = false;
|
||||||
|
@ -1720,6 +1729,17 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||||
if (isAvatarVisible && avatarImage.isInsideImage(x, y + getTop())) {
|
if (isAvatarVisible && avatarImage.isInsideImage(x, y + getTop())) {
|
||||||
avatarPressed = true;
|
avatarPressed = true;
|
||||||
result = true;
|
result = true;
|
||||||
|
} else if (psaButtonVisible && psaHelpX != -1 && x >= psaHelpX && x <= psaHelpX + AndroidUtilities.dp(40) && y >= psaHelpY && y <= psaHelpY + AndroidUtilities.dp(40)) {
|
||||||
|
psaHintPressed = true;
|
||||||
|
createSelectorDrawable();
|
||||||
|
selectorDrawableMaskType = 3;
|
||||||
|
if (Build.VERSION.SDK_INT >= 21 && selectorDrawable != null) {
|
||||||
|
selectorDrawable.setBounds(psaHelpX - AndroidUtilities.dp(8), psaHelpY - AndroidUtilities.dp(8), psaHelpX + AndroidUtilities.dp(32), psaHelpY + AndroidUtilities.dp(32));
|
||||||
|
selectorDrawable.setState(pressedState);
|
||||||
|
selectorDrawable.setHotspot(x, y);
|
||||||
|
}
|
||||||
|
result = true;
|
||||||
|
invalidate();
|
||||||
} else if (drawForwardedName && forwardedNameLayout[0] != null && x >= forwardNameX && x <= forwardNameX + forwardedNameWidth && y >= forwardNameY && y <= forwardNameY + AndroidUtilities.dp(32)) {
|
} else if (drawForwardedName && forwardedNameLayout[0] != null && x >= forwardNameX && x <= forwardNameX + forwardedNameWidth && y >= forwardNameY && y <= forwardNameY + AndroidUtilities.dp(32)) {
|
||||||
if (viaWidth != 0 && x >= forwardNameX + viaNameWidth + AndroidUtilities.dp(4)) {
|
if (viaWidth != 0 && x >= forwardNameX + viaNameWidth + AndroidUtilities.dp(4)) {
|
||||||
forwardBotPressed = true;
|
forwardBotPressed = true;
|
||||||
|
@ -1782,6 +1802,16 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||||
avatarPressed = false;
|
avatarPressed = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else if (psaHintPressed) {
|
||||||
|
if (event.getAction() == MotionEvent.ACTION_UP) {
|
||||||
|
playSoundEffect(SoundEffectConstants.CLICK);
|
||||||
|
delegate.didPressHint(this, 1);
|
||||||
|
psaHintPressed = false;
|
||||||
|
if (Build.VERSION.SDK_INT >= 21 && selectorDrawable != null) {
|
||||||
|
selectorDrawable.setState(StateSet.NOTHING);
|
||||||
|
}
|
||||||
|
invalidate();
|
||||||
|
}
|
||||||
} else if (forwardNamePressed) {
|
} else if (forwardNamePressed) {
|
||||||
if (event.getAction() == MotionEvent.ACTION_UP) {
|
if (event.getAction() == MotionEvent.ACTION_UP) {
|
||||||
forwardNamePressed = false;
|
forwardNamePressed = false;
|
||||||
|
@ -2614,6 +2644,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||||
pressedBotButton = -1;
|
pressedBotButton = -1;
|
||||||
pressedVoteButton = -1;
|
pressedVoteButton = -1;
|
||||||
pollHintPressed = false;
|
pollHintPressed = false;
|
||||||
|
psaHintPressed = false;
|
||||||
linkPreviewHeight = 0;
|
linkPreviewHeight = 0;
|
||||||
mediaOffsetY = 0;
|
mediaOffsetY = 0;
|
||||||
documentAttachType = DOCUMENT_ATTACH_TYPE_NONE;
|
documentAttachType = DOCUMENT_ATTACH_TYPE_NONE;
|
||||||
|
@ -2660,6 +2691,10 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||||
imageBackgroundGradientRotation = 45;
|
imageBackgroundGradientRotation = 45;
|
||||||
imageBackgroundSideColor = 0;
|
imageBackgroundSideColor = 0;
|
||||||
mediaBackground = false;
|
mediaBackground = false;
|
||||||
|
hasPsaHint = messageObject.messageOwner.fwd_from != null && !TextUtils.isEmpty(messageObject.messageOwner.fwd_from.psa_type);
|
||||||
|
if (hasPsaHint) {
|
||||||
|
createSelectorDrawable();
|
||||||
|
}
|
||||||
photoImage.setAlpha(1.0f);
|
photoImage.setAlpha(1.0f);
|
||||||
if (messageChanged || dataChanged) {
|
if (messageChanged || dataChanged) {
|
||||||
pollButtons.clear();
|
pollButtons.clear();
|
||||||
|
@ -5211,16 +5246,11 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||||
imagePressed = false;
|
imagePressed = false;
|
||||||
gamePreviewPressed = false;
|
gamePreviewPressed = false;
|
||||||
|
|
||||||
if (instantPressed) {
|
if (pressedVoteButton != -1 || pollHintPressed || psaHintPressed || instantPressed) {
|
||||||
instantPressed = instantButtonPressed = false;
|
instantPressed = instantButtonPressed = false;
|
||||||
if (Build.VERSION.SDK_INT >= 21 && selectorDrawable != null) {
|
|
||||||
selectorDrawable.setState(StateSet.NOTHING);
|
|
||||||
}
|
|
||||||
invalidate();
|
|
||||||
}
|
|
||||||
if (pressedVoteButton != -1 || pollHintPressed) {
|
|
||||||
pressedVoteButton = -1;
|
pressedVoteButton = -1;
|
||||||
pollHintPressed = false;
|
pollHintPressed = false;
|
||||||
|
psaHintPressed = false;
|
||||||
if (Build.VERSION.SDK_INT >= 21 && selectorDrawable != null) {
|
if (Build.VERSION.SDK_INT >= 21 && selectorDrawable != null) {
|
||||||
selectorDrawable.setState(StateSet.NOTHING);
|
selectorDrawable.setState(StateSet.NOTHING);
|
||||||
}
|
}
|
||||||
|
@ -5231,15 +5261,28 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void showPollHintButton(boolean show, boolean animated) {
|
public void showHintButton(boolean show, boolean animated, int type) {
|
||||||
if (hintButtonVisible == show) {
|
if (type == -1 || type == 0) {
|
||||||
return;
|
if (hintButtonVisible == show) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
hintButtonVisible = show;
|
||||||
|
if (!animated) {
|
||||||
|
hintButtonProgress = show ? 1.0f : 0.0f;
|
||||||
|
} else {
|
||||||
|
invalidate();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
hintButtonVisible = show;
|
if (type == -1 || type == 1) {
|
||||||
if (!animated) {
|
if (psaButtonVisible == show) {
|
||||||
hintButtonProgress = show ? 1.0f : 0.0f;
|
return;
|
||||||
} else {
|
}
|
||||||
invalidate();
|
psaButtonVisible = show;
|
||||||
|
if (!animated) {
|
||||||
|
psaButtonProgress = show ? 1.0f : 0.0f;
|
||||||
|
} else {
|
||||||
|
invalidate();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5678,6 +5721,12 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||||
if (Build.VERSION.SDK_INT < 21) {
|
if (Build.VERSION.SDK_INT < 21) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
int color;
|
||||||
|
if (psaHintPressed) {
|
||||||
|
color = Theme.getColor(currentMessageObject.isOutOwner() ? Theme.key_chat_outViews : Theme.key_chat_inViews);
|
||||||
|
} else {
|
||||||
|
color = Theme.getColor(currentMessageObject.isOutOwner() ? Theme.key_chat_outPreviewInstantText : Theme.key_chat_inPreviewInstantText);
|
||||||
|
}
|
||||||
if (selectorDrawable == null) {
|
if (selectorDrawable == null) {
|
||||||
final Paint maskPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
|
final Paint maskPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
|
||||||
maskPaint.setColor(0xffffffff);
|
maskPaint.setColor(0xffffffff);
|
||||||
|
@ -5741,7 +5790,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||||
selectorDrawable = new RippleDrawable(colorStateList, null, maskDrawable);
|
selectorDrawable = new RippleDrawable(colorStateList, null, maskDrawable);
|
||||||
selectorDrawable.setCallback(this);
|
selectorDrawable.setCallback(this);
|
||||||
} else {
|
} else {
|
||||||
Theme.setSelectorDrawableColor(selectorDrawable, Theme.getColor(currentMessageObject.isOutOwner() ? Theme.key_chat_outPreviewInstantText : Theme.key_chat_inPreviewInstantText) & 0x19ffffff, true);
|
Theme.setSelectorDrawableColor(selectorDrawable, color & 0x19ffffff, true);
|
||||||
}
|
}
|
||||||
selectorDrawable.setVisible(true, false);
|
selectorDrawable.setVisible(true, false);
|
||||||
}
|
}
|
||||||
|
@ -8136,7 +8185,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||||
|
|
||||||
boolean authorName = (!pinnedTop || ChatObject.isChannel(currentChat) && !currentChat.megagroup) && drawName && isChat && !currentMessageObject.isOutOwner();
|
boolean authorName = (!pinnedTop || ChatObject.isChannel(currentChat) && !currentChat.megagroup) && drawName && isChat && !currentMessageObject.isOutOwner();
|
||||||
boolean viaBot = (messageObject.messageOwner.fwd_from == null || messageObject.type == 14) && viaUsername != null;
|
boolean viaBot = (messageObject.messageOwner.fwd_from == null || messageObject.type == 14) && viaUsername != null;
|
||||||
if (authorName || viaBot) {
|
if (!hasPsaHint && (authorName || viaBot)) {
|
||||||
drawNameLayout = true;
|
drawNameLayout = true;
|
||||||
nameWidth = getMaxNameWidth();
|
nameWidth = getMaxNameWidth();
|
||||||
if (nameWidth < 0) {
|
if (nameWidth < 0) {
|
||||||
|
@ -8260,6 +8309,10 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||||
}
|
}
|
||||||
|
|
||||||
forwardedNameWidth = getMaxNameWidth();
|
forwardedNameWidth = getMaxNameWidth();
|
||||||
|
String forwardedString = getForwardedMessageText(messageObject);
|
||||||
|
if (hasPsaHint) {
|
||||||
|
forwardedNameWidth -= AndroidUtilities.dp(36);
|
||||||
|
}
|
||||||
String from = LocaleController.getString("From", R.string.From);
|
String from = LocaleController.getString("From", R.string.From);
|
||||||
String fromFormattedString = LocaleController.getString("FromFormatted", R.string.FromFormatted);
|
String fromFormattedString = LocaleController.getString("FromFormatted", R.string.FromFormatted);
|
||||||
int idx = fromFormattedString.indexOf("%1$s");
|
int idx = fromFormattedString.indexOf("%1$s");
|
||||||
|
@ -8288,9 +8341,12 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||||
lastLine = TextUtils.ellipsize(lastLine, Theme.chat_forwardNamePaint, forwardedNameWidth, TextUtils.TruncateAt.END);
|
lastLine = TextUtils.ellipsize(lastLine, Theme.chat_forwardNamePaint, forwardedNameWidth, TextUtils.TruncateAt.END);
|
||||||
try {
|
try {
|
||||||
forwardedNameLayout[1] = new StaticLayout(lastLine, Theme.chat_forwardNamePaint, forwardedNameWidth + AndroidUtilities.dp(2), Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false);
|
forwardedNameLayout[1] = new StaticLayout(lastLine, Theme.chat_forwardNamePaint, forwardedNameWidth + AndroidUtilities.dp(2), Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false);
|
||||||
lastLine = TextUtils.ellipsize(AndroidUtilities.replaceTags(LocaleController.getString("ForwardedMessage", R.string.ForwardedMessage)), Theme.chat_forwardNamePaint, forwardedNameWidth, TextUtils.TruncateAt.END);
|
lastLine = TextUtils.ellipsize(AndroidUtilities.replaceTags(forwardedString), Theme.chat_forwardNamePaint, forwardedNameWidth, TextUtils.TruncateAt.END);
|
||||||
forwardedNameLayout[0] = new StaticLayout(lastLine, Theme.chat_forwardNamePaint, forwardedNameWidth + AndroidUtilities.dp(2), Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false);
|
forwardedNameLayout[0] = new StaticLayout(lastLine, Theme.chat_forwardNamePaint, forwardedNameWidth + AndroidUtilities.dp(2), Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false);
|
||||||
forwardedNameWidth = Math.max((int) Math.ceil(forwardedNameLayout[0].getLineWidth(0)), (int) Math.ceil(forwardedNameLayout[1].getLineWidth(0)));
|
forwardedNameWidth = Math.max((int) Math.ceil(forwardedNameLayout[0].getLineWidth(0)), (int) Math.ceil(forwardedNameLayout[1].getLineWidth(0)));
|
||||||
|
if (hasPsaHint) {
|
||||||
|
forwardedNameWidth += AndroidUtilities.dp(36);
|
||||||
|
}
|
||||||
forwardNameOffsetX[0] = forwardedNameLayout[0].getLineLeft(0);
|
forwardNameOffsetX[0] = forwardedNameLayout[0].getLineLeft(0);
|
||||||
forwardNameOffsetX[1] = forwardedNameLayout[1].getLineLeft(0);
|
forwardNameOffsetX[1] = forwardedNameLayout[1].getLineLeft(0);
|
||||||
if (messageObject.type != 5) {
|
if (messageObject.type != 5) {
|
||||||
|
@ -8424,7 +8480,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||||
} else if (currentForwardName != null) {
|
} else if (currentForwardName != null) {
|
||||||
currentForwardNameString = currentForwardName;
|
currentForwardNameString = currentForwardName;
|
||||||
}
|
}
|
||||||
name = LocaleController.getString("ForwardedMessage", R.string.ForwardedMessage);
|
name = getForwardedMessageText(messageObject);
|
||||||
String from = LocaleController.getString("From", R.string.From);
|
String from = LocaleController.getString("From", R.string.From);
|
||||||
String fromFormattedString = LocaleController.getString("FromFormatted", R.string.FromFormatted);
|
String fromFormattedString = LocaleController.getString("FromFormatted", R.string.FromFormatted);
|
||||||
int idx = fromFormattedString.indexOf("%1$s");
|
int idx = fromFormattedString.indexOf("%1$s");
|
||||||
|
@ -8493,6 +8549,18 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||||
requestLayout();
|
requestLayout();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String getForwardedMessageText(MessageObject messageObject) {
|
||||||
|
if (hasPsaHint) {
|
||||||
|
String forwardedString = LocaleController.getString("PsaMessage_" + messageObject.messageOwner.fwd_from.psa_type);
|
||||||
|
if (forwardedString == null) {
|
||||||
|
forwardedString = LocaleController.getString("PsaMessageDefault", R.string.PsaMessageDefault);
|
||||||
|
}
|
||||||
|
return forwardedString;
|
||||||
|
} else {
|
||||||
|
return LocaleController.getString("ForwardedMessage", R.string.ForwardedMessage);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public int getCaptionHeight() {
|
public int getCaptionHeight() {
|
||||||
return addedCaptionHeight;
|
return addedCaptionHeight;
|
||||||
}
|
}
|
||||||
|
@ -8909,6 +8977,13 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||||
}
|
}
|
||||||
|
|
||||||
public void drawNamesLayout(Canvas canvas) {
|
public void drawNamesLayout(Canvas canvas) {
|
||||||
|
long newAnimationTime = SystemClock.elapsedRealtime();
|
||||||
|
long dt = newAnimationTime - lastNamesAnimationTime;
|
||||||
|
if (dt > 17) {
|
||||||
|
dt = 17;
|
||||||
|
}
|
||||||
|
lastNamesAnimationTime = newAnimationTime;
|
||||||
|
|
||||||
if (drawNameLayout && nameLayout != null) {
|
if (drawNameLayout && nameLayout != null) {
|
||||||
canvas.save();
|
canvas.save();
|
||||||
|
|
||||||
|
@ -8989,10 +9064,18 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||||
} else {
|
} else {
|
||||||
forwardNameY = AndroidUtilities.dp(10 + (drawNameLayout ? 19 : 0));
|
forwardNameY = AndroidUtilities.dp(10 + (drawNameLayout ? 19 : 0));
|
||||||
if (currentMessageObject.isOutOwner()) {
|
if (currentMessageObject.isOutOwner()) {
|
||||||
Theme.chat_forwardNamePaint.setColor(Theme.getColor(Theme.key_chat_outForwardedNameText));
|
if (hasPsaHint) {
|
||||||
|
Theme.chat_forwardNamePaint.setColor(Theme.getColor(Theme.key_chat_outPsaNameText));
|
||||||
|
} else {
|
||||||
|
Theme.chat_forwardNamePaint.setColor(Theme.getColor(Theme.key_chat_outForwardedNameText));
|
||||||
|
}
|
||||||
forwardNameX = backgroundDrawableLeft + AndroidUtilities.dp(11) + getExtraTextX();
|
forwardNameX = backgroundDrawableLeft + AndroidUtilities.dp(11) + getExtraTextX();
|
||||||
} else {
|
} else {
|
||||||
Theme.chat_forwardNamePaint.setColor(Theme.getColor(Theme.key_chat_inForwardedNameText));
|
if (hasPsaHint) {
|
||||||
|
Theme.chat_forwardNamePaint.setColor(Theme.getColor(Theme.key_chat_inPsaNameText));
|
||||||
|
} else {
|
||||||
|
Theme.chat_forwardNamePaint.setColor(Theme.getColor(Theme.key_chat_inForwardedNameText));
|
||||||
|
}
|
||||||
if (mediaBackground) {
|
if (mediaBackground) {
|
||||||
forwardNameX = backgroundDrawableLeft + AndroidUtilities.dp(11) + getExtraTextX();
|
forwardNameX = backgroundDrawableLeft + AndroidUtilities.dp(11) + getExtraTextX();
|
||||||
} else {
|
} else {
|
||||||
|
@ -9006,6 +9089,46 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||||
forwardedNameLayout[a].draw(canvas);
|
forwardedNameLayout[a].draw(canvas);
|
||||||
canvas.restore();
|
canvas.restore();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (hasPsaHint) {
|
||||||
|
if (psaButtonVisible || psaButtonProgress > 0) {
|
||||||
|
Drawable drawable = Theme.chat_psaHelpDrawable[currentMessageObject.isOutOwner() ? 1 : 0];
|
||||||
|
if (pollVoteInProgress) {
|
||||||
|
drawable.setAlpha((int) (255 * pollAnimationProgress));
|
||||||
|
} else {
|
||||||
|
drawable.setAlpha(255);
|
||||||
|
}
|
||||||
|
psaHelpX = currentBackgroundDrawable.getBounds().right - drawable.getIntrinsicWidth() - AndroidUtilities.dp(currentMessageObject.isOutOwner() ? 20 : 14);
|
||||||
|
psaHelpY = forwardNameY + AndroidUtilities.dp(4);
|
||||||
|
int cx = psaHelpX + drawable.getIntrinsicWidth() / 2;
|
||||||
|
int cy = psaHelpY + drawable.getIntrinsicHeight() / 2;
|
||||||
|
float scale = psaButtonVisible && psaButtonProgress < 1 ? AnimationProperties.overshootInterpolator.getInterpolation(psaButtonProgress) : psaButtonProgress;
|
||||||
|
int w = (int) (drawable.getIntrinsicWidth() * scale);
|
||||||
|
int h = (int) (drawable.getIntrinsicHeight() * scale);
|
||||||
|
drawable.setBounds(cx - w / 2, cy - h / 2, cx + w / 2, cy + h / 2);
|
||||||
|
drawable.draw(canvas);
|
||||||
|
|
||||||
|
if (Build.VERSION.SDK_INT >= 21 && selectorDrawable != null && selectorDrawableMaskType == 3) {
|
||||||
|
canvas.save();
|
||||||
|
canvas.scale(psaButtonProgress, psaButtonProgress, selectorDrawable.getBounds().centerX(), selectorDrawable.getBounds().centerY());
|
||||||
|
selectorDrawable.draw(canvas);
|
||||||
|
canvas.restore();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (psaButtonVisible && psaButtonProgress < 1.0f) {
|
||||||
|
psaButtonProgress += dt / 180.0f;
|
||||||
|
if (psaButtonProgress > 1.0f) {
|
||||||
|
psaButtonProgress = 1.0f;
|
||||||
|
}
|
||||||
|
invalidate();
|
||||||
|
} else if (!psaButtonVisible && psaButtonProgress > 0.0f) {
|
||||||
|
psaButtonProgress -= dt / 180.0f;
|
||||||
|
if (psaButtonProgress < 0.0f) {
|
||||||
|
psaButtonProgress = 0.0f;
|
||||||
|
}
|
||||||
|
invalidate();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (replyNameLayout != null) {
|
if (replyNameLayout != null) {
|
||||||
|
|
|
@ -152,6 +152,8 @@ public class DialogCell extends BaseCell {
|
||||||
private int timeTop;
|
private int timeTop;
|
||||||
private StaticLayout timeLayout;
|
private StaticLayout timeLayout;
|
||||||
|
|
||||||
|
private boolean promoDialog;
|
||||||
|
|
||||||
private boolean drawCheck1;
|
private boolean drawCheck1;
|
||||||
private boolean drawCheck2;
|
private boolean drawCheck2;
|
||||||
private boolean drawClock;
|
private boolean drawClock;
|
||||||
|
@ -1007,9 +1009,22 @@ public class DialogCell extends BaseCell {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dialogsType == 0 && MessagesController.getInstance(currentAccount).isProxyDialog(currentDialogId, true)) {
|
promoDialog = false;
|
||||||
|
MessagesController messagesController = MessagesController.getInstance(currentAccount);
|
||||||
|
if (dialogsType == 0 && messagesController.isPromoDialog(currentDialogId, true)) {
|
||||||
drawPinBackground = true;
|
drawPinBackground = true;
|
||||||
timeString = LocaleController.getString("UseProxySponsor", R.string.UseProxySponsor);
|
promoDialog = true;
|
||||||
|
if (messagesController.promoDialogType == MessagesController.PROMO_TYPE_PROXY) {
|
||||||
|
timeString = LocaleController.getString("UseProxySponsor", R.string.UseProxySponsor);
|
||||||
|
} else if (messagesController.promoDialogType == MessagesController.PROMO_TYPE_PSA) {
|
||||||
|
timeString = LocaleController.getString("PsaType_" + messagesController.promoPsaType);
|
||||||
|
if (TextUtils.isEmpty(timeString)) {
|
||||||
|
timeString = LocaleController.getString("PsaTypeDefault", R.string.PsaTypeDefault);
|
||||||
|
}
|
||||||
|
if (!TextUtils.isEmpty(messagesController.promoPsaMessage)) {
|
||||||
|
messageString = messagesController.promoPsaMessage;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (currentDialogFolderId != 0) {
|
if (currentDialogFolderId != 0) {
|
||||||
|
@ -1737,7 +1752,12 @@ public class DialogCell extends BaseCell {
|
||||||
translationDrawable = Theme.dialogs_pinArchiveDrawable;
|
translationDrawable = Theme.dialogs_pinArchiveDrawable;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (folderId == 0) {
|
if (promoDialog) {
|
||||||
|
backgroundColor = Theme.getColor(Theme.key_chats_archiveBackground);
|
||||||
|
revealBackgroundColor = Theme.getColor(Theme.key_chats_archivePinBackground);
|
||||||
|
archive = LocaleController.getString("PsaHide", R.string.PsaHide);
|
||||||
|
translationDrawable = Theme.dialogs_hidePsaDrawable;
|
||||||
|
} else if (folderId == 0) {
|
||||||
backgroundColor = Theme.getColor(Theme.key_chats_archiveBackground);
|
backgroundColor = Theme.getColor(Theme.key_chats_archiveBackground);
|
||||||
revealBackgroundColor = Theme.getColor(Theme.key_chats_archivePinBackground);
|
revealBackgroundColor = Theme.getColor(Theme.key_chats_archivePinBackground);
|
||||||
archive = LocaleController.getString("Archive", R.string.Archive);
|
archive = LocaleController.getString("Archive", R.string.Archive);
|
||||||
|
@ -1760,9 +1780,19 @@ public class DialogCell extends BaseCell {
|
||||||
if (currentRevealProgress < 1.0f) {
|
if (currentRevealProgress < 1.0f) {
|
||||||
Theme.dialogs_pinnedPaint.setColor(backgroundColor);
|
Theme.dialogs_pinnedPaint.setColor(backgroundColor);
|
||||||
canvas.drawRect(tx - AndroidUtilities.dp(8), 0, getMeasuredWidth(), getMeasuredHeight(), Theme.dialogs_pinnedPaint);
|
canvas.drawRect(tx - AndroidUtilities.dp(8), 0, getMeasuredWidth(), getMeasuredHeight(), Theme.dialogs_pinnedPaint);
|
||||||
if (currentRevealProgress == 0 && Theme.dialogs_archiveDrawableRecolored) {
|
if (currentRevealProgress == 0) {
|
||||||
Theme.dialogs_archiveDrawable.setLayerColor("Arrow.**", Theme.getNonAnimatedColor(Theme.key_chats_archiveBackground));
|
if (Theme.dialogs_archiveDrawableRecolored) {
|
||||||
Theme.dialogs_archiveDrawableRecolored = false;
|
Theme.dialogs_archiveDrawable.setLayerColor("Arrow.**", Theme.getNonAnimatedColor(Theme.key_chats_archiveBackground));
|
||||||
|
Theme.dialogs_archiveDrawableRecolored = false;
|
||||||
|
}
|
||||||
|
if (Theme.dialogs_hidePsaDrawableRecolored) {
|
||||||
|
Theme.dialogs_hidePsaDrawable.beginApplyLayerColors();
|
||||||
|
Theme.dialogs_hidePsaDrawable.setLayerColor("Line 1.**", Theme.getNonAnimatedColor(Theme.key_chats_archiveBackground));
|
||||||
|
Theme.dialogs_hidePsaDrawable.setLayerColor("Line 2.**", Theme.getNonAnimatedColor(Theme.key_chats_archiveBackground));
|
||||||
|
Theme.dialogs_hidePsaDrawable.setLayerColor("Line 3.**", Theme.getNonAnimatedColor(Theme.key_chats_archiveBackground));
|
||||||
|
Theme.dialogs_hidePsaDrawable.commitApplyLayerColors();
|
||||||
|
Theme.dialogs_hidePsaDrawableRecolored = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
int drawableX = getMeasuredWidth() - AndroidUtilities.dp(43) - translationDrawable.getIntrinsicWidth() / 2;
|
int drawableX = getMeasuredWidth() - AndroidUtilities.dp(43) - translationDrawable.getIntrinsicWidth() / 2;
|
||||||
|
@ -1783,6 +1813,14 @@ public class DialogCell extends BaseCell {
|
||||||
Theme.dialogs_archiveDrawable.setLayerColor("Arrow.**", Theme.getNonAnimatedColor(Theme.key_chats_archivePinBackground));
|
Theme.dialogs_archiveDrawable.setLayerColor("Arrow.**", Theme.getNonAnimatedColor(Theme.key_chats_archivePinBackground));
|
||||||
Theme.dialogs_archiveDrawableRecolored = true;
|
Theme.dialogs_archiveDrawableRecolored = true;
|
||||||
}
|
}
|
||||||
|
if (!Theme.dialogs_hidePsaDrawableRecolored) {
|
||||||
|
Theme.dialogs_hidePsaDrawable.beginApplyLayerColors();
|
||||||
|
Theme.dialogs_hidePsaDrawable.setLayerColor("Line 1.**", Theme.getNonAnimatedColor(Theme.key_chats_archivePinBackground));
|
||||||
|
Theme.dialogs_hidePsaDrawable.setLayerColor("Line 2.**", Theme.getNonAnimatedColor(Theme.key_chats_archivePinBackground));
|
||||||
|
Theme.dialogs_hidePsaDrawable.setLayerColor("Line 3.**", Theme.getNonAnimatedColor(Theme.key_chats_archivePinBackground));
|
||||||
|
Theme.dialogs_hidePsaDrawable.commitApplyLayerColors();
|
||||||
|
Theme.dialogs_hidePsaDrawableRecolored = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
canvas.save();
|
canvas.save();
|
||||||
|
|
|
@ -72,6 +72,7 @@ public class ThemesHorizontalListCell extends RecyclerListView implements Notifi
|
||||||
private ArrayList<Theme.ThemeInfo> darkThemes;
|
private ArrayList<Theme.ThemeInfo> darkThemes;
|
||||||
private ArrayList<Theme.ThemeInfo> defaultThemes;
|
private ArrayList<Theme.ThemeInfo> defaultThemes;
|
||||||
private int currentType;
|
private int currentType;
|
||||||
|
private int prevCount;
|
||||||
|
|
||||||
private class ThemesListAdapter extends RecyclerListView.SelectionAdapter {
|
private class ThemesListAdapter extends RecyclerListView.SelectionAdapter {
|
||||||
|
|
||||||
|
@ -107,7 +108,7 @@ public class ThemesHorizontalListCell extends RecyclerListView implements Notifi
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getItemCount() {
|
public int getItemCount() {
|
||||||
return defaultThemes.size() + darkThemes.size();
|
return prevCount = defaultThemes.size() + darkThemes.size();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -728,6 +729,9 @@ public class ThemesHorizontalListCell extends RecyclerListView implements Notifi
|
||||||
}
|
}
|
||||||
|
|
||||||
public void notifyDataSetChanged(int width) {
|
public void notifyDataSetChanged(int width) {
|
||||||
|
if (prevCount == adapter.getItemCount()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
adapter.notifyDataSetChanged();
|
adapter.notifyDataSetChanged();
|
||||||
Theme.ThemeInfo t = currentType == ThemeActivity.THEME_TYPE_NIGHT ? Theme.getCurrentNightTheme() : Theme.getCurrentTheme();
|
Theme.ThemeInfo t = currentType == ThemeActivity.THEME_TYPE_NIGHT ? Theme.getCurrentNightTheme() : Theme.getCurrentTheme();
|
||||||
if (prevThemeInfo != t) {
|
if (prevThemeInfo != t) {
|
||||||
|
|
|
@ -343,7 +343,8 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
private UndoView topUndoView;
|
private UndoView topUndoView;
|
||||||
private boolean openKeyboardOnAttachMenuClose;
|
private boolean openKeyboardOnAttachMenuClose;
|
||||||
|
|
||||||
private MessageObject pollHintMessageObject;
|
private MessageObject hintMessageObject;
|
||||||
|
private int hintMessageType;
|
||||||
|
|
||||||
private RecyclerListView messagesSearchListView;
|
private RecyclerListView messagesSearchListView;
|
||||||
private MessagesSearchAdapter messagesSearchAdapter;
|
private MessagesSearchAdapter messagesSearchAdapter;
|
||||||
|
@ -11463,7 +11464,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
((ChatMessageCell) pollView).shakeView();
|
((ChatMessageCell) pollView).shakeView();
|
||||||
pollView.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
|
pollView.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
|
||||||
showPollSolution(cell.getMessageObject(), results);
|
showPollSolution(cell.getMessageObject(), results);
|
||||||
cell.showPollHintButton(false, true);
|
cell.showHintButton(false, true, 0);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -12206,17 +12207,10 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showPollSolution(MessageObject messageObject, TLRPC.PollResults results) {
|
private void showInfoHint(MessageObject messageObject, CharSequence text, int type) {
|
||||||
if (results == null || topUndoView == null || TextUtils.isEmpty(results.solution)) {
|
if (topUndoView == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
CharSequence text;
|
|
||||||
if (!results.solution_entities.isEmpty()) {
|
|
||||||
text = new SpannableStringBuilder(results.solution);
|
|
||||||
MessageObject.addEntitiesToText(text, results.solution_entities, false, true, true, false);
|
|
||||||
} else {
|
|
||||||
text = results.solution;
|
|
||||||
}
|
|
||||||
Runnable runnable = () -> {
|
Runnable runnable = () -> {
|
||||||
if (chatListView != null) {
|
if (chatListView != null) {
|
||||||
int count = chatListView.getChildCount();
|
int count = chatListView.getChildCount();
|
||||||
|
@ -12227,15 +12221,30 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
}
|
}
|
||||||
ChatMessageCell cell = (ChatMessageCell) view;
|
ChatMessageCell cell = (ChatMessageCell) view;
|
||||||
MessageObject message = cell.getMessageObject();
|
MessageObject message = cell.getMessageObject();
|
||||||
if (message != null && message.equals(pollHintMessageObject)) {
|
if (message != null && message.equals(hintMessageObject)) {
|
||||||
cell.showPollHintButton(true, true);
|
cell.showHintButton(true, true, type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pollHintMessageObject = null;
|
hintMessageObject = null;
|
||||||
};
|
};
|
||||||
topUndoView.showWithAction(0, UndoView.ACTION_QUIZ_VOTE_INFO, text, runnable, runnable);
|
topUndoView.showWithAction(0, UndoView.ACTION_TEXT_INFO, text, runnable, runnable);
|
||||||
pollHintMessageObject = messageObject;
|
hintMessageObject = messageObject;
|
||||||
|
hintMessageType = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void showPollSolution(MessageObject messageObject, TLRPC.PollResults results) {
|
||||||
|
if (results == null || TextUtils.isEmpty(results.solution)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
CharSequence text;
|
||||||
|
if (!results.solution_entities.isEmpty()) {
|
||||||
|
text = new SpannableStringBuilder(results.solution);
|
||||||
|
MessageObject.addEntitiesToText(text, results.solution_entities, false, true, true, false);
|
||||||
|
} else {
|
||||||
|
text = results.solution;
|
||||||
|
}
|
||||||
|
showInfoHint(messageObject, text, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateSearchButtons(int mask, int num, int count) {
|
private void updateSearchButtons(int mask, int num, int count) {
|
||||||
|
@ -12329,6 +12338,48 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
}
|
}
|
||||||
|
|
||||||
showScheduledOrNoSoundHint();
|
showScheduledOrNoSoundHint();
|
||||||
|
|
||||||
|
if (!backward && firstOpen) {
|
||||||
|
if (getMessagesController().isPromoDialog(dialog_id, true)) {
|
||||||
|
int type = getMessagesController().promoDialogType;
|
||||||
|
String message;
|
||||||
|
SharedPreferences preferences = MessagesController.getGlobalNotificationsSettings();
|
||||||
|
boolean check;
|
||||||
|
if (type == MessagesController.PROMO_TYPE_PROXY) {
|
||||||
|
if (preferences.getLong("proxychannel", 0) != dialog_id) {
|
||||||
|
message = LocaleController.getString("UseProxySponsorInfo", R.string.UseProxySponsorInfo);
|
||||||
|
} else {
|
||||||
|
message = null;
|
||||||
|
}
|
||||||
|
} else if (type == MessagesController.PROMO_TYPE_PSA) {
|
||||||
|
String psaType = getMessagesController().promoPsaType;
|
||||||
|
if (!preferences.getBoolean(psaType + "_shown", false)) {
|
||||||
|
message = LocaleController.getString("PsaInfo_" + psaType);
|
||||||
|
if (TextUtils.isEmpty(message)) {
|
||||||
|
message = LocaleController.getString("PsaInfoDefault", R.string.PsaInfoDefault);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
message = null;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
message = null;
|
||||||
|
}
|
||||||
|
if (!TextUtils.isEmpty(message)) {
|
||||||
|
if (topUndoView != null) {
|
||||||
|
if (type == MessagesController.PROMO_TYPE_PROXY) {
|
||||||
|
preferences.edit().putLong("proxychannel", dialog_id).commit();
|
||||||
|
} else if (type == MessagesController.PROMO_TYPE_PSA) {
|
||||||
|
String psaType = getMessagesController().promoPsaType;
|
||||||
|
preferences.edit().putBoolean(psaType + "_shown", true).commit();
|
||||||
|
}
|
||||||
|
SpannableStringBuilder stringBuilder = new SpannableStringBuilder(message);
|
||||||
|
MessageObject.addLinks(false, stringBuilder);
|
||||||
|
topUndoView.showWithAction(0, UndoView.ACTION_TEXT_INFO, stringBuilder, null, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
firstOpen = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13131,20 +13182,6 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
return AndroidUtilities.dp(48);
|
return AndroidUtilities.dp(48);
|
||||||
});
|
});
|
||||||
|
|
||||||
if (firstOpen) {
|
|
||||||
if (getMessagesController().isProxyDialog(dialog_id, true)) {
|
|
||||||
SharedPreferences preferences = MessagesController.getGlobalNotificationsSettings();
|
|
||||||
if (preferences.getLong("proxychannel", 0) != dialog_id) {
|
|
||||||
preferences.edit().putLong("proxychannel", dialog_id).commit();
|
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
|
|
||||||
builder.setTitle(LocaleController.getString("AppName", R.string.AppName));
|
|
||||||
builder.setMessage(LocaleController.getString("UseProxySponsorInfo", R.string.UseProxySponsorInfo));
|
|
||||||
builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), null);
|
|
||||||
showDialog(builder.create());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
checkActionBarMenu();
|
checkActionBarMenu();
|
||||||
if (replyImageLocation != null && replyImageView != null) {
|
if (replyImageLocation != null && replyImageView != null) {
|
||||||
replyImageView.setImage(ImageLocation.getForObject(replyImageLocation, replyImageLocationObject), "50_50", ImageLocation.getForObject(replyImageThumbLocation, replyImageLocationObject), "50_50_b", null, replyImageSize, replyImageCacheType, replyingMessageObject);
|
replyImageView.setImage(ImageLocation.getForObject(replyImageLocation, replyImageLocationObject), "50_50", ImageLocation.getForObject(replyImageThumbLocation, replyImageLocationObject), "50_50_b", null, replyImageSize, replyImageCacheType, replyingMessageObject);
|
||||||
|
@ -15963,13 +16000,24 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
chatMessageCell.setDelegate(new ChatMessageCell.ChatMessageCellDelegate() {
|
chatMessageCell.setDelegate(new ChatMessageCell.ChatMessageCellDelegate() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void didPressPollHint(ChatMessageCell cell, int x, int y) {
|
public void didPressHint(ChatMessageCell cell, int type) {
|
||||||
if (getParentActivity() == null) {
|
if (type == 0) {
|
||||||
return;
|
TLRPC.TL_messageMediaPoll media = (TLRPC.TL_messageMediaPoll) cell.getMessageObject().messageOwner.media;
|
||||||
|
showPollSolution(cell.getMessageObject(), media.results);
|
||||||
|
} else if (type == 1) {
|
||||||
|
MessageObject messageObject = cell.getMessageObject();
|
||||||
|
if (TextUtils.isEmpty(messageObject.messageOwner.fwd_from.psa_type)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
CharSequence text = LocaleController.getString("PsaMessageInfo_" + messageObject.messageOwner.fwd_from.psa_type);
|
||||||
|
if (TextUtils.isEmpty(text)) {
|
||||||
|
text = LocaleController.getString("PsaMessageInfoDefault", R.string.PsaMessageInfoDefault);
|
||||||
|
}
|
||||||
|
SpannableStringBuilder stringBuilder = new SpannableStringBuilder(text);
|
||||||
|
MessageObject.addLinks(false, stringBuilder);
|
||||||
|
showInfoHint(messageObject, stringBuilder, 1);
|
||||||
}
|
}
|
||||||
TLRPC.TL_messageMediaPoll media = (TLRPC.TL_messageMediaPoll) cell.getMessageObject().messageOwner.media;
|
cell.showHintButton(false, true, type);
|
||||||
showPollSolution(cell.getMessageObject(), media.results);
|
|
||||||
cell.showPollHintButton(false, true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -16654,10 +16702,9 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
if (holder.itemView instanceof ChatMessageCell) {
|
if (holder.itemView instanceof ChatMessageCell) {
|
||||||
final ChatMessageCell messageCell = (ChatMessageCell) holder.itemView;
|
final ChatMessageCell messageCell = (ChatMessageCell) holder.itemView;
|
||||||
MessageObject message = messageCell.getMessageObject();
|
MessageObject message = messageCell.getMessageObject();
|
||||||
if (pollHintMessageObject != null && pollHintMessageObject.equals(message)) {
|
messageCell.showHintButton(true, false, -1);
|
||||||
messageCell.showPollHintButton(false, false);
|
if (hintMessageObject != null && hintMessageObject.equals(message)) {
|
||||||
} else {
|
messageCell.showHintButton(false, false, hintMessageType);
|
||||||
messageCell.showPollHintButton(true, false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean selected = false;
|
boolean selected = false;
|
||||||
|
@ -17139,6 +17186,8 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, Theme.chat_timeBackgroundPaint, null, null, Theme.key_chat_mediaTimeBackground));
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, Theme.chat_timeBackgroundPaint, null, null, Theme.key_chat_mediaTimeBackground));
|
||||||
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_inForwardedNameText));
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_inForwardedNameText));
|
||||||
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_outForwardedNameText));
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_outForwardedNameText));
|
||||||
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_inPsaNameText));
|
||||||
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_outPsaNameText));
|
||||||
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_inViaBotNameText));
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_inViaBotNameText));
|
||||||
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_outViaBotNameText));
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_outViaBotNameText));
|
||||||
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_stickerViaBotNameText));
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_stickerViaBotNameText));
|
||||||
|
@ -17260,6 +17309,8 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_outPollWrongAnswer));
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_outPollWrongAnswer));
|
||||||
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_pollHintDrawable[0]}, null, Theme.key_chat_inPreviewInstantText));
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_pollHintDrawable[0]}, null, Theme.key_chat_inPreviewInstantText));
|
||||||
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_pollHintDrawable[1]}, null, Theme.key_chat_outPreviewInstantText));
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_pollHintDrawable[1]}, null, Theme.key_chat_outPreviewInstantText));
|
||||||
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_psaHelpDrawable[0]}, null, Theme.key_chat_inViews));
|
||||||
|
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_psaHelpDrawable[1]}, null, Theme.key_chat_outViews));
|
||||||
|
|
||||||
themeDescriptions.add(new ThemeDescription(messagesSearchListView, 0, new Class[]{DialogCell.class}, null, Theme.avatarDrawables, null, Theme.key_avatar_text));
|
themeDescriptions.add(new ThemeDescription(messagesSearchListView, 0, new Class[]{DialogCell.class}, null, Theme.avatarDrawables, null, Theme.key_avatar_text));
|
||||||
themeDescriptions.add(new ThemeDescription(messagesSearchListView, 0, new Class[]{DialogCell.class}, Theme.dialogs_countPaint, null, null, Theme.key_chats_unreadCounter));
|
themeDescriptions.add(new ThemeDescription(messagesSearchListView, 0, new Class[]{DialogCell.class}, Theme.dialogs_countPaint, null, null, Theme.key_chats_unreadCounter));
|
||||||
|
|
|
@ -2111,6 +2111,7 @@ public class ChatAttachAlert extends BottomSheet implements NotificationCenter.N
|
||||||
currentAttachLayout.setVisibility(View.GONE);
|
currentAttachLayout.setVisibility(View.GONE);
|
||||||
currentAttachLayout.onHidden();
|
currentAttachLayout.onHidden();
|
||||||
currentAttachLayout = photoLayout;
|
currentAttachLayout = photoLayout;
|
||||||
|
setAllowNestedScroll(true);
|
||||||
if (currentAttachLayout.getParent() == null) {
|
if (currentAttachLayout.getParent() == null) {
|
||||||
containerView.addView(currentAttachLayout, 0, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));
|
containerView.addView(currentAttachLayout, 0, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));
|
||||||
}
|
}
|
||||||
|
|
|
@ -217,6 +217,7 @@ public class SharedMediaLayout extends FrameLayout implements NotificationCenter
|
||||||
notificationCenter.addObserver(this, NotificationCenter.mediaDidLoad);
|
notificationCenter.addObserver(this, NotificationCenter.mediaDidLoad);
|
||||||
notificationCenter.addObserver(this, NotificationCenter.messagesDeleted);
|
notificationCenter.addObserver(this, NotificationCenter.messagesDeleted);
|
||||||
notificationCenter.addObserver(this, NotificationCenter.replaceMessagesObjects);
|
notificationCenter.addObserver(this, NotificationCenter.replaceMessagesObjects);
|
||||||
|
notificationCenter.addObserver(this, NotificationCenter.chatInfoDidLoad);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addDelegate(SharedMediaPreloaderDelegate delegate) {
|
public void addDelegate(SharedMediaPreloaderDelegate delegate) {
|
||||||
|
@ -240,6 +241,7 @@ public class SharedMediaLayout extends FrameLayout implements NotificationCenter
|
||||||
notificationCenter.removeObserver(this, NotificationCenter.mediaDidLoad);
|
notificationCenter.removeObserver(this, NotificationCenter.mediaDidLoad);
|
||||||
notificationCenter.removeObserver(this, NotificationCenter.messagesDeleted);
|
notificationCenter.removeObserver(this, NotificationCenter.messagesDeleted);
|
||||||
notificationCenter.removeObserver(this, NotificationCenter.replaceMessagesObjects);
|
notificationCenter.removeObserver(this, NotificationCenter.replaceMessagesObjects);
|
||||||
|
notificationCenter.removeObserver(this, NotificationCenter.chatInfoDidLoad);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int[] getLastMediaCount() {
|
public int[] getLastMediaCount() {
|
||||||
|
@ -439,6 +441,11 @@ public class SharedMediaLayout extends FrameLayout implements NotificationCenter
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else if (id == NotificationCenter.chatInfoDidLoad) {
|
||||||
|
TLRPC.ChatFull chatFull = (TLRPC.ChatFull) args[0];
|
||||||
|
if (dialogId < 0 && chatFull.id == -dialogId) {
|
||||||
|
setChatInfo(chatFull);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -448,6 +455,13 @@ public class SharedMediaLayout extends FrameLayout implements NotificationCenter
|
||||||
parentFragment.getMediaDataController().getMediaCounts(mergeDialogId, parentFragment.getClassGuid());
|
parentFragment.getMediaDataController().getMediaCounts(mergeDialogId, parentFragment.getClassGuid());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void setChatInfo(TLRPC.ChatFull chatInfo) {
|
||||||
|
if (chatInfo != null && chatInfo.migrated_from_chat_id != 0 && mergeDialogId == 0) {
|
||||||
|
mergeDialogId = -chatInfo.migrated_from_chat_id;
|
||||||
|
parentFragment.getMediaDataController().getMediaCounts(mergeDialogId, parentFragment.getClassGuid());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private PhotoViewer.PhotoViewerProvider provider = new PhotoViewer.EmptyPhotoViewerProvider() {
|
private PhotoViewer.PhotoViewerProvider provider = new PhotoViewer.EmptyPhotoViewerProvider() {
|
||||||
|
@ -638,13 +652,13 @@ public class SharedMediaLayout extends FrameLayout implements NotificationCenter
|
||||||
|
|
||||||
private boolean isActionModeShowed;
|
private boolean isActionModeShowed;
|
||||||
|
|
||||||
public SharedMediaLayout(Context context, long did, SharedMediaPreloader preloader, int commonGroupsCount, ArrayList<Integer> sortedUsers, TLRPC.ChatFull chatInfo, ProfileActivity parent) {
|
public SharedMediaLayout(Context context, long did, SharedMediaPreloader preloader, int commonGroupsCount, ArrayList<Integer> sortedUsers, TLRPC.ChatFull chatInfo, boolean membersFirst, ProfileActivity parent) {
|
||||||
super(context);
|
super(context);
|
||||||
|
|
||||||
sharedMediaPreloader = preloader;
|
sharedMediaPreloader = preloader;
|
||||||
int[] mediaCount = preloader.getLastMediaCount();
|
int[] mediaCount = preloader.getLastMediaCount();
|
||||||
hasMedia = new int[]{mediaCount[0], mediaCount[1], mediaCount[2], mediaCount[3], mediaCount[4], mediaCount[5], commonGroupsCount};
|
hasMedia = new int[]{mediaCount[0], mediaCount[1], mediaCount[2], mediaCount[3], mediaCount[4], mediaCount[5], commonGroupsCount};
|
||||||
if (chatInfo != null) {
|
if (membersFirst) {
|
||||||
initialTab = 7;
|
initialTab = 7;
|
||||||
} else {
|
} else {
|
||||||
for (int a = 0; a < hasMedia.length; a++) {
|
for (int a = 0; a < hasMedia.length; a++) {
|
||||||
|
@ -1360,7 +1374,7 @@ public class SharedMediaLayout extends FrameLayout implements NotificationCenter
|
||||||
} else {
|
} else {
|
||||||
threshold = 6;
|
threshold = 6;
|
||||||
}
|
}
|
||||||
if (visibleItemCount != 0 && firstVisibleItem + visibleItemCount > totalItemCount - threshold && !sharedMediaData[mediaPage.selectedType].loading) {
|
if (firstVisibleItem + visibleItemCount > totalItemCount - threshold && !sharedMediaData[mediaPage.selectedType].loading) {
|
||||||
int type;
|
int type;
|
||||||
if (mediaPage.selectedType == 0) {
|
if (mediaPage.selectedType == 0) {
|
||||||
type = MediaDataController.MEDIA_PHOTOVIDEO;
|
type = MediaDataController.MEDIA_PHOTOVIDEO;
|
||||||
|
|
|
@ -98,7 +98,7 @@ public class UndoView extends FrameLayout {
|
||||||
public final static int ACTION_FILTERS_AVAILABLE = 15;
|
public final static int ACTION_FILTERS_AVAILABLE = 15;
|
||||||
public final static int ACTION_DICE_INFO = 16;
|
public final static int ACTION_DICE_INFO = 16;
|
||||||
public final static int ACTION_DICE_NO_SEND_INFO = 17;
|
public final static int ACTION_DICE_NO_SEND_INFO = 17;
|
||||||
public final static int ACTION_QUIZ_VOTE_INFO = 18;
|
public final static int ACTION_TEXT_INFO = 18;
|
||||||
public final static int ACTION_CACHE_WAS_CLEARED = 19;
|
public final static int ACTION_CACHE_WAS_CLEARED = 19;
|
||||||
|
|
||||||
private CharSequence infoText;
|
private CharSequence infoText;
|
||||||
|
@ -519,7 +519,7 @@ public class UndoView extends FrameLayout {
|
||||||
|
|
||||||
subinfoTextView.setVisibility(GONE);
|
subinfoTextView.setVisibility(GONE);
|
||||||
leftImageView.setVisibility(VISIBLE);
|
leftImageView.setVisibility(VISIBLE);
|
||||||
} else if (currentAction == ACTION_QUIZ_VOTE_INFO) {
|
} else if (currentAction == ACTION_TEXT_INFO) {
|
||||||
CharSequence info = (CharSequence) infoObject;
|
CharSequence info = (CharSequence) infoObject;
|
||||||
timeLeft = Math.max(4000, Math.min(info.length() / 50 * 1600, 10000));
|
timeLeft = Math.max(4000, Math.min(info.length() / 50 * 1600, 10000));
|
||||||
infoTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14);
|
infoTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14);
|
||||||
|
@ -638,8 +638,8 @@ public class UndoView extends FrameLayout {
|
||||||
}
|
}
|
||||||
width -= AndroidUtilities.dp(16);
|
width -= AndroidUtilities.dp(16);
|
||||||
measureChildWithMargins(infoTextView, MeasureSpec.makeMeasureSpec(width, MeasureSpec.EXACTLY), 0, MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED), 0);
|
measureChildWithMargins(infoTextView, MeasureSpec.makeMeasureSpec(width, MeasureSpec.EXACTLY), 0, MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED), 0);
|
||||||
undoViewHeight = infoTextView.getMeasuredHeight() + AndroidUtilities.dp(currentAction == ACTION_DICE_INFO || currentAction == ACTION_DICE_NO_SEND_INFO || currentAction == ACTION_QUIZ_VOTE_INFO ? 14 : 28);
|
undoViewHeight = infoTextView.getMeasuredHeight() + AndroidUtilities.dp(currentAction == ACTION_DICE_INFO || currentAction == ACTION_DICE_NO_SEND_INFO || currentAction == ACTION_TEXT_INFO ? 14 : 28);
|
||||||
if (currentAction == ACTION_QUIZ_VOTE_INFO) {
|
if (currentAction == ACTION_TEXT_INFO) {
|
||||||
undoViewHeight = Math.max(undoViewHeight, AndroidUtilities.dp(52));
|
undoViewHeight = Math.max(undoViewHeight, AndroidUtilities.dp(52));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -168,6 +168,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
|
||||||
private int archivePullViewState;
|
private int archivePullViewState;
|
||||||
private RadialProgressView progressView;
|
private RadialProgressView progressView;
|
||||||
private int lastItemsCount;
|
private int lastItemsCount;
|
||||||
|
private DialogsItemAnimator dialogsItemAnimator;
|
||||||
|
|
||||||
public ViewPage(Context context) {
|
public ViewPage(Context context) {
|
||||||
super(context);
|
super(context);
|
||||||
|
@ -256,7 +257,6 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
|
||||||
private int dialogRemoveFinished;
|
private int dialogRemoveFinished;
|
||||||
private int dialogInsertFinished;
|
private int dialogInsertFinished;
|
||||||
private int dialogChangeFinished;
|
private int dialogChangeFinished;
|
||||||
private DialogsItemAnimator dialogsItemAnimator;
|
|
||||||
|
|
||||||
private AlertDialog permissionDialog;
|
private AlertDialog permissionDialog;
|
||||||
private boolean askAboutContacts = true;
|
private boolean askAboutContacts = true;
|
||||||
|
@ -304,6 +304,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
|
||||||
private int canClearCacheCount;
|
private int canClearCacheCount;
|
||||||
private int canReportSpamCount;
|
private int canReportSpamCount;
|
||||||
private int canUnarchiveCount;
|
private int canUnarchiveCount;
|
||||||
|
private boolean canDeletePsaSelected;
|
||||||
|
|
||||||
private int topPadding;
|
private int topPadding;
|
||||||
|
|
||||||
|
@ -996,7 +997,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
|
||||||
protected void onLayout(boolean changed, int l, int t, int r, int b) {
|
protected void onLayout(boolean changed, int l, int t, int r, int b) {
|
||||||
super.onLayout(changed, l, t, r, b);
|
super.onLayout(changed, l, t, r, b);
|
||||||
appliedPaddingTop = getPaddingTop();
|
appliedPaddingTop = getPaddingTop();
|
||||||
if ((dialogRemoveFinished != 0 || dialogInsertFinished != 0 || dialogChangeFinished != 0) && !dialogsItemAnimator.isRunning()) {
|
if ((dialogRemoveFinished != 0 || dialogInsertFinished != 0 || dialogChangeFinished != 0) && !parentPage.dialogsItemAnimator.isRunning()) {
|
||||||
onDialogAnimationFinished();
|
onDialogAnimationFinished();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1139,7 +1140,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMovementFlags(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder) {
|
public int getMovementFlags(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder) {
|
||||||
if (waitingForDialogsAnimationEnd() || parentLayout != null && parentLayout.isInPreviewMode()) {
|
if (waitingForDialogsAnimationEnd(parentPage) || parentLayout != null && parentLayout.isInPreviewMode()) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (swipingFolder && swipeFolderBack) {
|
if (swipingFolder && swipeFolderBack) {
|
||||||
|
@ -1158,7 +1159,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
|
||||||
movingView.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite));
|
movingView.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite));
|
||||||
return makeMovementFlags(ItemTouchHelper.UP | ItemTouchHelper.DOWN, 0);
|
return makeMovementFlags(ItemTouchHelper.UP | ItemTouchHelper.DOWN, 0);
|
||||||
} else {
|
} else {
|
||||||
if (filterTabsView != null && filterTabsView.getVisibility() == View.VISIBLE || !allowSwipeDuringCurrentTouch || dialogId == getUserConfig().clientUserId || dialogId == 777000 || getMessagesController().isProxyDialog(dialogId, false)) {
|
if (filterTabsView != null && filterTabsView.getVisibility() == View.VISIBLE || !allowSwipeDuringCurrentTouch || dialogId == getUserConfig().clientUserId || dialogId == 777000 || getMessagesController().isPromoDialog(dialogId, false) && getMessagesController().promoDialogType != MessagesController.PROMO_TYPE_PSA) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
swipeFolderBack = false;
|
swipeFolderBack = false;
|
||||||
|
@ -1226,83 +1227,91 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
|
||||||
int pinnedNum = dialog.pinnedNum;
|
int pinnedNum = dialog.pinnedNum;
|
||||||
slidingView = null;
|
slidingView = null;
|
||||||
parentPage.listView.invalidate();
|
parentPage.listView.invalidate();
|
||||||
int added = getMessagesController().addDialogToFolder(dialog.id, folderId == 0 ? 1 : 0, -1, 0);
|
|
||||||
int lastItemPosition = parentPage.layoutManager.findLastVisibleItemPosition();
|
int lastItemPosition = parentPage.layoutManager.findLastVisibleItemPosition();
|
||||||
if (lastItemPosition == count - 1) {
|
if (lastItemPosition == count - 1) {
|
||||||
parentPage.layoutManager.findViewByPosition(lastItemPosition).requestLayout();
|
parentPage.layoutManager.findViewByPosition(lastItemPosition).requestLayout();
|
||||||
}
|
}
|
||||||
if (added != 2 || position != 0) {
|
if (getMessagesController().isPromoDialog(dialog.id, false)) {
|
||||||
dialogsItemAnimator.prepareForRemove();
|
getMessagesController().hidePromoDialog();
|
||||||
|
parentPage.dialogsItemAnimator.prepareForRemove();
|
||||||
parentPage.lastItemsCount--;
|
parentPage.lastItemsCount--;
|
||||||
parentPage.dialogsAdapter.notifyItemRemoved(position);
|
parentPage.dialogsAdapter.notifyItemRemoved(position);
|
||||||
dialogRemoveFinished = 2;
|
dialogRemoveFinished = 2;
|
||||||
}
|
} else {
|
||||||
if (folderId == 0) {
|
int added = getMessagesController().addDialogToFolder(dialog.id, folderId == 0 ? 1 : 0, -1, 0);
|
||||||
if (added == 2) {
|
if (added != 2 || position != 0) {
|
||||||
dialogsItemAnimator.prepareForRemove();
|
parentPage.dialogsItemAnimator.prepareForRemove();
|
||||||
if (position == 0) {
|
parentPage.lastItemsCount--;
|
||||||
dialogChangeFinished = 2;
|
parentPage.dialogsAdapter.notifyItemRemoved(position);
|
||||||
setDialogsListFrozen(true);
|
dialogRemoveFinished = 2;
|
||||||
parentPage.dialogsAdapter.notifyItemChanged(0);
|
|
||||||
} else {
|
|
||||||
parentPage.lastItemsCount++;
|
|
||||||
parentPage.dialogsAdapter.notifyItemInserted(0);
|
|
||||||
if (!SharedConfig.archiveHidden && parentPage.layoutManager.findFirstVisibleItemPosition() == 0) {
|
|
||||||
disableActionBarScrolling = true;
|
|
||||||
parentPage.listView.smoothScrollBy(0, -AndroidUtilities.dp(SharedConfig.useThreeLinesLayout ? 78 : 72));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ArrayList<TLRPC.Dialog> dialogs = getDialogsArray(currentAccount, parentPage.dialogsType, folderId, false);
|
|
||||||
frozenDialogsList.add(0, dialogs.get(0));
|
|
||||||
} else if (added == 1) {
|
|
||||||
RecyclerView.ViewHolder holder = parentPage.listView.findViewHolderForAdapterPosition(0);
|
|
||||||
if (holder != null && holder.itemView instanceof DialogCell) {
|
|
||||||
DialogCell cell = (DialogCell) holder.itemView;
|
|
||||||
cell.checkCurrentDialogIndex(true);
|
|
||||||
cell.animateArchiveAvatar();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
SharedPreferences preferences = MessagesController.getGlobalMainSettings();
|
if (folderId == 0) {
|
||||||
boolean hintShowed = preferences.getBoolean("archivehint_l", false) || SharedConfig.archiveHidden;
|
if (added == 2) {
|
||||||
if (!hintShowed) {
|
parentPage.dialogsItemAnimator.prepareForRemove();
|
||||||
preferences.edit().putBoolean("archivehint_l", true).commit();
|
if (position == 0) {
|
||||||
}
|
dialogChangeFinished = 2;
|
||||||
getUndoView().showWithAction(dialog.id, hintShowed ? UndoView.ACTION_ARCHIVE : UndoView.ACTION_ARCHIVE_HINT, null, () -> {
|
|
||||||
dialogsListFrozen = true;
|
|
||||||
getMessagesController().addDialogToFolder(dialog.id, 0, pinnedNum, 0);
|
|
||||||
dialogsListFrozen = false;
|
|
||||||
ArrayList<TLRPC.Dialog> dialogs = getMessagesController().getDialogs(0);
|
|
||||||
int index = dialogs.indexOf(dialog);
|
|
||||||
if (index >= 0) {
|
|
||||||
ArrayList<TLRPC.Dialog> archivedDialogs = getMessagesController().getDialogs(1);
|
|
||||||
if (!archivedDialogs.isEmpty() || index != 1) {
|
|
||||||
dialogInsertFinished = 2;
|
|
||||||
setDialogsListFrozen(true);
|
setDialogsListFrozen(true);
|
||||||
dialogsItemAnimator.prepareForRemove();
|
parentPage.dialogsAdapter.notifyItemChanged(0);
|
||||||
|
} else {
|
||||||
parentPage.lastItemsCount++;
|
parentPage.lastItemsCount++;
|
||||||
parentPage.dialogsAdapter.notifyItemInserted(index);
|
parentPage.dialogsAdapter.notifyItemInserted(0);
|
||||||
}
|
if (!SharedConfig.archiveHidden && parentPage.layoutManager.findFirstVisibleItemPosition() == 0) {
|
||||||
if (archivedDialogs.isEmpty()) {
|
disableActionBarScrolling = true;
|
||||||
dialogs.remove(0);
|
parentPage.listView.smoothScrollBy(0, -AndroidUtilities.dp(SharedConfig.useThreeLinesLayout ? 78 : 72));
|
||||||
if (index == 1) {
|
|
||||||
dialogChangeFinished = 2;
|
|
||||||
setDialogsListFrozen(true);
|
|
||||||
parentPage.dialogsAdapter.notifyItemChanged(0);
|
|
||||||
} else {
|
|
||||||
frozenDialogsList.remove(0);
|
|
||||||
dialogsItemAnimator.prepareForRemove();
|
|
||||||
parentPage.lastItemsCount--;
|
|
||||||
parentPage.dialogsAdapter.notifyItemRemoved(0);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
ArrayList<TLRPC.Dialog> dialogs = getDialogsArray(currentAccount, parentPage.dialogsType, folderId, false);
|
||||||
parentPage.dialogsAdapter.notifyDataSetChanged();
|
frozenDialogsList.add(0, dialogs.get(0));
|
||||||
|
} else if (added == 1) {
|
||||||
|
RecyclerView.ViewHolder holder = parentPage.listView.findViewHolderForAdapterPosition(0);
|
||||||
|
if (holder != null && holder.itemView instanceof DialogCell) {
|
||||||
|
DialogCell cell = (DialogCell) holder.itemView;
|
||||||
|
cell.checkCurrentDialogIndex(true);
|
||||||
|
cell.animateArchiveAvatar();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
SharedPreferences preferences = MessagesController.getGlobalMainSettings();
|
||||||
}
|
boolean hintShowed = preferences.getBoolean("archivehint_l", false) || SharedConfig.archiveHidden;
|
||||||
if (folderId != 0 && frozenDialogsList.isEmpty()) {
|
if (!hintShowed) {
|
||||||
parentPage.listView.setEmptyView(null);
|
preferences.edit().putBoolean("archivehint_l", true).commit();
|
||||||
parentPage.progressView.setVisibility(View.INVISIBLE);
|
}
|
||||||
|
getUndoView().showWithAction(dialog.id, hintShowed ? UndoView.ACTION_ARCHIVE : UndoView.ACTION_ARCHIVE_HINT, null, () -> {
|
||||||
|
dialogsListFrozen = true;
|
||||||
|
getMessagesController().addDialogToFolder(dialog.id, 0, pinnedNum, 0);
|
||||||
|
dialogsListFrozen = false;
|
||||||
|
ArrayList<TLRPC.Dialog> dialogs = getMessagesController().getDialogs(0);
|
||||||
|
int index = dialogs.indexOf(dialog);
|
||||||
|
if (index >= 0) {
|
||||||
|
ArrayList<TLRPC.Dialog> archivedDialogs = getMessagesController().getDialogs(1);
|
||||||
|
if (!archivedDialogs.isEmpty() || index != 1) {
|
||||||
|
dialogInsertFinished = 2;
|
||||||
|
setDialogsListFrozen(true);
|
||||||
|
parentPage.dialogsItemAnimator.prepareForRemove();
|
||||||
|
parentPage.lastItemsCount++;
|
||||||
|
parentPage.dialogsAdapter.notifyItemInserted(index);
|
||||||
|
}
|
||||||
|
if (archivedDialogs.isEmpty()) {
|
||||||
|
dialogs.remove(0);
|
||||||
|
if (index == 1) {
|
||||||
|
dialogChangeFinished = 2;
|
||||||
|
setDialogsListFrozen(true);
|
||||||
|
parentPage.dialogsAdapter.notifyItemChanged(0);
|
||||||
|
} else {
|
||||||
|
frozenDialogsList.remove(0);
|
||||||
|
parentPage.dialogsItemAnimator.prepareForRemove();
|
||||||
|
parentPage.lastItemsCount--;
|
||||||
|
parentPage.dialogsAdapter.notifyItemRemoved(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
parentPage.dialogsAdapter.notifyDataSetChanged();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (folderId != 0 && frozenDialogsList.isEmpty()) {
|
||||||
|
parentPage.listView.setEmptyView(null);
|
||||||
|
parentPage.progressView.setVisibility(View.INVISIBLE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
setDialogsListFrozen(true);
|
setDialogsListFrozen(true);
|
||||||
|
@ -1335,7 +1344,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
|
||||||
} else if (animationType == ItemTouchHelper.ANIMATION_TYPE_DRAG) {
|
} else if (animationType == ItemTouchHelper.ANIMATION_TYPE_DRAG) {
|
||||||
if (movingView != null) {
|
if (movingView != null) {
|
||||||
View view = movingView;
|
View view = movingView;
|
||||||
AndroidUtilities.runOnUIThread(() -> view.setBackgroundDrawable(null), dialogsItemAnimator.getMoveDuration());
|
AndroidUtilities.runOnUIThread(() -> view.setBackgroundDrawable(null), parentPage.dialogsItemAnimator.getMoveDuration());
|
||||||
movingView = null;
|
movingView = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2106,7 +2115,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
|
||||||
viewPage.listView = new DialogsRecyclerView(context, viewPage);
|
viewPage.listView = new DialogsRecyclerView(context, viewPage);
|
||||||
viewPage.listView.setClipToPadding(false);
|
viewPage.listView.setClipToPadding(false);
|
||||||
viewPage.listView.setPivotY(0);
|
viewPage.listView.setPivotY(0);
|
||||||
dialogsItemAnimator = new DialogsItemAnimator() {
|
viewPage.dialogsItemAnimator = new DialogsItemAnimator() {
|
||||||
@Override
|
@Override
|
||||||
public void onRemoveStarting(RecyclerView.ViewHolder item) {
|
public void onRemoveStarting(RecyclerView.ViewHolder item) {
|
||||||
super.onRemoveStarting(item);
|
super.onRemoveStarting(item);
|
||||||
|
@ -2152,7 +2161,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
viewPage.listView.setItemAnimator(dialogsItemAnimator);
|
viewPage.listView.setItemAnimator(viewPage.dialogsItemAnimator);
|
||||||
viewPage.listView.setVerticalScrollBarEnabled(true);
|
viewPage.listView.setVerticalScrollBarEnabled(true);
|
||||||
viewPage.listView.setInstantClick(true);
|
viewPage.listView.setInstantClick(true);
|
||||||
viewPage.layoutManager = new LinearLayoutManager(context) {
|
viewPage.layoutManager = new LinearLayoutManager(context) {
|
||||||
|
@ -2368,7 +2377,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
|
public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
|
||||||
dialogsItemAnimator.onListScroll(-dy);
|
viewPage.dialogsItemAnimator.onListScroll(-dy);
|
||||||
checkListLoad(viewPage);
|
checkListLoad(viewPage);
|
||||||
if (wasManualScroll && floatingButtonContainer.getVisibility() != View.GONE && recyclerView.getChildCount() > 0) {
|
if (wasManualScroll && floatingButtonContainer.getVisibility() != View.GONE && recyclerView.getChildCount() > 0) {
|
||||||
int firstVisibleItem = viewPage.layoutManager.findFirstVisibleItemPosition();
|
int firstVisibleItem = viewPage.layoutManager.findFirstVisibleItemPosition();
|
||||||
|
@ -2845,7 +2854,12 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean canUndo() {
|
protected boolean canUndo() {
|
||||||
return !dialogsItemAnimator.isRunning();
|
for (int a = 0; a < viewPages.length; a++) {
|
||||||
|
if (viewPages[a].dialogsItemAnimator.isRunning()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
contentView.addView(undoView[a], LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.BOTTOM | Gravity.LEFT, 8, 0, 8, 8));
|
contentView.addView(undoView[a], LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.BOTTOM | Gravity.LEFT, 8, 0, 8, 8));
|
||||||
|
@ -3705,8 +3719,8 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
|
||||||
return !onlySelect && initialDialogsType == 0 && folderId == 0 && getMessagesController().hasHiddenArchive();
|
return !onlySelect && initialDialogsType == 0 && folderId == 0 && getMessagesController().hasHiddenArchive();
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean waitingForDialogsAnimationEnd() {
|
private boolean waitingForDialogsAnimationEnd(ViewPage viewPage) {
|
||||||
return dialogsItemAnimator.isRunning() || dialogRemoveFinished != 0 || dialogInsertFinished != 0 || dialogChangeFinished != 0;
|
return viewPage.dialogsItemAnimator.isRunning() || dialogRemoveFinished != 0 || dialogInsertFinished != 0 || dialogChangeFinished != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onDialogAnimationFinished() {
|
private void onDialogAnimationFinished() {
|
||||||
|
@ -3808,7 +3822,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
|
||||||
int lower_id = (int) dialog.id;
|
int lower_id = (int) dialog.id;
|
||||||
if (isDialogPinned(dialog)) {
|
if (isDialogPinned(dialog)) {
|
||||||
pinnedCount++;
|
pinnedCount++;
|
||||||
} else if (!getMessagesController().isProxyDialog(dialog.id, false)) {
|
} else if (!getMessagesController().isPromoDialog(dialog.id, false)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3883,7 +3897,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
|
||||||
} else {
|
} else {
|
||||||
pinnedCount++;
|
pinnedCount++;
|
||||||
}
|
}
|
||||||
} else if (!getMessagesController().isProxyDialog(dialog.id, false)) {
|
} else if (!getMessagesController().isPromoDialog(dialog.id, false)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4076,62 +4090,78 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
|
||||||
}
|
}
|
||||||
} else if (action == delete || action == clear) {
|
} else if (action == delete || action == clear) {
|
||||||
if (count == 1) {
|
if (count == 1) {
|
||||||
AlertsCreator.createClearOrDeleteDialogAlert(DialogsActivity.this, action == clear, chat, user, lower_id == 0, (param) -> {
|
if (canDeletePsaSelected) {
|
||||||
hideActionMode(false);
|
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
|
||||||
if (action == clear && ChatObject.isChannel(chat) && (!chat.megagroup || !TextUtils.isEmpty(chat.username))) {
|
builder.setTitle(LocaleController.getString("PsaHideChatAlertTitle", R.string.PsaHideChatAlertTitle));
|
||||||
getMessagesController().deleteDialog(selectedDialog, 2, param);
|
builder.setMessage(LocaleController.getString("PsaHideChatAlertText", R.string.PsaHideChatAlertText));
|
||||||
} else {
|
builder.setPositiveButton(LocaleController.getString("PsaHide", R.string.PsaHide), (dialog1, which) -> {
|
||||||
if (action == delete && folderId != 0 && getDialogsArray(currentAccount, viewPages[0].dialogsType, folderId, false).size() == 1) {
|
getMessagesController().hidePromoDialog();
|
||||||
viewPages[0].progressView.setVisibility(View.INVISIBLE);
|
hideActionMode(false);
|
||||||
}
|
});
|
||||||
getUndoView().showWithAction(selectedDialog, action == clear ? UndoView.ACTION_CLEAR : UndoView.ACTION_DELETE, () -> {
|
builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
|
||||||
if (action == clear) {
|
showDialog(builder.create());
|
||||||
getMessagesController().deleteDialog(selectedDialog, 1, param);
|
} else {
|
||||||
} else {
|
AlertsCreator.createClearOrDeleteDialogAlert(DialogsActivity.this, action == clear, chat, user, lower_id == 0, (param) -> {
|
||||||
if (chat != null) {
|
hideActionMode(false);
|
||||||
if (ChatObject.isNotInChat(chat)) {
|
if (action == clear && ChatObject.isChannel(chat) && (!chat.megagroup || !TextUtils.isEmpty(chat.username))) {
|
||||||
getMessagesController().deleteDialog(selectedDialog, 0, param);
|
getMessagesController().deleteDialog(selectedDialog, 2, param);
|
||||||
} else {
|
} else {
|
||||||
TLRPC.User currentUser = getMessagesController().getUser(getUserConfig().getClientUserId());
|
if (action == delete && folderId != 0 && getDialogsArray(currentAccount, viewPages[0].dialogsType, folderId, false).size() == 1) {
|
||||||
getMessagesController().deleteUserFromChat((int) -selectedDialog, currentUser, null);
|
viewPages[0].progressView.setVisibility(View.INVISIBLE);
|
||||||
}
|
|
||||||
} else {
|
|
||||||
getMessagesController().deleteDialog(selectedDialog, 0, param);
|
|
||||||
if (isBot) {
|
|
||||||
getMessagesController().blockUser((int) selectedDialog);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (AndroidUtilities.isTablet()) {
|
|
||||||
getNotificationCenter().postNotificationName(NotificationCenter.closeChats, selectedDialog);
|
|
||||||
}
|
|
||||||
MessagesController.getInstance(currentAccount).checkIfFolderEmpty(folderId);
|
|
||||||
}
|
}
|
||||||
});
|
getUndoView().showWithAction(selectedDialog, action == clear ? UndoView.ACTION_CLEAR : UndoView.ACTION_DELETE, () -> {
|
||||||
}
|
if (action == clear) {
|
||||||
});
|
getMessagesController().deleteDialog(selectedDialog, 1, param);
|
||||||
|
} else {
|
||||||
|
if (chat != null) {
|
||||||
|
if (ChatObject.isNotInChat(chat)) {
|
||||||
|
getMessagesController().deleteDialog(selectedDialog, 0, param);
|
||||||
|
} else {
|
||||||
|
TLRPC.User currentUser = getMessagesController().getUser(getUserConfig().getClientUserId());
|
||||||
|
getMessagesController().deleteUserFromChat((int) -selectedDialog, currentUser, null);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
getMessagesController().deleteDialog(selectedDialog, 0, param);
|
||||||
|
if (isBot) {
|
||||||
|
getMessagesController().blockUser((int) selectedDialog);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (AndroidUtilities.isTablet()) {
|
||||||
|
getNotificationCenter().postNotificationName(NotificationCenter.closeChats, selectedDialog);
|
||||||
|
}
|
||||||
|
MessagesController.getInstance(currentAccount).checkIfFolderEmpty(folderId);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
if (action == clear && canClearCacheCount != 0) {
|
if (getMessagesController().isPromoDialog(selectedDialog, true)) {
|
||||||
getMessagesController().deleteDialog(selectedDialog, 2, false);
|
getMessagesController().hidePromoDialog();
|
||||||
} else {
|
} else {
|
||||||
if (action == clear) {
|
if (action == clear && canClearCacheCount != 0) {
|
||||||
getMessagesController().deleteDialog(selectedDialog, 1, false);
|
getMessagesController().deleteDialog(selectedDialog, 2, false);
|
||||||
} else {
|
} else {
|
||||||
if (chat != null) {
|
if (action == clear) {
|
||||||
if (ChatObject.isNotInChat(chat)) {
|
getMessagesController().deleteDialog(selectedDialog, 1, false);
|
||||||
getMessagesController().deleteDialog(selectedDialog, 0, false);
|
|
||||||
} else {
|
|
||||||
TLRPC.User currentUser = getMessagesController().getUser(getUserConfig().getClientUserId());
|
|
||||||
getMessagesController().deleteUserFromChat((int) -selectedDialog, currentUser, null);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
getMessagesController().deleteDialog(selectedDialog, 0, false);
|
if (chat != null) {
|
||||||
if (isBot) {
|
if (ChatObject.isNotInChat(chat)) {
|
||||||
getMessagesController().blockUser((int) selectedDialog);
|
getMessagesController().deleteDialog(selectedDialog, 0, false);
|
||||||
|
} else {
|
||||||
|
TLRPC.User currentUser = getMessagesController().getUser(getUserConfig().getClientUserId());
|
||||||
|
getMessagesController().deleteUserFromChat((int) -selectedDialog, currentUser, null);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
getMessagesController().deleteDialog(selectedDialog, 0, false);
|
||||||
|
if (isBot) {
|
||||||
|
getMessagesController().blockUser((int) selectedDialog);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (AndroidUtilities.isTablet()) {
|
||||||
|
getNotificationCenter().postNotificationName(NotificationCenter.closeChats, selectedDialog);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (AndroidUtilities.isTablet()) {
|
|
||||||
getNotificationCenter().postNotificationName(NotificationCenter.closeChats, selectedDialog);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4186,6 +4216,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
|
||||||
int canDeleteCount = 0;
|
int canDeleteCount = 0;
|
||||||
int canUnpinCount = 0;
|
int canUnpinCount = 0;
|
||||||
int canArchiveCount = 0;
|
int canArchiveCount = 0;
|
||||||
|
canDeletePsaSelected = false;
|
||||||
canUnarchiveCount = 0;
|
canUnarchiveCount = 0;
|
||||||
canUnmuteCount = 0;
|
canUnmuteCount = 0;
|
||||||
canMuteCount = 0;
|
canMuteCount = 0;
|
||||||
|
@ -4221,7 +4252,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
|
||||||
|
|
||||||
if (folderId == 1 || dialog.folder_id == 1) {
|
if (folderId == 1 || dialog.folder_id == 1) {
|
||||||
canUnarchiveCount++;
|
canUnarchiveCount++;
|
||||||
} else if (selectedDialog != selfUserId && selectedDialog != 777000 && !getMessagesController().isProxyDialog(selectedDialog, false)) {
|
} else if (selectedDialog != selfUserId && selectedDialog != 777000 && !getMessagesController().isPromoDialog(selectedDialog, false)) {
|
||||||
canArchiveCount++;
|
canArchiveCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4244,8 +4275,12 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
|
||||||
if (DialogObject.isChannel(dialog)) {
|
if (DialogObject.isChannel(dialog)) {
|
||||||
final TLRPC.Chat chat = getMessagesController().getChat(-lower_id);
|
final TLRPC.Chat chat = getMessagesController().getChat(-lower_id);
|
||||||
CharSequence[] items;
|
CharSequence[] items;
|
||||||
if (getMessagesController().isProxyDialog(dialog.id, true)) {
|
if (getMessagesController().isPromoDialog(dialog.id, true)) {
|
||||||
canClearCacheCount++;
|
canClearCacheCount++;
|
||||||
|
if (getMessagesController().promoDialogType == MessagesController.PROMO_TYPE_PSA) {
|
||||||
|
canDeleteCount++;
|
||||||
|
canDeletePsaSelected = true;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if (pinned) {
|
if (pinned) {
|
||||||
canUnpinCount++;
|
canUnpinCount++;
|
||||||
|
@ -5418,6 +5453,12 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
|
||||||
arrayList.add(new ThemeDescription(viewPages[a].listView, 0, new Class[]{DialogCell.class}, new RLottieDrawable[]{Theme.dialogs_archiveDrawable}, "Box2", Theme.key_chats_archiveIcon));
|
arrayList.add(new ThemeDescription(viewPages[a].listView, 0, new Class[]{DialogCell.class}, new RLottieDrawable[]{Theme.dialogs_archiveDrawable}, "Box2", Theme.key_chats_archiveIcon));
|
||||||
arrayList.add(new ThemeDescription(viewPages[a].listView, 0, new Class[]{DialogCell.class}, new RLottieDrawable[]{Theme.dialogs_archiveDrawable}, "Box1", Theme.key_chats_archiveIcon));
|
arrayList.add(new ThemeDescription(viewPages[a].listView, 0, new Class[]{DialogCell.class}, new RLottieDrawable[]{Theme.dialogs_archiveDrawable}, "Box1", Theme.key_chats_archiveIcon));
|
||||||
|
|
||||||
|
arrayList.add(new ThemeDescription(viewPages[a].listView, 0, new Class[]{DialogCell.class}, new RLottieDrawable[]{Theme.dialogs_hidePsaDrawable}, "Line 1", Theme.key_chats_archiveBackground));
|
||||||
|
arrayList.add(new ThemeDescription(viewPages[a].listView, 0, new Class[]{DialogCell.class}, new RLottieDrawable[]{Theme.dialogs_hidePsaDrawable}, "Line 2", Theme.key_chats_archiveBackground));
|
||||||
|
arrayList.add(new ThemeDescription(viewPages[a].listView, 0, new Class[]{DialogCell.class}, new RLottieDrawable[]{Theme.dialogs_hidePsaDrawable}, "Line 3", Theme.key_chats_archiveBackground));
|
||||||
|
arrayList.add(new ThemeDescription(viewPages[a].listView, 0, new Class[]{DialogCell.class}, new RLottieDrawable[]{Theme.dialogs_hidePsaDrawable}, "Cup Red", Theme.key_chats_archiveIcon));
|
||||||
|
arrayList.add(new ThemeDescription(viewPages[a].listView, 0, new Class[]{DialogCell.class}, new RLottieDrawable[]{Theme.dialogs_hidePsaDrawable}, "Box", Theme.key_chats_archiveIcon));
|
||||||
|
|
||||||
arrayList.add(new ThemeDescription(viewPages[a].listView, 0, new Class[]{DialogCell.class}, new RLottieDrawable[]{Theme.dialogs_unarchiveDrawable}, "Arrow1", Theme.key_chats_archiveIcon));
|
arrayList.add(new ThemeDescription(viewPages[a].listView, 0, new Class[]{DialogCell.class}, new RLottieDrawable[]{Theme.dialogs_unarchiveDrawable}, "Arrow1", Theme.key_chats_archiveIcon));
|
||||||
arrayList.add(new ThemeDescription(viewPages[a].listView, 0, new Class[]{DialogCell.class}, new RLottieDrawable[]{Theme.dialogs_unarchiveDrawable}, "Arrow2", Theme.key_chats_archivePinBackground));
|
arrayList.add(new ThemeDescription(viewPages[a].listView, 0, new Class[]{DialogCell.class}, new RLottieDrawable[]{Theme.dialogs_unarchiveDrawable}, "Arrow2", Theme.key_chats_archivePinBackground));
|
||||||
arrayList.add(new ThemeDescription(viewPages[a].listView, 0, new Class[]{DialogCell.class}, new RLottieDrawable[]{Theme.dialogs_unarchiveDrawable}, "Box2", Theme.key_chats_archiveIcon));
|
arrayList.add(new ThemeDescription(viewPages[a].listView, 0, new Class[]{DialogCell.class}, new RLottieDrawable[]{Theme.dialogs_unarchiveDrawable}, "Box2", Theme.key_chats_archiveIcon));
|
||||||
|
|
|
@ -1077,7 +1077,7 @@ public class LoginActivity extends BaseFragment {
|
||||||
MessagesStorage.getInstance(currentAccount).putUsersAndChats(users, null, true, true);
|
MessagesStorage.getInstance(currentAccount).putUsersAndChats(users, null, true, true);
|
||||||
MessagesController.getInstance(currentAccount).putUser(res.user, false);
|
MessagesController.getInstance(currentAccount).putUser(res.user, false);
|
||||||
ContactsController.getInstance(currentAccount).checkAppAccount();
|
ContactsController.getInstance(currentAccount).checkAppAccount();
|
||||||
MessagesController.getInstance(currentAccount).checkProxyInfo(true);
|
MessagesController.getInstance(currentAccount).checkPromoInfo(true);
|
||||||
ConnectionsManager.getInstance(currentAccount).updateDcSettings();
|
ConnectionsManager.getInstance(currentAccount).updateDcSettings();
|
||||||
needFinishActivity(afterSignup);
|
needFinishActivity(afterSignup);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1380,8 +1380,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
|
||||||
did = -chat_id;
|
did = -chat_id;
|
||||||
}
|
}
|
||||||
ArrayList<Integer> users = chatInfo != null && chatInfo.participants != null && chatInfo.participants.participants.size() > 5 ? sortedUsers : null;
|
ArrayList<Integer> users = chatInfo != null && chatInfo.participants != null && chatInfo.participants.participants.size() > 5 ? sortedUsers : null;
|
||||||
TLRPC.ChatFull chatFull = users != null ? chatInfo : null;
|
sharedMediaLayout = new SharedMediaLayout(context, did, sharedMediaPreloader, userInfo != null ? userInfo.common_chats_count : 0, sortedUsers, chatInfo, users != null, this) {
|
||||||
sharedMediaLayout = new SharedMediaLayout(context, did, sharedMediaPreloader, userInfo != null ? userInfo.common_chats_count : 0, sortedUsers, chatFull, this) {
|
|
||||||
@Override
|
@Override
|
||||||
protected void onSelectedTabChanged() {
|
protected void onSelectedTabChanged() {
|
||||||
updateSelectedMediaTabText();
|
updateSelectedMediaTabText();
|
||||||
|
@ -3695,6 +3694,9 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
|
||||||
mergeDialogId = -chatInfo.migrated_from_chat_id;
|
mergeDialogId = -chatInfo.migrated_from_chat_id;
|
||||||
MediaDataController.getInstance(currentAccount).getMediaCounts(mergeDialogId, classGuid);
|
MediaDataController.getInstance(currentAccount).getMediaCounts(mergeDialogId, classGuid);
|
||||||
}
|
}
|
||||||
|
if (sharedMediaLayout != null) {
|
||||||
|
sharedMediaLayout.setChatInfo(chatInfo);
|
||||||
|
}
|
||||||
fetchUsersFromChannelInfo();
|
fetchUsersFromChannelInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
BIN
TMessagesProj/src/main/res/drawable-hdpi/msg_psa.png
Normal file
BIN
TMessagesProj/src/main/res/drawable-hdpi/msg_psa.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 843 B |
BIN
TMessagesProj/src/main/res/drawable-mdpi/msg_psa.png
Normal file
BIN
TMessagesProj/src/main/res/drawable-mdpi/msg_psa.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 519 B |
BIN
TMessagesProj/src/main/res/drawable-xhdpi/msg_psa.png
Normal file
BIN
TMessagesProj/src/main/res/drawable-xhdpi/msg_psa.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
BIN
TMessagesProj/src/main/res/drawable-xxhdpi/msg_psa.png
Normal file
BIN
TMessagesProj/src/main/res/drawable-xxhdpi/msg_psa.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.8 KiB |
|
@ -976,7 +976,18 @@
|
||||||
<string name="DiceInfo2">Send a **:dice:** emoji to any chat to roll a die.</string>
|
<string name="DiceInfo2">Send a **:dice:** emoji to any chat to roll a die.</string>
|
||||||
<string name="DartInfo">Send a **:darts:** emoji to try your luck.</string>
|
<string name="DartInfo">Send a **:darts:** emoji to try your luck.</string>
|
||||||
<string name="DiceEmojiInfo">Send a %1$s emoji to try your luck.</string>
|
<string name="DiceEmojiInfo">Send a %1$s emoji to try your luck.</string>
|
||||||
<string name="SendDice">SEND</string>Send a dart emoji
|
<string name="SendDice">SEND</string>
|
||||||
|
<string name="PsaType_covid">PSA</string>
|
||||||
|
<string name="PsaTypeDefault">PSA</string>
|
||||||
|
<string name="PsaInfo_covid">This message provides you with a public service announcement in relation to the ungoing Covid-19 pandemic. Learn more about this initiative at https://telegram.org/blog/coronavirus</string>
|
||||||
|
<string name="PsaInfoDefault">PSA info test</string>
|
||||||
|
<string name="PsaMessage_covid">Covid-19 Notification</string>
|
||||||
|
<string name="PsaMessageInfo_covid">This message provides you with a public service announcement in relation to the ungoing Covid-19 pandemic. Learn more about this initiative at https://telegram.org/blog/coronavirus</string>
|
||||||
|
<string name="PsaMessageDefault">Important Notification</string>
|
||||||
|
<string name="PsaMessageInfoDefault">This is an important notification.</string>
|
||||||
|
<string name="PsaHideChatAlertTitle">Hide chat</string>
|
||||||
|
<string name="PsaHideChatAlertText">Are you sure you want to hide the selected chat?</string>
|
||||||
|
<string name="PsaHide">Hide</string>
|
||||||
<!--notification-->
|
<!--notification-->
|
||||||
<string name="MessageLifetimeChanged">%1$s set the self-destruct timer to %2$s</string>
|
<string name="MessageLifetimeChanged">%1$s set the self-destruct timer to %2$s</string>
|
||||||
<string name="MessageLifetimeChangedOutgoing">You set the self-destruct timer to %1$s</string>
|
<string name="MessageLifetimeChangedOutgoing">You set the self-destruct timer to %1$s</string>
|
||||||
|
|
Loading…
Reference in a new issue