mirror of
https://github.com/DrKLO/Telegram.git
synced 2024-12-22 06:25:14 +01:00
Update to 7.5.0 (2245)
This commit is contained in:
parent
31b580133f
commit
c44841a55b
31 changed files with 197 additions and 55 deletions
|
@ -288,7 +288,7 @@ android {
|
|||
}
|
||||
}
|
||||
|
||||
defaultConfig.versionCode = 2244
|
||||
defaultConfig.versionCode = 2245
|
||||
|
||||
applicationVariants.all { variant ->
|
||||
variant.outputs.all { output ->
|
||||
|
|
|
@ -395,7 +395,7 @@ target_compile_definitions(sqlite PUBLIC
|
|||
#voip
|
||||
include(${CMAKE_HOME_DIRECTORY}/voip/CMakeLists.txt)
|
||||
|
||||
set(NATIVE_LIB "tmessages.35")
|
||||
set(NATIVE_LIB "tmessages.36")
|
||||
|
||||
#tmessages
|
||||
add_library(${NATIVE_LIB} SHARED
|
||||
|
|
|
@ -210,8 +210,8 @@ void updateDcSettings(JNIEnv *env, jclass c, jint instanceNum) {
|
|||
ConnectionsManager::getInstance(instanceNum).updateDcSettings(0, false);
|
||||
}
|
||||
|
||||
void setUseIpv6(JNIEnv *env, jclass c, jint instanceNum, jboolean value) {
|
||||
ConnectionsManager::getInstance(instanceNum).setUseIpv6(value);
|
||||
void setIpStrategy(JNIEnv *env, jclass c, jint instanceNum, jbyte value) {
|
||||
ConnectionsManager::getInstance(instanceNum).setIpStrategy((uint8_t) value);
|
||||
}
|
||||
|
||||
void setNetworkAvailable(JNIEnv *env, jclass c, jint instanceNum, jboolean value, jint networkType, jboolean slow) {
|
||||
|
@ -448,7 +448,7 @@ static JNINativeMethod ConnectionsManagerMethods[] = {
|
|||
{"native_pauseNetwork", "(I)V", (void *) pauseNetwork},
|
||||
{"native_resumeNetwork", "(IZ)V", (void *) resumeNetwork},
|
||||
{"native_updateDcSettings", "(I)V", (void *) updateDcSettings},
|
||||
{"native_setUseIpv6", "(IZ)V", (void *) setUseIpv6},
|
||||
{"native_setIpStrategy", "(IB)V", (void *) setIpStrategy},
|
||||
{"native_setNetworkAvailable", "(IZIZ)V", (void *) setNetworkAvailable},
|
||||
{"native_setPushConnectionEnabled", "(IZ)V", (void *) setPushConnectionEnabled},
|
||||
{"native_setJava", "(Z)V", (void *) setJava},
|
||||
|
|
|
@ -292,7 +292,17 @@ void Connection::connect() {
|
|||
connectionInProcess = true;
|
||||
connectionState = TcpConnectionStageConnecting;
|
||||
isMediaConnection = false;
|
||||
uint32_t ipv6 = ConnectionsManager::getInstance(currentDatacenter->instanceNum).isIpv6Enabled() ? TcpAddressFlagIpv6 : 0;
|
||||
uint8_t strategy = ConnectionsManager::getInstance(currentDatacenter->instanceNum).getIpStratagy();
|
||||
uint32_t ipv6;
|
||||
if (strategy == USE_IPV6_ONLY) {
|
||||
ipv6 = TcpAddressFlagIpv6;
|
||||
} else if (strategy == USE_IPV4_IPV6_RANDOM) {
|
||||
uint8_t value;
|
||||
RAND_bytes(&value, 1);
|
||||
ipv6 = value % 2 == 0 ? TcpAddressFlagIpv6 : 0;
|
||||
} else {
|
||||
ipv6 = 0;
|
||||
}
|
||||
uint32_t isStatic = connectionType == ConnectionTypeProxy || !ConnectionsManager::getInstance(currentDatacenter->instanceNum).proxyAddress.empty() ? TcpAddressFlagStatic : 0;
|
||||
TcpAddress *tcpAddress = nullptr;
|
||||
if (isMediaConnectionType(connectionType)) {
|
||||
|
|
|
@ -1660,8 +1660,8 @@ void ConnectionsManager::sendPing(Datacenter *datacenter, bool usePushConnection
|
|||
connection->sendData(transportData, false, true);
|
||||
}
|
||||
|
||||
bool ConnectionsManager::isIpv6Enabled() {
|
||||
return ipv6Enabled;
|
||||
uint8_t ConnectionsManager::getIpStratagy() {
|
||||
return ipStrategy;
|
||||
}
|
||||
|
||||
void ConnectionsManager::initDatacenters() {
|
||||
|
@ -3419,9 +3419,9 @@ void ConnectionsManager::setNetworkAvailable(bool value, int32_t type, bool slow
|
|||
});
|
||||
}
|
||||
|
||||
void ConnectionsManager::setUseIpv6(bool value) {
|
||||
void ConnectionsManager::setIpStrategy(uint8_t value) {
|
||||
scheduleTask([&, value] {
|
||||
ipv6Enabled = value;
|
||||
ipStrategy = value;
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@ public:
|
|||
void resumeNetwork(bool partial);
|
||||
void pauseNetwork();
|
||||
void setNetworkAvailable(bool value, int32_t type, bool slow);
|
||||
void setUseIpv6(bool value);
|
||||
void setIpStrategy(uint8_t value);
|
||||
void init(uint32_t version, int32_t layer, int32_t apiId, std::string deviceModel, std::string systemVersion, std::string appVersion, std::string langCode, std::string systemLangCode, std::string configPath, std::string logPath, std::string regId, std::string cFingerprint, std::string installerId, int32_t timezoneOffset, int32_t userId, bool isPaused, bool enablePushConnection, bool hasNetwork, int32_t networkType);
|
||||
void setProxySettings(std::string address, uint16_t port, std::string username, std::string password, std::string secret);
|
||||
void setLangCode(std::string langCode);
|
||||
|
@ -123,7 +123,7 @@ private:
|
|||
void onDatacenterHandshakeComplete(Datacenter *datacenter, HandshakeType type, int32_t timeDiff);
|
||||
void onDatacenterExportAuthorizationComplete(Datacenter *datacenter);
|
||||
int64_t generateMessageId();
|
||||
bool isIpv6Enabled();
|
||||
uint8_t getIpStratagy();
|
||||
bool isNetworkAvailable();
|
||||
|
||||
void scheduleCheckProxyInternal(ProxyCheckInfo *proxyCheckInfo);
|
||||
|
@ -192,7 +192,7 @@ private:
|
|||
int64_t lastOutgoingMessageId = 0;
|
||||
bool networkAvailable = true;
|
||||
bool networkSlow = false;
|
||||
bool ipv6Enabled = false;
|
||||
uint8_t ipStrategy = USE_IPV4_ONLY;
|
||||
std::vector<ConnectionSocket *> activeConnections;
|
||||
std::vector<ConnectionSocket *> activeConnectionsCopy;
|
||||
int epolFd;
|
||||
|
|
|
@ -1477,7 +1477,8 @@ bool Datacenter::isExportingAuthorization() {
|
|||
|
||||
bool Datacenter::hasMediaAddress() {
|
||||
std::vector<TcpAddress> *addresses;
|
||||
if (ConnectionsManager::getInstance(instanceNum).isIpv6Enabled()) {
|
||||
int strategy = ConnectionsManager::getInstance(instanceNum).getIpStratagy();
|
||||
if (strategy == USE_IPV6_ONLY) {
|
||||
addresses = &addressesIpv6Download;
|
||||
} else {
|
||||
addresses = &addressesIpv4Download;
|
||||
|
|
|
@ -31,6 +31,10 @@
|
|||
#define MAX_ACCOUNT_COUNT 3
|
||||
#define USE_DELEGATE_HOST_RESOLVE
|
||||
|
||||
#define USE_IPV4_ONLY 0
|
||||
#define USE_IPV6_ONLY 1
|
||||
#define USE_IPV4_IPV6_RANDOM 2
|
||||
|
||||
#define NETWORK_TYPE_MOBILE 0
|
||||
#define NETWORK_TYPE_WIFI 1
|
||||
#define NETWORK_TYPE_ROAMING 2
|
||||
|
|
|
@ -18,7 +18,7 @@ public class BuildVars {
|
|||
public static boolean LOGS_ENABLED = false;
|
||||
public static boolean USE_CLOUD_STRINGS = true;
|
||||
public static boolean CHECK_UPDATES = true;
|
||||
public static int BUILD_VERSION = 2244;
|
||||
public static int BUILD_VERSION = 2245;
|
||||
public static String BUILD_VERSION_STRING = "7.5.0";
|
||||
public static int APP_ID = 4;
|
||||
public static String APP_HASH = "014b35b6184100b085b0d0572f9b5103";
|
||||
|
|
|
@ -41,6 +41,7 @@ public class ChatsWidgetProvider extends AppWidgetProvider {
|
|||
@Override
|
||||
public void onDeleted(Context context, int[] appWidgetIds) {
|
||||
super.onDeleted(context, appWidgetIds);
|
||||
ApplicationLoader.postInitApplication();
|
||||
SharedPreferences preferences = context.getSharedPreferences("shortcut_widget", Activity.MODE_PRIVATE);
|
||||
SharedPreferences.Editor editor = preferences.edit();
|
||||
for (int a = 0; a < appWidgetIds.length; a++) {
|
||||
|
@ -58,15 +59,16 @@ public class ChatsWidgetProvider extends AppWidgetProvider {
|
|||
|
||||
private static int getCellsForSize(int size) {
|
||||
int n = 2;
|
||||
while (70 * n - 30 < size) {
|
||||
while (72 * n < size) {
|
||||
++n;
|
||||
}
|
||||
return n - 1;
|
||||
}
|
||||
|
||||
public static void updateWidget(Context context, AppWidgetManager appWidgetManager, int appWidgetId, boolean edit) {
|
||||
ApplicationLoader.postInitApplication();
|
||||
Bundle options = appWidgetManager.getAppWidgetOptions(appWidgetId);
|
||||
int minHeight = options.getInt(AppWidgetManager.OPTION_APPWIDGET_MIN_HEIGHT);
|
||||
int minHeight = options.getInt(AppWidgetManager.OPTION_APPWIDGET_MAX_HEIGHT);
|
||||
int rows = getCellsForSize(minHeight);
|
||||
|
||||
Intent intent2 = new Intent(context, ChatsWidgetService.class);
|
||||
|
|
|
@ -35,6 +35,7 @@ public class ContactsWidgetProvider extends AppWidgetProvider {
|
|||
@Override
|
||||
public void onDeleted(Context context, int[] appWidgetIds) {
|
||||
super.onDeleted(context, appWidgetIds);
|
||||
ApplicationLoader.postInitApplication();
|
||||
SharedPreferences preferences = context.getSharedPreferences("shortcut_widget", Activity.MODE_PRIVATE);
|
||||
SharedPreferences.Editor editor = preferences.edit();
|
||||
for (int a = 0; a < appWidgetIds.length; a++) {
|
||||
|
@ -58,16 +59,17 @@ public class ContactsWidgetProvider extends AppWidgetProvider {
|
|||
|
||||
private static int getCellsForSize(int size) {
|
||||
int n = 2;
|
||||
while (86 * n - 30 < size) {
|
||||
while (86 * n < size) {
|
||||
++n;
|
||||
}
|
||||
return n - 1;
|
||||
}
|
||||
|
||||
public static void updateWidget(Context context, AppWidgetManager appWidgetManager, int appWidgetId, boolean edit) {
|
||||
ApplicationLoader.postInitApplication();
|
||||
Bundle options = appWidgetManager.getAppWidgetOptions(appWidgetId);
|
||||
int minHeight = options.getInt(AppWidgetManager.OPTION_APPWIDGET_MIN_HEIGHT);
|
||||
int rows = getCellsForSize(minHeight);
|
||||
int maxHeight = options.getInt(AppWidgetManager.OPTION_APPWIDGET_MAX_HEIGHT);
|
||||
int rows = getCellsForSize(maxHeight);
|
||||
|
||||
Intent intent2 = new Intent(context, ContactsWidgetService.class);
|
||||
intent2.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId);
|
||||
|
|
|
@ -120,9 +120,13 @@ class ContactsRemoteViewsFactory implements RemoteViewsService.RemoteViewsFactor
|
|||
}
|
||||
} else {
|
||||
chat = accountInstance.getMessagesController().getChat(-(int) (long) id);
|
||||
name = chat.title;
|
||||
if (chat.photo != null && chat.photo.photo_small != null && chat.photo.photo_small.volume_id != 0 && chat.photo.photo_small.local_id != 0) {
|
||||
photoPath = chat.photo.photo_small;
|
||||
if (chat != null) {
|
||||
name = chat.title;
|
||||
if (chat.photo != null && chat.photo.photo_small != null && chat.photo.photo_small.volume_id != 0 && chat.photo.photo_small.local_id != 0) {
|
||||
photoPath = chat.photo.photo_small;
|
||||
}
|
||||
} else {
|
||||
name = "";
|
||||
}
|
||||
}
|
||||
rv.setTextViewText(a == 0 ? R.id.contacts_widget_item_text1 : R.id.contacts_widget_item_text2, name);
|
||||
|
@ -175,7 +179,13 @@ class ContactsRemoteViewsFactory implements RemoteViewsService.RemoteViewsFactor
|
|||
TLRPC.Dialog dialog = dialogs.get(id);
|
||||
|
||||
if (dialog != null && dialog.unread_count > 0) {
|
||||
rv.setTextViewText(a == 0 ? R.id.contacts_widget_item_badge1 : R.id.contacts_widget_item_badge2, String.format("%d", dialog.unread_count));
|
||||
String count;
|
||||
if (dialog.unread_count > 99) {
|
||||
count = String.format("%d+", 99);
|
||||
} else {
|
||||
count = String.format("%d", dialog.unread_count);
|
||||
}
|
||||
rv.setTextViewText(a == 0 ? R.id.contacts_widget_item_badge1 : R.id.contacts_widget_item_badge2, count);
|
||||
rv.setViewVisibility(a == 0 ? R.id.contacts_widget_item_badge_bg1 : R.id.contacts_widget_item_badge_bg2, View.VISIBLE);
|
||||
} else {
|
||||
rv.setViewVisibility(a == 0 ? R.id.contacts_widget_item_badge_bg1 : R.id.contacts_widget_item_badge_bg2, View.GONE);
|
||||
|
|
|
@ -3486,7 +3486,7 @@ public class MessagesController extends BaseController implements NotificationCe
|
|||
editor.remove("dialog_bar_distance" + dialogId);
|
||||
}
|
||||
}
|
||||
editor.commit();
|
||||
editor.apply();
|
||||
getNotificationCenter().postNotificationName(NotificationCenter.peerSettingsDidLoad, dialogId);
|
||||
}
|
||||
|
||||
|
@ -9713,6 +9713,9 @@ public class MessagesController extends BaseController implements NotificationCe
|
|||
|
||||
for (int a = 0; a < res.new_messages.size(); a++) {
|
||||
TLRPC.Message message = res.new_messages.get(a);
|
||||
if (message instanceof TLRPC.TL_messageEmpty) {
|
||||
continue;
|
||||
}
|
||||
message.unread = !(channelFinal != null && channelFinal.left || (message.out ? outboxValue : inboxValue) >= message.id || message.action instanceof TLRPC.TL_messageActionChannelCreate);
|
||||
|
||||
boolean isDialogCreated = createdDialogIds.contains(dialog_id);
|
||||
|
@ -9949,6 +9952,9 @@ public class MessagesController extends BaseController implements NotificationCe
|
|||
int clientUserId = getUserConfig().getClientUserId();
|
||||
for (int a = 0; a < res.new_messages.size(); a++) {
|
||||
TLRPC.Message message = res.new_messages.get(a);
|
||||
if (message instanceof TLRPC.TL_messageEmpty) {
|
||||
continue;
|
||||
}
|
||||
MessageObject.getDialogId(message);
|
||||
|
||||
if ((int) message.dialog_id != 0) {
|
||||
|
@ -11355,6 +11361,9 @@ public class MessagesController extends BaseController implements NotificationCe
|
|||
message.out = true;
|
||||
}
|
||||
}
|
||||
if (message instanceof TLRPC.TL_messageEmpty) {
|
||||
continue;
|
||||
}
|
||||
TLRPC.Chat chat = null;
|
||||
int chat_id = 0;
|
||||
int user_id = 0;
|
||||
|
|
|
@ -8267,6 +8267,9 @@ public class MessagesStorage extends BaseController {
|
|||
|
||||
for (int a = 0; a < messages.size(); a++) {
|
||||
TLRPC.Message message = messages.get(a);
|
||||
if (message instanceof TLRPC.TL_messageEmpty) {
|
||||
continue;
|
||||
}
|
||||
fixUnsupportedMedia(message);
|
||||
|
||||
state_messages.requery();
|
||||
|
@ -10166,6 +10169,9 @@ public class MessagesStorage extends BaseController {
|
|||
int count = messages.messages.size();
|
||||
for (int a = 0; a < count; a++) {
|
||||
TLRPC.Message message = messages.messages.get(a);
|
||||
if (message instanceof TLRPC.TL_messageEmpty) {
|
||||
continue;
|
||||
}
|
||||
|
||||
long messageId = message.id;
|
||||
if (channelId == 0) {
|
||||
|
|
|
@ -22,7 +22,7 @@ import java.util.zip.ZipFile;
|
|||
|
||||
public class NativeLoader {
|
||||
|
||||
private final static int LIB_VERSION = 35;
|
||||
private final static int LIB_VERSION = 36;
|
||||
private final static String LIB_NAME = "tmessages." + LIB_VERSION;
|
||||
private final static String LIB_SO_NAME = "lib" + LIB_NAME + ".so";
|
||||
private final static String LOCALE_LIB_SO_NAME = "lib" + LIB_NAME + "loc.so";
|
||||
|
|
|
@ -1598,6 +1598,9 @@ public class SendMessagesHelper extends BaseController implements NotificationCe
|
|||
newMsg.flags |= 8388608;
|
||||
}
|
||||
newMsg.message = msgObj.messageOwner.message;
|
||||
if (newMsg.message == null) {
|
||||
newMsg.message = "";
|
||||
}
|
||||
newMsg.fwd_msg_id = msgObj.getId();
|
||||
newMsg.attachPath = msgObj.messageOwner.attachPath;
|
||||
newMsg.entities = msgObj.messageOwner.entities;
|
||||
|
|
|
@ -82,6 +82,10 @@ public class ConnectionsManager extends BaseController {
|
|||
public final static int ConnectionStateConnectingToProxy = 4;
|
||||
public final static int ConnectionStateUpdating = 5;
|
||||
|
||||
public final static byte USE_IPV4_ONLY = 0;
|
||||
public final static byte USE_IPV6_ONLY = 1;
|
||||
public final static byte USE_IPV4_IPV6_RANDOM = 2;
|
||||
|
||||
private static long lastDnsRequestTime;
|
||||
|
||||
public final static int DEFAULT_DATACENTER_ID = Integer.MAX_VALUE;
|
||||
|
@ -333,7 +337,7 @@ public class ConnectionsManager extends BaseController {
|
|||
}
|
||||
|
||||
public void checkConnection() {
|
||||
native_setUseIpv6(currentAccount, useIpv6Address());
|
||||
native_setIpStrategy(currentAccount, getIpStrategy());
|
||||
native_setNetworkAvailable(currentAccount, ApplicationLoader.isNetworkOnline(), ApplicationLoader.getCurrentNetworkType(), ApplicationLoader.isConnectionSlow());
|
||||
}
|
||||
|
||||
|
@ -656,7 +660,7 @@ public class ConnectionsManager extends BaseController {
|
|||
public static native void native_switchBackend(int currentAccount);
|
||||
public static native int native_isTestBackend(int currentAccount);
|
||||
public static native void native_pauseNetwork(int currentAccount);
|
||||
public static native void native_setUseIpv6(int currentAccount, boolean value);
|
||||
public static native void native_setIpStrategy(int currentAccount, byte value);
|
||||
public static native void native_updateDcSettings(int currentAccount);
|
||||
public static native void native_setNetworkAvailable(int currentAccount, boolean value, int networkType, boolean slow);
|
||||
public static native void native_resumeNetwork(int currentAccount, boolean partial);
|
||||
|
@ -701,9 +705,9 @@ public class ConnectionsManager extends BaseController {
|
|||
}
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
protected static boolean useIpv6Address() {
|
||||
protected static byte getIpStrategy() {
|
||||
if (Build.VERSION.SDK_INT < 19) {
|
||||
return false;
|
||||
return USE_IPV4_ONLY;
|
||||
}
|
||||
if (BuildVars.LOGS_ENABLED) {
|
||||
try {
|
||||
|
@ -741,6 +745,7 @@ public class ConnectionsManager extends BaseController {
|
|||
Enumeration<NetworkInterface> networkInterfaces = NetworkInterface.getNetworkInterfaces();
|
||||
boolean hasIpv4 = false;
|
||||
boolean hasIpv6 = false;
|
||||
boolean hasStrangeIpv4 = false;
|
||||
while (networkInterfaces.hasMoreElements()) {
|
||||
networkInterface = networkInterfaces.nextElement();
|
||||
if (!networkInterface.isUp() || networkInterface.isLoopback()) {
|
||||
|
@ -759,18 +764,25 @@ public class ConnectionsManager extends BaseController {
|
|||
String addrr = inetAddress.getHostAddress();
|
||||
if (!addrr.startsWith("192.0.0.")) {
|
||||
hasIpv4 = true;
|
||||
} else {
|
||||
hasStrangeIpv4 = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!hasIpv4 && hasIpv6) {
|
||||
return true;
|
||||
if (hasIpv6) {
|
||||
if (hasStrangeIpv4) {
|
||||
return USE_IPV4_IPV6_RANDOM;
|
||||
}
|
||||
if (!hasIpv4) {
|
||||
return USE_IPV6_ONLY;
|
||||
}
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
FileLog.e(e);
|
||||
}
|
||||
|
||||
return false;
|
||||
return USE_IPV4_ONLY;
|
||||
}
|
||||
|
||||
private static class ResolveHostByNameTask extends AsyncTask<Void, Void, ResolvedDomain> {
|
||||
|
|
|
@ -1998,7 +1998,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
|||
if (isAvatarVisible && avatarImage.isInsideImage(x, y + getTop())) {
|
||||
avatarPressed = true;
|
||||
result = true;
|
||||
} else if (psaButtonVisible && psaHelpX != -1 && x >= psaHelpX && x <= psaHelpX + AndroidUtilities.dp(40) && y >= psaHelpY && y <= psaHelpY + AndroidUtilities.dp(40)) {
|
||||
} else if (psaButtonVisible && hasPsaHint && x >= psaHelpX && x <= psaHelpX + AndroidUtilities.dp(40) && y >= psaHelpY && y <= psaHelpY + AndroidUtilities.dp(40)) {
|
||||
psaHintPressed = true;
|
||||
createSelectorDrawable(0);
|
||||
selectorDrawableMaskType[0] = 3;
|
||||
|
|
|
@ -20222,6 +20222,9 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
|||
AlertDialog alertDialog = builder.create();
|
||||
showDialog(builder.create());
|
||||
}
|
||||
AndroidUtilities.cancelRunOnUIThread(progressRunnable);
|
||||
commentLoadingMessageId = 0;
|
||||
chatListView.invalidateViews();
|
||||
return;
|
||||
}
|
||||
savedNoHistory = true;
|
||||
|
@ -20829,7 +20832,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
|||
showPollSolution(cell.getMessageObject(), media.results);
|
||||
} else if (type == 1) {
|
||||
MessageObject messageObject = cell.getMessageObject();
|
||||
if (TextUtils.isEmpty(messageObject.messageOwner.fwd_from.psa_type)) {
|
||||
if (messageObject.messageOwner.fwd_from == null || TextUtils.isEmpty(messageObject.messageOwner.fwd_from.psa_type)) {
|
||||
return;
|
||||
}
|
||||
CharSequence text = LocaleController.getString("PsaMessageInfo_" + messageObject.messageOwner.fwd_from.psa_type);
|
||||
|
|
|
@ -164,7 +164,7 @@ public class ClearHistoryAlert extends BottomSheet {
|
|||
if (autoDeleteOnly || contentHeight - visiblePart < AndroidUtilities.dp(90) || contentHeight < height / 2 + AndroidUtilities.dp(90)) {
|
||||
padding = height - contentHeight;
|
||||
} else {
|
||||
int minHeight = contentHeight / 2 + AndroidUtilities.dp(40);
|
||||
int minHeight = contentHeight / 2 + AndroidUtilities.dp(108);
|
||||
if (visiblePart < minHeight) {
|
||||
padding = height - minHeight;
|
||||
}
|
||||
|
|
|
@ -293,7 +293,14 @@ public class InviteLinkBottomSheet extends BottomSheet {
|
|||
titleTextView.setGravity(Gravity.CENTER_VERTICAL);
|
||||
titleTextView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
|
||||
if (!permanent) {
|
||||
titleTextView.setText(invite.revoked ? LocaleController.getString("RevokedLink", R.string.RevokedLink) : LocaleController.getString("InviteLink", R.string.InviteLink));
|
||||
if (invite.expired) {
|
||||
titleTextView.setText(LocaleController.getString("ExpiredLink", R.string.ExpiredLink));
|
||||
} else if (invite.revoked) {
|
||||
titleTextView.setText(LocaleController.getString("RevokedLink", R.string.RevokedLink));
|
||||
} else {
|
||||
titleTextView.setText(LocaleController.getString("InviteLink", R.string.InviteLink));
|
||||
}
|
||||
|
||||
titleVisible = true;
|
||||
} else {
|
||||
titleTextView.setText(LocaleController.getString("InviteLink", R.string.InviteLink));
|
||||
|
|
|
@ -459,6 +459,9 @@ public class LinkActionView extends LinearLayout {
|
|||
}
|
||||
|
||||
private void revokeLink() {
|
||||
if (fragment.getParentActivity() == null) {
|
||||
return;
|
||||
}
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(fragment.getParentActivity());
|
||||
builder.setMessage(LocaleController.getString("RevokeAlert", R.string.RevokeAlert));
|
||||
builder.setTitle(LocaleController.getString("RevokeLink", R.string.RevokeLink));
|
||||
|
|
|
@ -75,7 +75,6 @@ public class ReportAlert extends BottomSheet {
|
|||
setCustomView(frameLayout);
|
||||
|
||||
RLottieImageView imageView = new RLottieImageView(context);
|
||||
imageView.setAutoRepeat(true);
|
||||
imageView.setAnimation(R.raw.report_police, 120, 120);
|
||||
imageView.playAnimation();
|
||||
frameLayout.addView(imageView, LayoutHelper.createFrame(160, 160, Gravity.CENTER_HORIZONTAL | Gravity.TOP, 17, 14, 17, 0));
|
||||
|
|
|
@ -6,6 +6,7 @@ import android.content.Context;
|
|||
import androidx.annotation.IntDef;
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import org.telegram.messenger.BuildVars;
|
||||
import org.telegram.messenger.FileLoader;
|
||||
import org.telegram.messenger.ImageLocation;
|
||||
import org.telegram.messenger.LocaleController;
|
||||
|
@ -26,7 +27,7 @@ public class StickerSetBulletinLayout extends Bulletin.TwoLineLayout {
|
|||
public static final int TYPE_REMOVED_FROM_FAVORITES = 4;
|
||||
public static final int TYPE_ADDED_TO_FAVORITES = 5;
|
||||
|
||||
@IntDef(value = {TYPE_REMOVED, TYPE_ARCHIVED, TYPE_ADDED})
|
||||
@IntDef(value = {TYPE_REMOVED, TYPE_ARCHIVED, TYPE_ADDED, TYPE_REMOVED_FROM_RECENT, TYPE_REMOVED_FROM_FAVORITES, TYPE_ADDED_TO_FAVORITES})
|
||||
public @interface Type {}
|
||||
|
||||
public StickerSetBulletinLayout(@NonNull Context context, TLObject setObject, @Type int type) {
|
||||
|
@ -61,7 +62,7 @@ public class StickerSetBulletinLayout extends Bulletin.TwoLineLayout {
|
|||
stickerSet = null;
|
||||
}
|
||||
|
||||
if (sticker == null) {
|
||||
if (sticker == null && BuildVars.DEBUG_VERSION) {
|
||||
throw new IllegalArgumentException("Invalid type of the given setObject: " + setObject.getClass());
|
||||
}
|
||||
|
||||
|
|
|
@ -12,10 +12,12 @@ import android.graphics.PorterDuffColorFilter;
|
|||
import android.graphics.RectF;
|
||||
import android.graphics.Typeface;
|
||||
import android.os.SystemClock;
|
||||
import android.text.Layout;
|
||||
import android.text.Selection;
|
||||
import android.text.Spannable;
|
||||
import android.text.SpannableStringBuilder;
|
||||
import android.text.Spanned;
|
||||
import android.text.StaticLayout;
|
||||
import android.text.TextPaint;
|
||||
import android.text.TextUtils;
|
||||
import android.text.method.LinkMovementMethod;
|
||||
|
@ -1067,6 +1069,12 @@ public class UndoView extends FrameLayout {
|
|||
super.onMeasure(MeasureSpec.makeMeasureSpec(MeasureSpec.getSize(widthMeasureSpec), MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(undoViewHeight, MeasureSpec.EXACTLY));
|
||||
}
|
||||
|
||||
StaticLayout timeLayout;
|
||||
StaticLayout timeLayoutOut;
|
||||
int textWidthOut;
|
||||
|
||||
float timeReplaceProgress = 1f;
|
||||
|
||||
@Override
|
||||
protected void onDraw(Canvas canvas) {
|
||||
if (currentAction == ACTION_DELETE || currentAction == ACTION_CLEAR) {
|
||||
|
@ -1074,9 +1082,50 @@ public class UndoView extends FrameLayout {
|
|||
if (prevSeconds != newSeconds) {
|
||||
prevSeconds = newSeconds;
|
||||
timeLeftString = String.format("%d", Math.max(1, newSeconds));
|
||||
if (timeLayout != null) {
|
||||
timeLayoutOut = timeLayout;
|
||||
timeReplaceProgress = 0;
|
||||
textWidthOut = textWidth;
|
||||
}
|
||||
textWidth = (int) Math.ceil(textPaint.measureText(timeLeftString));
|
||||
timeLayout = new StaticLayout(timeLeftString, textPaint, Integer.MAX_VALUE, Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false);
|
||||
}
|
||||
canvas.drawText(timeLeftString, rect.centerX() - textWidth / 2, AndroidUtilities.dp(28.2f), textPaint);
|
||||
|
||||
if (timeReplaceProgress < 1f) {
|
||||
timeReplaceProgress += 16f / 150f;
|
||||
if (timeReplaceProgress > 1f) {
|
||||
timeReplaceProgress = 1f;
|
||||
} else {
|
||||
invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
int alpha = textPaint.getAlpha();
|
||||
|
||||
if (timeLayoutOut != null && timeReplaceProgress < 1f) {
|
||||
textPaint.setAlpha((int) (alpha * (1f - timeReplaceProgress)));
|
||||
canvas.save();
|
||||
canvas.translate(rect.centerX() - textWidth / 2, AndroidUtilities.dp(17.2f) + AndroidUtilities.dp(10) * timeReplaceProgress);
|
||||
timeLayoutOut.draw(canvas);
|
||||
textPaint.setAlpha(alpha);
|
||||
canvas.restore();
|
||||
}
|
||||
|
||||
if (timeLayout != null) {
|
||||
if (timeReplaceProgress != 1f) {
|
||||
textPaint.setAlpha((int) (alpha * timeReplaceProgress));
|
||||
}
|
||||
canvas.save();
|
||||
canvas.translate(rect.centerX() - textWidth / 2, AndroidUtilities.dp(17.2f) - AndroidUtilities.dp(10) * (1f - timeReplaceProgress));
|
||||
timeLayout.draw(canvas);
|
||||
if (timeReplaceProgress != 1f) {
|
||||
textPaint.setAlpha(alpha);
|
||||
}
|
||||
canvas.restore();
|
||||
}
|
||||
|
||||
// canvas.drawText(timeLeftString, rect.centerX() - textWidth / 2, AndroidUtilities.dp(28.2f), textPaint);
|
||||
// canvas.drawText(timeLeftString, , textPaint);
|
||||
canvas.drawArc(rect, -90, -360 * (timeLeft / 5000.0f), false, progressPaint);
|
||||
}
|
||||
|
||||
|
|
|
@ -606,7 +606,13 @@ public class EditWidgetActivity extends BaseFragment {
|
|||
}
|
||||
|
||||
if (dialog != null && dialog.unread_count > 0) {
|
||||
((TextView) cells[position].findViewById(a == 0 ? R.id.contacts_widget_item_badge1 : R.id.contacts_widget_item_badge2)).setText(String.format("%d", dialog.unread_count));
|
||||
String count;
|
||||
if (dialog.unread_count > 99) {
|
||||
count = String.format("%d+", 99);
|
||||
} else {
|
||||
count = String.format("%d", dialog.unread_count);
|
||||
}
|
||||
((TextView) cells[position].findViewById(a == 0 ? R.id.contacts_widget_item_badge1 : R.id.contacts_widget_item_badge2)).setText(count);
|
||||
cells[position].findViewById(a == 0 ? R.id.contacts_widget_item_badge_bg1 : R.id.contacts_widget_item_badge_bg2).setVisibility(VISIBLE);
|
||||
} else {
|
||||
cells[position].findViewById(a == 0 ? R.id.contacts_widget_item_badge_bg1 : R.id.contacts_widget_item_badge_bg2).setVisibility(GONE);
|
||||
|
|
|
@ -848,7 +848,7 @@ public class ManageLinksActivity extends BaseFragment implements NotificationCen
|
|||
if (isPublic && adminId == getAccountInstance().getUserConfig().clientUserId) {
|
||||
headerCell.setText(LocaleController.getString("PublicLink", R.string.PublicLink));
|
||||
} else if (adminId == getAccountInstance().getUserConfig().clientUserId) {
|
||||
headerCell.setText(LocaleController.getString("ChannelLinkTitle", R.string.ChannelLinkTitle));
|
||||
headerCell.setText(LocaleController.getString("ChannelInviteLinkTitle", R.string.ChannelInviteLinkTitle));
|
||||
} else {
|
||||
headerCell.setText(LocaleController.getString("PermanentLinkForThisAdmin", R.string.PermanentLinkForThisAdmin));
|
||||
}
|
||||
|
@ -1123,7 +1123,7 @@ public class ManageLinksActivity extends BaseFragment implements NotificationCen
|
|||
icons.add(R.drawable.msg_copy);
|
||||
actions.add(0);
|
||||
|
||||
items.add(LocaleController.getString("Share", R.string.ShareLink));
|
||||
items.add(LocaleController.getString("ShareLink", R.string.ShareLink));
|
||||
icons.add(R.drawable.msg_share);
|
||||
actions.add(1);
|
||||
|
||||
|
@ -1765,11 +1765,19 @@ public class ManageLinksActivity extends BaseFragment implements NotificationCen
|
|||
return true;
|
||||
}
|
||||
|
||||
int animationIndex = -1;
|
||||
@Override
|
||||
protected void onTransitionAnimationEnd(boolean isOpen, boolean backward) {
|
||||
super.onTransitionAnimationEnd(isOpen, backward);
|
||||
if (isOpen) {
|
||||
isOpened = true;
|
||||
}
|
||||
NotificationCenter.getInstance(currentAccount).onAnimationFinish(animationIndex);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onTransitionAnimationStart(boolean isOpen, boolean backward) {
|
||||
super.onTransitionAnimationStart(isOpen, backward);
|
||||
animationIndex = NotificationCenter.getInstance(currentAccount).setAnimationInProgress(animationIndex, null);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3001,7 +3001,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
|
|||
ArrayList<MessageObject> arr = (ArrayList<MessageObject>) args[2];
|
||||
endReached[loadIndex] = (Boolean) args[5];
|
||||
if (needSearchImageInArr) {
|
||||
if (arr.isEmpty() && (loadIndex != 0 || mergeDialogId == 0)) {
|
||||
if (arr.isEmpty() && (loadIndex != 0 || mergeDialogId == 0) || currentIndex < 0 || currentIndex >= imagesArr.size()) {
|
||||
needSearchImageInArr = false;
|
||||
return;
|
||||
}
|
||||
|
@ -3181,7 +3181,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
|
|||
}
|
||||
setImageIndex(index);
|
||||
} else {
|
||||
closePhoto(false, false);
|
||||
closePhoto(false, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5455,6 +5455,9 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
|
|||
|
||||
if (user_id != 0) {
|
||||
TLRPC.User user = getMessagesController().getUser(user_id);
|
||||
if (user == null) {
|
||||
return;
|
||||
}
|
||||
TLRPC.FileLocation photoBig = null;
|
||||
if (user.photo != null) {
|
||||
photoBig = user.photo.photo_big;
|
||||
|
|
|
@ -43,6 +43,7 @@
|
|||
android:layout_gravity="center"
|
||||
android:layout_marginBottom="27dp"
|
||||
android:layout_marginLeft="20dp"
|
||||
android:layout_marginRight="2dp"
|
||||
android:id="@+id/contacts_widget_item_badge_bg1">
|
||||
|
||||
<TextView android:id="@+id/contacts_widget_item_badge1"
|
||||
|
@ -98,6 +99,7 @@
|
|||
android:layout_gravity="center"
|
||||
android:layout_marginBottom="27dp"
|
||||
android:layout_marginLeft="20dp"
|
||||
android:layout_marginRight="2dp"
|
||||
android:id="@+id/contacts_widget_item_badge_bg2">
|
||||
|
||||
<TextView android:id="@+id/contacts_widget_item_badge2"
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:minHeight="72dp"
|
||||
android:id="@+id/shortcut_widget_item"
|
||||
|
@ -12,7 +11,7 @@
|
|||
android:layout_marginStart="10dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_gravity="start|center_vertical"
|
||||
android:gravity="start" />
|
||||
|
||||
<RelativeLayout
|
||||
|
@ -32,13 +31,14 @@
|
|||
android:textSize="17dp"
|
||||
android:fontFamily="sans-serif-medium"
|
||||
android:textColor="@color/widget_name"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_toLeftOf="@+id/shortcut_widget_item_time"/>
|
||||
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_marginEnd="4dp"
|
||||
android:layout_toStartOf="@+id/shortcut_widget_item_time"/>
|
||||
|
||||
<TextView android:id="@+id/shortcut_widget_item_time"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_marginTop="3dp"
|
||||
android:textSize="13dp"
|
||||
android:textColor="@color/widget_time" />
|
||||
|
@ -64,8 +64,8 @@
|
|||
android:textColor="@color/widget_text"
|
||||
android:autoLink="none"
|
||||
android:textColorLink="@color/widget_text"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_toLeftOf="@+id/shortcut_widget_item_badge"/>
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_toStartOf="@+id/shortcut_widget_item_badge"/>
|
||||
|
||||
<TextView android:id="@+id/shortcut_widget_item_badge"
|
||||
android:layout_width="wrap_content"
|
||||
|
@ -77,7 +77,8 @@
|
|||
android:gravity="center"
|
||||
android:minWidth="23dp"
|
||||
android:textSize="13dp"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_marginStart="4dp"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:background="@drawable/widget_counter"
|
||||
android:textColor="@color/widget_badge" />
|
||||
|
||||
|
@ -87,6 +88,7 @@
|
|||
android:layout_marginStart="76dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1px"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:layout_gravity="bottom|start"
|
||||
android:background="@color/widget_divider"/>
|
||||
|
||||
|
|
Loading…
Reference in a new issue