Merge upstream 7.5.0 (2245)

This commit is contained in:
世界 2021-02-24 09:43:06 +08:00
commit 5efb0b1ad9
No known key found for this signature in database
GPG Key ID: CD109927C34A63C4
31 changed files with 219 additions and 60 deletions

View File

@ -3,7 +3,7 @@ import cn.hutool.core.util.RuntimeUtil
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
def verName = "7.5.0-preview-2244-3"
def verName = "7.5.0-preview-2245-4"
def verCode = 200
if (System.getenv("DEBUG_BUILD") == "true") {

View File

@ -444,7 +444,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

View File

@ -229,8 +229,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,
@ -524,7 +524,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},

View File

@ -286,14 +286,27 @@ void Connection::connect() {
ConnectionsManager::getInstance(currentDatacenter->instanceNum).onConnectionClosed(this, 0);
return;
}
if (connectionState == TcpConnectionStageConnected || connectionState == TcpConnectionStageConnecting) {
if (connectionState == TcpConnectionStageConnected ||
connectionState == TcpConnectionStageConnecting) {
return;
}
connectionInProcess = true;
connectionState = TcpConnectionStageConnecting;
isMediaConnection = false;
uint32_t ipv6 = ConnectionsManager::getInstance(currentDatacenter->instanceNum).isIpv6Enabled() ? TcpAddressFlagIpv6 : 0;
uint32_t isStatic = connectionType == ConnectionTypeProxy || !ConnectionsManager::getInstance(currentDatacenter->instanceNum).proxyAddress.empty() ? TcpAddressFlagStatic : 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)) {
currentAddressFlags = TcpAddressFlagDownload | isStatic;

View File

@ -1747,8 +1747,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() {
@ -3506,9 +3506,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;
});
}

View File

@ -62,8 +62,15 @@ public:
void resumeNetwork(bool partial);
void pauseNetwork();
void setNetworkAvailable(bool value, int32_t type, bool slow);
void setUseIpv6(bool 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 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);
void setRegId(std::string regId);
@ -123,8 +130,11 @@ private:
TLObject *getRequestWithMessageId(int64_t messageId);
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);
@ -193,7 +203,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;

View File

@ -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;

View File

@ -31,14 +31,22 @@
#define MAX_ACCOUNT_COUNT 32
#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
class TLObject;
class TL_error;
class Request;
class TL_message;
class TL_config;
class NativeByteBuffer;
class Handshake;

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -3606,7 +3606,7 @@ public class MessagesController extends BaseController implements NotificationCe
editor.remove("dialog_bar_distance" + dialogId);
}
}
editor.commit();
editor.apply();
getNotificationCenter().postNotificationName(NotificationCenter.peerSettingsDidLoad, dialogId);
}
@ -9945,6 +9945,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);
@ -10181,6 +10184,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) {
@ -11592,6 +11598,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;

View File

@ -8293,6 +8293,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();
@ -10192,6 +10195,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) {

View File

@ -18,7 +18,7 @@ import tw.nekomimi.nekogram.utils.FileUtil;
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";

View File

@ -1594,6 +1594,9 @@ public boolean retriedToSend;
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;

View File

@ -79,6 +79,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;
@ -344,7 +348,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());
}
@ -666,7 +670,7 @@ public class ConnectionsManager extends BaseController {
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);
@ -737,9 +741,9 @@ public class ConnectionsManager extends BaseController {
}
@SuppressLint("NewApi")
public static boolean useIpv6Address() {
public static byte getIpStrategy() {
if (Build.VERSION.SDK_INT < 19) {
return false;
return USE_IPV4_ONLY;
}
if (BuildVars.LOGS_ENABLED) {
try {
@ -768,6 +772,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()) {
@ -786,20 +791,28 @@ public class ConnectionsManager extends BaseController {
String addrr = inetAddress.getHostAddress();
if (!addrr.startsWith("192.0.0.")) {
hasIpv4 = true;
} else {
hasStrangeIpv4 = true;
}
}
}
}
if (NekoConfig.useIPv6) {
return hasIpv6;
} else {
return !hasIpv4 && hasIpv6;
if (hasIpv6) {
if (hasStrangeIpv4) {
return USE_IPV4_IPV6_RANDOM;
}
if (!hasIpv4) {
return USE_IPV6_ONLY;
}
if (NekoConfig.useIPv6) {
return USE_IPV4_IPV6_RANDOM;
}
}
} catch (Throwable e) {
FileLog.e(e);
}
return false;
return USE_IPV4_ONLY;
}
private static class ResolveHostByNameTask extends AsyncTask<Void, Void, ResolvedDomain> {

View File

@ -2005,7 +2005,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;

View File

@ -21408,6 +21408,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;

View File

@ -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;
}

View File

@ -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));

View File

@ -457,6 +457,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));

View File

@ -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));

View File

@ -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 {
}
@ -62,7 +63,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());
}

View File

@ -13,10 +13,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;
@ -1100,6 +1102,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) {
@ -1107,9 +1115,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);
}

View File

@ -603,7 +603,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);

View File

@ -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.baseline_content_copy_24);
actions.add(0);
items.add(LocaleController.getString("Share", R.string.ShareLink));
items.add(LocaleController.getString("ShareLink", R.string.ShareLink));
icons.add(R.drawable.baseline_forward_24);
actions.add(1);
@ -1766,11 +1766,20 @@ 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);
}
}

View File

@ -3056,7 +3056,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;
}
@ -3236,7 +3236,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
}
setImageIndex(index);
} else {
closePhoto(false, false);
closePhoto(false, true);
}
}
}

View File

@ -186,7 +186,7 @@ public class NekoGeneralSettingsActivity extends BaseFragment {
}
for (int a = 0; a < UserConfig.MAX_ACCOUNT_COUNT; a++) {
if (UserConfig.getInstance(a).isClientActivated()) {
ConnectionsManager.native_setUseIpv6(a, NekoConfig.useIPv6);
ConnectionsManager.native_setIpStrategy(a, ConnectionsManager.getIpStrategy());
}
}
} else if (position == disableProxyWhenVpnEnabledRow) {

View File

@ -23,7 +23,7 @@ object DnsFactory {
FileLog.d("Lookup $domain")
val type = if (!ConnectionsManager.useIpv6Address()) Type.A else Type.AAAA
val type = if (ConnectionsManager.getIpStrategy() != ConnectionsManager.USE_IPV6_ONLY) Type.A else Type.AAAA
val dc = DClass.IN
val name = Name.fromConstantString("$domain.")

View File

@ -45,6 +45,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
@ -103,6 +104,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

View File

@ -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"
@ -13,7 +12,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
@ -24,7 +23,8 @@
android:layout_gravity="top|start"
android:layout_marginEnd="16dp">
<TextView android:id="@+id/shortcut_widget_item_text"
<TextView
android:id="@+id/shortcut_widget_item_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
@ -33,14 +33,15 @@
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" />
@ -67,8 +68,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"
@ -81,7 +82,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" />
@ -92,6 +94,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" />