Update to 6.0.1 (1910)

This commit is contained in:
DrKLO 2020-03-30 19:49:17 +03:00
parent 80c4acfa3b
commit ce5e817fb5
17 changed files with 276 additions and 159 deletions

View File

@ -285,7 +285,7 @@ android {
} }
} }
defaultConfig.versionCode = 1908 defaultConfig.versionCode = 1910
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"]
@ -380,7 +380,7 @@ android {
defaultConfig { defaultConfig {
minSdkVersion 16 minSdkVersion 16
targetSdkVersion 28 targetSdkVersion 28
versionName "6.0.0" versionName "6.0.1"
vectorDrawables.generatedDensities = ['mdpi', 'hdpi', 'xhdpi', 'xxhdpi'] vectorDrawables.generatedDensities = ['mdpi', 'hdpi', 'xhdpi', 'xxhdpi']

View File

@ -1,3 +1,3 @@
APP_PLATFORM := android-16 APP_PLATFORM := android-16
NDK_TOOLCHAIN_VERSION := clang NDK_TOOLCHAIN_VERSION := clang
APP_STL := c++_shared APP_STL := c++_static

View File

@ -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 = 1908; public static int BUILD_VERSION = 1910;
public static String BUILD_VERSION_STRING = "6.0.0"; public static String BUILD_VERSION_STRING = "6.0.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";

View File

@ -257,6 +257,7 @@ public class MessagesController extends BaseController implements NotificationCe
public boolean backgroundConnection; public boolean backgroundConnection;
public float animatedEmojisZoom; public float animatedEmojisZoom;
public boolean filtersEnabled; public boolean filtersEnabled;
public boolean showFiltersTooltip;
public String venueSearchBot; public String venueSearchBot;
public String gifSearchBot; public String gifSearchBot;
public String imageSearchBot; public String imageSearchBot;
@ -524,6 +525,7 @@ public class MessagesController extends BaseController implements NotificationCe
animatedEmojisZoom = mainPreferences.getFloat("animatedEmojisZoom", 0.625f); animatedEmojisZoom = mainPreferences.getFloat("animatedEmojisZoom", 0.625f);
qrLoginCamera = mainPreferences.getBoolean("qrLoginCamera", false); qrLoginCamera = mainPreferences.getBoolean("qrLoginCamera", false);
filtersEnabled = mainPreferences.getBoolean("filtersEnabled", false); filtersEnabled = mainPreferences.getBoolean("filtersEnabled", false);
showFiltersTooltip = mainPreferences.getBoolean("showFiltersTooltip", false);
} }
private void sendLoadPeersRequest(TLObject req, ArrayList<TLObject> requests, TLRPC.messages_Dialogs pinnedDialogs, TLRPC.messages_Dialogs pinnedRemoteDialogs, ArrayList<TLRPC.User> users, ArrayList<TLRPC.Chat> chats, ArrayList<MessagesController.DialogFilter> filtersToSave, SparseArray<MessagesController.DialogFilter> filtersToDelete, ArrayList<Integer> filtersOrder, HashMap<Integer, HashSet<Integer>> filterDialogRemovals, HashMap<Integer, HashSet<Integer>> filterUserRemovals, HashSet<Integer> filtersUnreadCounterReset) { private void sendLoadPeersRequest(TLObject req, ArrayList<TLObject> requests, TLRPC.messages_Dialogs pinnedDialogs, TLRPC.messages_Dialogs pinnedRemoteDialogs, ArrayList<TLRPC.User> users, ArrayList<TLRPC.Chat> chats, ArrayList<MessagesController.DialogFilter> filtersToSave, SparseArray<MessagesController.DialogFilter> filtersToDelete, ArrayList<Integer> filtersOrder, HashMap<Integer, HashSet<Integer>> filterDialogRemovals, HashMap<Integer, HashSet<Integer>> filterUserRemovals, HashSet<Integer> filtersUnreadCounterReset) {
@ -993,6 +995,15 @@ public class MessagesController extends BaseController implements NotificationCe
filtersEnabled = bool.value; filtersEnabled = bool.value;
editor.putBoolean("filtersEnabled", filtersEnabled); editor.putBoolean("filtersEnabled", filtersEnabled);
changed = true; changed = true;
}
}
} else if ("dialog_filters_tooltip".equals(value.key)) {
if (value.value instanceof TLRPC.TL_jsonBool) {
TLRPC.TL_jsonBool bool = (TLRPC.TL_jsonBool) value.value;
if (bool.value != showFiltersTooltip) {
showFiltersTooltip = bool.value;
editor.putBoolean("showFiltersTooltip", showFiltersTooltip);
changed = true;
getNotificationCenter().postNotificationName(NotificationCenter.filterSettingsUpdated); getNotificationCenter().postNotificationName(NotificationCenter.filterSettingsUpdated);
} }
} }
@ -11630,9 +11641,13 @@ public class MessagesController extends BaseController implements NotificationCe
} }
public boolean isDialogMuted(long dialog_id) { public boolean isDialogMuted(long dialog_id) {
return isDialogMuted(dialog_id, null);
}
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); return !getNotificationsController().isGlobalNotificationsEnabled(dialog_id, chat);
} }
if (mute_type == 2) { if (mute_type == 2) {
return true; return true;

View File

@ -1728,6 +1728,9 @@ public class MessagesStorage extends BaseController {
if (mentions > 0) { if (mentions > 0) {
dialogsWithMentions.put(did, mentions); dialogsWithMentions.put(did, mentions);
} }
/*if (BuildVars.DEBUG_VERSION) {
FileLog.d("unread chat " + did + " counters = " + unread + " and " + mentions);
}*/
dialogsByFolders.put(did, folderId); dialogsByFolders.put(did, folderId);
int lower_id = (int) did; int lower_id = (int) did;
int high_id = (int) (did >> 32); int high_id = (int) (did >> 32);
@ -1807,7 +1810,7 @@ public class MessagesStorage extends BaseController {
continue; continue;
} }
int idx1 = dialogsByFolders.get(-chat.id); int idx1 = dialogsByFolders.get(-chat.id);
int idx2 = getMessagesController().isDialogMuted(-chat.id) && dialogsWithMentions.indexOfKey(-chat.id) < 0 ? 1 : 0; int idx2 = getMessagesController().isDialogMuted(-chat.id, chat) && dialogsWithMentions.indexOfKey(-chat.id) < 0 ? 1 : 0;
if (ChatObject.isChannel(chat) && !chat.megagroup) { if (ChatObject.isChannel(chat) && !chat.megagroup) {
channels[idx1][idx2]++; channels[idx1][idx2]++;
} else { } else {
@ -1816,6 +1819,15 @@ public class MessagesStorage extends BaseController {
chatsDict.put(chat.id, chat); chatsDict.put(chat.id, chat);
} }
} }
/*if (BuildVars.DEBUG_VERSION) {
for (int b = 0; b < 2; b++) {
FileLog.d("contacts = " + contacts[b][0] + ", " + contacts[b][1]);
FileLog.d("nonContacts = " + nonContacts[b][0] + ", " + nonContacts[b][1]);
FileLog.d("groups = " + groups[b][0] + ", " + groups[b][1]);
FileLog.d("channels = " + channels[b][0] + ", " + channels[b][1]);
FileLog.d("bots = " + bots[b][0] + ", " + bots[b][1]);
}
}*/
for (int a = 0, N = dialogFilters.size(); a < N + 2; a++) { for (int a = 0, N = dialogFilters.size(); a < N + 2; a++) {
MessagesController.DialogFilter filter; MessagesController.DialogFilter filter;
int flags; int flags;
@ -1979,6 +1991,9 @@ public class MessagesStorage extends BaseController {
} }
} }
filter.pendingUnreadCount = unreadCount; filter.pendingUnreadCount = unreadCount;
/*if (BuildVars.DEBUG_VERSION) {
FileLog.d("filter " + filter.name + " flags = " + filter.flags + " unread count = " + filter.pendingUnreadCount);
}*/
if (apply) { if (apply) {
filter.unreadCount = unreadCount; filter.unreadCount = unreadCount;
} }
@ -3610,17 +3625,32 @@ public class MessagesStorage extends BaseController {
if (read) { if (read) {
if (b == 0) { if (b == 0) {
dialogsWithUnread.remove(did); dialogsWithUnread.remove(did);
/*if (BuildVars.DEBUG_VERSION) {
FileLog.d("read remove = " + did);
}*/
} else { } else {
dialogsWithMentions.remove(did); dialogsWithMentions.remove(did);
/*if (BuildVars.DEBUG_VERSION) {
FileLog.d("mention remove = " + did);
}*/
} }
} else { } else {
if (b == 0) { if (b == 0) {
dialogsWithUnread.put(did, count); dialogsWithUnread.put(did, count);
/*if (BuildVars.DEBUG_VERSION) {
FileLog.d("read add = " + did);
}*/
} else { } else {
dialogsWithMentions.put(did, count); dialogsWithMentions.put(did, count);
/*if (BuildVars.DEBUG_VERSION) {
FileLog.d("mention add = " + did);
}*/
} }
} }
if (b == 0 && dialogsWithMentions.indexOfKey(did) >= 0 || b == 1 && dialogsWithUnread.indexOfKey(did) >= 0) { if (b == 0 && dialogsWithMentions.indexOfKey(did) >= 0 || b == 1 && dialogsWithUnread.indexOfKey(did) >= 0) {
/*if (BuildVars.DEBUG_VERSION) {
FileLog.d("read = " + read + " ignore " + b);
}*/
continue; continue;
} }
SQLiteCursor cursor = database.queryFinalized("SELECT folder_id FROM dialogs WHERE did = " + did); SQLiteCursor cursor = database.queryFinalized("SELECT folder_id FROM dialogs WHERE did = " + did);
@ -3708,7 +3738,7 @@ public class MessagesStorage extends BaseController {
continue; continue;
} }
int idx1 = dialogsByFolders.get(-chat.id); int idx1 = dialogsByFolders.get(-chat.id);
int idx2 = getMessagesController().isDialogMuted(-chat.id) && (dialogsToUpdateMentions == null || dialogsToUpdateMentions.indexOfKey(-chat.id) < 0) ? 1 : 0; int idx2 = getMessagesController().isDialogMuted(-chat.id, chat) && (dialogsToUpdateMentions == null || dialogsToUpdateMentions.indexOfKey(-chat.id) < 0) ? 1 : 0;
if (ChatObject.isChannel(chat) && !chat.megagroup) { if (ChatObject.isChannel(chat) && !chat.megagroup) {
channels[idx1][idx2]++; channels[idx1][idx2]++;
} else { } else {
@ -3717,6 +3747,15 @@ public class MessagesStorage extends BaseController {
chatsDict.put(chat.id, chat); chatsDict.put(chat.id, chat);
} }
} }
/*if (BuildVars.DEBUG_VERSION) {
for (int b = 0; b < 2; b++) {
FileLog.d("read = " + read + " contacts = " + contacts[b][0] + ", " + contacts[b][1]);
FileLog.d("read = " + read + " nonContacts = " + nonContacts[b][0] + ", " + nonContacts[b][1]);
FileLog.d("read = " + read + " groups = " + groups[b][0] + ", " + groups[b][1]);
FileLog.d("read = " + read + " channels = " + channels[b][0] + ", " + channels[b][1]);
FileLog.d("read = " + read + " bots = " + bots[b][0] + ", " + bots[b][1]);
}
}*/
for (int a = 0, N = dialogFilters.size(); a < N + 2; a++) { for (int a = 0, N = dialogFilters.size(); a < N + 2; a++) {
int unreadCount; int unreadCount;
@ -4033,6 +4072,9 @@ public class MessagesStorage extends BaseController {
} }
if (filter != null) { if (filter != null) {
filter.pendingUnreadCount = unreadCount; filter.pendingUnreadCount = unreadCount;
/*if (BuildVars.DEBUG_VERSION) {
FileLog.d("filter " + filter.name + " flags = " + flags + " read = " + read + " unread count = " + filter.pendingUnreadCount);
}*/
} else if (a == N) { } else if (a == N) {
pendingMainUnreadCount = unreadCount; pendingMainUnreadCount = unreadCount;
} else if (a == N + 1) { } else if (a == N + 1) {

View File

@ -10,13 +10,13 @@ package org.telegram.messenger;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import android.content.Context; import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.os.Build; import android.os.Build;
import java.io.File; import java.io.File;
import java.io.FileOutputStream; import java.io.FileOutputStream;
import java.io.InputStream; import java.io.InputStream;
import java.io.OutputStream; import java.io.OutputStream;
import java.util.Locale;
import java.util.zip.ZipEntry; import java.util.zip.ZipEntry;
import java.util.zip.ZipFile; import java.util.zip.ZipFile;
@ -24,36 +24,105 @@ public class NativeLoader {
private final static int LIB_VERSION = 30; private final static int LIB_VERSION = 30;
private final static String LIB_NAME = "tmessages." + LIB_VERSION; private final static String LIB_NAME = "tmessages." + LIB_VERSION;
private final static String SHARED_LIB_NAME = "c++_shared"; private final static String LIB_SO_NAME = "lib" + LIB_NAME + ".so";
private final static String LOCALE_LIB_SO_NAME = "lib" + LIB_NAME + "loc.so";
private String crashPath = "";
private static volatile boolean nativeLoaded = false; private static volatile boolean nativeLoaded = false;
private NativeLoader() { private static File getNativeLibraryDir(Context context) {
File f = null;
if (context != null) {
try {
f = new File((String)ApplicationInfo.class.getField("nativeLibraryDir").get(context.getApplicationInfo()));
} catch (Throwable th) {
th.printStackTrace();
}
}
if (f == null) {
f = new File(context.getApplicationInfo().dataDir, "lib");
}
if (f.isDirectory()) {
return f;
}
return null;
} }
public static synchronized void initNativeLibs(Context context) { @SuppressLint({"UnsafeDynamicallyLoadedCode", "SetWorldReadable"})
if (!nativeLoaded) { private static boolean loadFromZip(Context context, File destDir, File destLocalFile, String folder) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR2) { try {
if (!loadNativeLib(context, SHARED_LIB_NAME)) { for (File file : destDir.listFiles()) {
throw new IllegalStateException("unable to load shared c++ library: " + SHARED_LIB_NAME); file.delete();
}
} catch (Exception e) {
FileLog.e(e);
}
ZipFile zipFile = null;
InputStream stream = null;
try {
zipFile = new ZipFile(context.getApplicationInfo().sourceDir);
ZipEntry entry = zipFile.getEntry("lib/" + folder + "/" + LIB_SO_NAME);
if (entry == null) {
throw new Exception("Unable to find file in apk:" + "lib/" + folder + "/" + LIB_NAME);
}
stream = zipFile.getInputStream(entry);
OutputStream out = new FileOutputStream(destLocalFile);
byte[] buf = new byte[4096];
int len;
while ((len = stream.read(buf)) > 0) {
Thread.yield();
out.write(buf, 0, len);
}
out.close();
destLocalFile.setReadable(true, false);
destLocalFile.setExecutable(true, false);
destLocalFile.setWritable(true);
try {
System.load(destLocalFile.getAbsolutePath());
nativeLoaded = true;
} catch (Error e) {
FileLog.e(e);
}
return true;
} catch (Exception e) {
FileLog.e(e);
} finally {
if (stream != null) {
try {
stream.close();
} catch (Exception e) {
FileLog.e(e);
} }
} }
if (!loadNativeLib(context, LIB_NAME)) { if (zipFile != null) {
throw new IllegalStateException("unable to load native library: " + LIB_NAME); try {
zipFile.close();
} catch (Exception e) {
FileLog.e(e);
}
} }
nativeLoaded = true;
} }
return false;
} }
@SuppressLint("UnsafeDynamicallyLoadedCode") @SuppressLint("UnsafeDynamicallyLoadedCode")
private static boolean loadNativeLib(Context context, String libName) { public static synchronized void initNativeLibs(Context context) {
if (nativeLoaded) {
return;
}
try { try {
try { try {
System.loadLibrary(libName); System.loadLibrary(LIB_NAME);
nativeLoaded = true;
if (BuildVars.LOGS_ENABLED) { if (BuildVars.LOGS_ENABLED) {
FileLog.d("loaded normal lib: " + libName); FileLog.d("loaded normal lib");
} }
return true; return;
} catch (Error e) { } catch (Error e) {
FileLog.e(e); FileLog.e(e);
} }
@ -89,17 +158,32 @@ public class NativeLoader {
folder = "x86"; folder = "x86";
} }
/*File destFile = getNativeLibraryDir(context);
if (destFile != null) {
destFile = new File(destFile, LIB_SO_NAME);
if (destFile.exists()) {
try {
System.loadLibrary(LIB_NAME);
nativeLoaded = true;
return;
} catch (Error e) {
FileLog.e(e);
}
}
}*/
File destDir = new File(context.getFilesDir(), "lib"); File destDir = new File(context.getFilesDir(), "lib");
destDir.mkdirs(); destDir.mkdirs();
File destLocalFile = new File(destDir, "lib" + libName + "loc.so"); File destLocalFile = new File(destDir, LOCALE_LIB_SO_NAME);
if (destLocalFile.exists()) { if (destLocalFile.exists()) {
try { try {
System.load(destLocalFile.getAbsolutePath());
if (BuildVars.LOGS_ENABLED) { if (BuildVars.LOGS_ENABLED) {
FileLog.d("loaded local lib: " + libName); FileLog.d("Load local lib");
} }
return true; System.load(destLocalFile.getAbsolutePath());
nativeLoaded = true;
return;
} catch (Error e) { } catch (Error e) {
FileLog.e(e); FileLog.e(e);
} }
@ -107,89 +191,24 @@ public class NativeLoader {
} }
if (BuildVars.LOGS_ENABLED) { if (BuildVars.LOGS_ENABLED) {
FileLog.e(String.format(Locale.US, "library %s not found, arch = %s", libName, folder)); FileLog.e("Library not found, arch = " + folder);
} }
if (loadFromZip(context, destDir, destLocalFile, folder, libName)) { if (loadFromZip(context, destDir, destLocalFile, folder)) {
return true; return;
} }
} catch (Throwable e) { } catch (Throwable e) {
e.printStackTrace(); e.printStackTrace();
} }
try { try {
System.loadLibrary(libName); System.loadLibrary(LIB_NAME);
if (BuildVars.LOGS_ENABLED) { nativeLoaded = true;
FileLog.d("loaded lib: " + libName);
}
return true;
} catch (Error e) { } catch (Error e) {
FileLog.e(e); FileLog.e(e);
} }
return false;
} }
@SuppressLint({"UnsafeDynamicallyLoadedCode", "SetWorldReadable"}) private static native void init(String path, boolean enable);
private static boolean loadFromZip(Context context, File destDir, File destLocalFile, String folder, String libName) { //public static native void crash();
try {
for (File file : destDir.listFiles()) {
file.delete();
}
} catch (Exception e) {
FileLog.e(e);
}
ZipFile zipFile = null;
InputStream stream = null;
try {
zipFile = new ZipFile(context.getApplicationInfo().sourceDir);
ZipEntry entry = zipFile.getEntry("lib/" + folder + "/lib" + libName + ".so");
if (entry == null) {
throw new Exception("Unable to find file in apk:" + "lib/" + folder + "/" + libName);
}
stream = zipFile.getInputStream(entry);
OutputStream out = new FileOutputStream(destLocalFile);
byte[] buf = new byte[4096];
int len;
while ((len = stream.read(buf)) > 0) {
Thread.yield();
out.write(buf, 0, len);
}
out.close();
destLocalFile.setReadable(true, false);
destLocalFile.setExecutable(true, false);
destLocalFile.setWritable(true);
try {
System.load(destLocalFile.getAbsolutePath());
if (BuildVars.LOGS_ENABLED) {
FileLog.d("loaded lib from zip: " + libName);
}
return true;
} catch (Error e) {
FileLog.e(e);
}
} catch (Exception e) {
FileLog.e(e);
} finally {
if (stream != null) {
try {
stream.close();
} catch (Exception e) {
FileLog.e(e);
}
}
if (zipFile != null) {
try {
zipFile.close();
} catch (Exception e) {
FileLog.e(e);
}
}
}
return false;
}
} }

View File

@ -3805,10 +3805,16 @@ public class NotificationsController extends BaseController {
} }
public boolean isGlobalNotificationsEnabled(long did) { public boolean isGlobalNotificationsEnabled(long did) {
return isGlobalNotificationsEnabled(did, null);
}
public boolean isGlobalNotificationsEnabled(long did, TLRPC.Chat chat) {
int type; int type;
int lower_id = (int) did; int lower_id = (int) did;
if (lower_id < 0) { if (lower_id < 0) {
TLRPC.Chat chat = getMessagesController().getChat(-lower_id); if (chat == null) {
chat = getMessagesController().getChat(-lower_id);
}
if (ChatObject.isChannel(chat) && !chat.megagroup) { if (ChatObject.isChannel(chat) && !chat.megagroup) {
type = TYPE_CHANNEL; type = TYPE_CHANNEL;
} else { } else {

View File

@ -250,7 +250,7 @@ public class SharedLinkCell extends FrameLayout {
} }
} }
if (link != null) { if (link != null) {
if (link.toLowerCase().indexOf("http") != 0 && link.toLowerCase().indexOf("mailto") != 0) { if (!link.contains("://") && link.toLowerCase().indexOf("http") != 0 && link.toLowerCase().indexOf("mailto") != 0) {
links.add("http://" + link); links.add("http://" + link);
} else { } else {
links.add(link); links.add(link);

View File

@ -16144,15 +16144,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
return; return;
} }
if (message.isDice()) { if (message.isDice()) {
try { undoView.showWithAction(0, chatActivityEnterView.getVisibility() == View.VISIBLE ? UndoView.ACTION_DICE_INFO : UndoView.ACTION_DICE_NO_SEND_INFO, null, null, () -> getSendMessagesHelper().sendMessage("\uD83C\uDFB2", dialog_id, null, null, false, null, null, null, true, 0));
if (currentToast != null) {
currentToast.cancel();
}
} catch (Exception e) {
FileLog.e(e);
}
currentToast = Toast.makeText(getParentActivity(), LocaleController.getString("DiceInfo", R.string.DiceInfo), Toast.LENGTH_SHORT);
currentToast.show();
} else if (message.isAnimatedEmoji()) { } else if (message.isAnimatedEmoji()) {
restartSticker(cell); restartSticker(cell);
} else if (message.needDrawBluredPreview()) { } else if (message.needDrawBluredPreview()) {

View File

@ -944,7 +944,7 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe
@Override @Override
protected void onDraw(Canvas canvas) { protected void onDraw(Canvas canvas) {
float multilinTooltipOffset = 0; float multilinTooltipOffset = 0;
if (tooltipLayout.getLineCount() > 1) { if (tooltipLayout != null && tooltipLayout.getLineCount() > 1) {
multilinTooltipOffset = tooltipLayout.getHeight() - tooltipLayout.getLineBottom(0); multilinTooltipOffset = tooltipLayout.getHeight() - tooltipLayout.getLineBottom(0);
} }
int cx = getMeasuredWidth() - AndroidUtilities.dp2(26); int cx = getMeasuredWidth() - AndroidUtilities.dp2(26);
@ -1192,47 +1192,50 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe
} }
} }
int alphaInt = (int) (tooltipAlpha * 255); int alphaInt = (int) (tooltipAlpha * 255);
tooltipBackground.setAlpha(alphaInt); tooltipBackground.setAlpha(alphaInt);
tooltipBackgroundArrow.setAlpha(alphaInt); tooltipBackgroundArrow.setAlpha(alphaInt);
tooltipPaint.setAlpha(alphaInt); tooltipPaint.setAlpha(alphaInt);
canvas.save(); if (tooltipLayout != null) {
rectF.set(0, 0, getMeasuredWidth(), getMeasuredHeight()); canvas.save();
canvas.translate(getMeasuredWidth() - tooltipWidth - AndroidUtilities.dp(44), AndroidUtilities.dpf2(16)); rectF.set(0, 0, getMeasuredWidth(), getMeasuredHeight());
tooltipBackground.setBounds( canvas.translate(getMeasuredWidth() - tooltipWidth - AndroidUtilities.dp(44), AndroidUtilities.dpf2(16));
-AndroidUtilities.dp(8), -AndroidUtilities.dp(2), tooltipBackground.setBounds(
(int) (tooltipWidth + AndroidUtilities.dp(36)), (int) (tooltipLayout.getHeight() + AndroidUtilities.dpf2(4)) -AndroidUtilities.dp(8), -AndroidUtilities.dp(2),
); (int) (tooltipWidth + AndroidUtilities.dp(36)), (int) (tooltipLayout.getHeight() + AndroidUtilities.dpf2(4))
tooltipBackground.draw(canvas); );
tooltipLayout.draw(canvas); tooltipBackground.draw(canvas);
canvas.restore(); tooltipLayout.draw(canvas);
canvas.restore();
canvas.save(); canvas.save();
canvas.translate(cx, AndroidUtilities.dpf2(17) + tooltipLayout.getHeight() / 2f - idleProgress * AndroidUtilities.dpf2(3f)); canvas.translate(cx, AndroidUtilities.dpf2(17) + tooltipLayout.getHeight() / 2f - idleProgress * AndroidUtilities.dpf2(3f));
path.reset(); path.reset();
path.setLastPoint(-AndroidUtilities.dpf2(5), AndroidUtilities.dpf2(4)); path.setLastPoint(-AndroidUtilities.dpf2(5), AndroidUtilities.dpf2(4));
path.lineTo(0, 0); path.lineTo(0, 0);
path.lineTo(AndroidUtilities.dpf2(5), AndroidUtilities.dpf2(4)); path.lineTo(AndroidUtilities.dpf2(5), AndroidUtilities.dpf2(4));
Paint p = new Paint(Paint.ANTI_ALIAS_FLAG); Paint p = new Paint(Paint.ANTI_ALIAS_FLAG);
p.setColor(Color.WHITE); p.setColor(Color.WHITE);
p.setAlpha(alphaInt); p.setAlpha(alphaInt);
p.setStyle(Paint.Style.STROKE); p.setStyle(Paint.Style.STROKE);
p.setStrokeCap(Paint.Cap.ROUND); p.setStrokeCap(Paint.Cap.ROUND);
p.setStrokeJoin(Paint.Join.ROUND); p.setStrokeJoin(Paint.Join.ROUND);
p.setStrokeWidth(AndroidUtilities.dpf2(1.5f)); p.setStrokeWidth(AndroidUtilities.dpf2(1.5f));
canvas.drawPath(path, p); canvas.drawPath(path, p);
canvas.restore(); canvas.restore();
canvas.save(); canvas.save();
tooltipBackgroundArrow.setBounds( tooltipBackgroundArrow.setBounds(
cx - tooltipBackgroundArrow.getIntrinsicWidth() / 2, (int) (tooltipLayout.getHeight() + AndroidUtilities.dpf2(20)), cx - tooltipBackgroundArrow.getIntrinsicWidth() / 2, (int) (tooltipLayout.getHeight() + AndroidUtilities.dpf2(20)),
cx + tooltipBackgroundArrow.getIntrinsicWidth() / 2, (int) (tooltipLayout.getHeight() + AndroidUtilities.dpf2(20)) + tooltipBackgroundArrow.getIntrinsicHeight() cx + tooltipBackgroundArrow.getIntrinsicWidth() / 2, (int) (tooltipLayout.getHeight() + AndroidUtilities.dpf2(20)) + tooltipBackgroundArrow.getIntrinsicHeight()
); );
tooltipBackgroundArrow.draw(canvas); tooltipBackgroundArrow.draw(canvas);
canvas.restore(); canvas.restore();
}
} }
canvas.save(); canvas.save();
@ -4437,9 +4440,12 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe
sendButton.setVisibility(GONE); sendButton.setVisibility(GONE);
cancelBotButton.setVisibility(GONE); cancelBotButton.setVisibility(GONE);
setSlowModeButtonVisible(false); setSlowModeButtonVisible(false);
audioVideoButtonContainer.setVisibility(VISIBLE);
runningAnimation = null; runningAnimation = null;
runningAnimationType = 0; runningAnimationType = 0;
if (audioVideoButtonContainer != null) {
audioVideoButtonContainer.setVisibility(VISIBLE);
}
} }
} }
@ -5112,7 +5118,9 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe
messageEditText.requestFocus(); messageEditText.requestFocus();
} }
recordedAudioBackground.setAlpha(1f); recordedAudioBackground.setAlpha(1f);
attachLayout.setTranslationX(0); if (attachLayout != null) {
attachLayout.setTranslationX(0);
}
slideText.setCancelToProgress(0f); slideText.setCancelToProgress(0f);
delegate.onAudioVideoInterfaceUpdated(); delegate.onAudioVideoInterfaceUpdated();

View File

@ -87,6 +87,8 @@ public class UndoView extends FrameLayout {
public final static int ACTION_QUIZ_CORRECT = 13; public final static int ACTION_QUIZ_CORRECT = 13;
public final static int ACTION_QUIZ_INCORRECT = 14; public final static int ACTION_QUIZ_INCORRECT = 14;
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_NO_SEND_INFO = 17;
public UndoView(Context context) { public UndoView(Context context) {
super(context); super(context);
@ -267,6 +269,12 @@ public class UndoView extends FrameLayout {
lastUpdateTime = SystemClock.elapsedRealtime(); lastUpdateTime = SystemClock.elapsedRealtime();
undoTextView.setText(LocaleController.getString("Undo", R.string.Undo).toUpperCase()); undoTextView.setText(LocaleController.getString("Undo", R.string.Undo).toUpperCase());
undoImageView.setVisibility(VISIBLE); undoImageView.setVisibility(VISIBLE);
infoTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 15);
infoTextView.setGravity(Gravity.LEFT | Gravity.TOP);
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) infoTextView.getLayoutParams();
layoutParams.height = LayoutHelper.WRAP_CONTENT;
layoutParams.bottomMargin = 0;
if (isTooltipAction()) { if (isTooltipAction()) {
CharSequence infoText; CharSequence infoText;
@ -328,7 +336,6 @@ public class UndoView extends FrameLayout {
leftImageView.setAnimation(icon, size, size); leftImageView.setAnimation(icon, size, size);
if (subInfoText != null) { if (subInfoText != null) {
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) infoTextView.getLayoutParams();
layoutParams.leftMargin = AndroidUtilities.dp(58); layoutParams.leftMargin = AndroidUtilities.dp(58);
layoutParams.topMargin = AndroidUtilities.dp(6); layoutParams.topMargin = AndroidUtilities.dp(6);
layoutParams.rightMargin = 0; layoutParams.rightMargin = 0;
@ -339,7 +346,6 @@ public class UndoView extends FrameLayout {
infoTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14); infoTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14);
infoTextView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf")); infoTextView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
} else { } else {
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) infoTextView.getLayoutParams();
layoutParams.leftMargin = AndroidUtilities.dp(58); layoutParams.leftMargin = AndroidUtilities.dp(58);
layoutParams.topMargin = AndroidUtilities.dp(13); layoutParams.topMargin = AndroidUtilities.dp(13);
layoutParams.rightMargin = 0; layoutParams.rightMargin = 0;
@ -359,7 +365,6 @@ public class UndoView extends FrameLayout {
infoTextView.setText(LocaleController.getString("AuthAnotherClientOk", R.string.AuthAnotherClientOk)); infoTextView.setText(LocaleController.getString("AuthAnotherClientOk", R.string.AuthAnotherClientOk));
leftImageView.setAnimation(R.raw.contact_check, 36, 36); leftImageView.setAnimation(R.raw.contact_check, 36, 36);
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) infoTextView.getLayoutParams();
layoutParams.leftMargin = AndroidUtilities.dp(58); layoutParams.leftMargin = AndroidUtilities.dp(58);
layoutParams.topMargin = AndroidUtilities.dp(6); layoutParams.topMargin = AndroidUtilities.dp(6);
subinfoTextView.setText(authorization.app_name); subinfoTextView.setText(authorization.app_name);
@ -381,7 +386,6 @@ public class UndoView extends FrameLayout {
leftImageView.setAnimation(R.raw.filter_new, 36, 36); leftImageView.setAnimation(R.raw.filter_new, 36, 36);
int margin = (int) Math.ceil(undoTextView.getPaint().measureText(undoTextView.getText().toString())) + AndroidUtilities.dp(26); int margin = (int) Math.ceil(undoTextView.getPaint().measureText(undoTextView.getText().toString())) + AndroidUtilities.dp(26);
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) infoTextView.getLayoutParams();
layoutParams.leftMargin = AndroidUtilities.dp(58); layoutParams.leftMargin = AndroidUtilities.dp(58);
layoutParams.rightMargin = margin; layoutParams.rightMargin = margin;
layoutParams.topMargin = AndroidUtilities.dp(6); layoutParams.topMargin = AndroidUtilities.dp(6);
@ -408,13 +412,38 @@ public class UndoView extends FrameLayout {
leftImageView.setProgress(0); leftImageView.setProgress(0);
leftImageView.playAnimation(); leftImageView.playAnimation();
} else if (currentAction == ACTION_THEME_CHANGED) { } else if (currentAction == ACTION_DICE_INFO || currentAction == ACTION_DICE_NO_SEND_INFO) {
TLRPC.TL_authorization authorization = (TLRPC.TL_authorization) infoObject; timeLeft = 4000;
infoTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14);
infoTextView.setGravity(Gravity.CENTER_VERTICAL);
infoTextView.setText(AndroidUtilities.replaceTags(LocaleController.getString("DiceInfo2", R.string.DiceInfo2)));
undoTextView.setText(LocaleController.getString("SendDice", R.string.SendDice));
leftImageView.setImageResource(R.drawable.dice);
int margin;
if (currentAction == ACTION_DICE_INFO) {
margin = (int) Math.ceil(undoTextView.getPaint().measureText(undoTextView.getText().toString())) + AndroidUtilities.dp(26);
undoTextView.setVisibility(VISIBLE);
undoTextView.setTextColor(Theme.getColor(Theme.key_undo_cancelColor));
undoImageView.setVisibility(GONE);
undoButton.setVisibility(VISIBLE);
} else {
margin = 0;
undoTextView.setVisibility(GONE);
undoButton.setVisibility(GONE);
}
layoutParams.leftMargin = AndroidUtilities.dp(58);
layoutParams.rightMargin = margin;
layoutParams.topMargin = 0;
layoutParams.bottomMargin = AndroidUtilities.dp(1);
layoutParams.height = TableLayout.LayoutParams.MATCH_PARENT;
subinfoTextView.setVisibility(GONE);
leftImageView.setVisibility(VISIBLE);
} else if (currentAction == ACTION_THEME_CHANGED) {
infoTextView.setText(LocaleController.getString("ColorThemeChanged", R.string.ColorThemeChanged)); infoTextView.setText(LocaleController.getString("ColorThemeChanged", R.string.ColorThemeChanged));
leftImageView.setImageResource(R.drawable.toast_pallete); leftImageView.setImageResource(R.drawable.toast_pallete);
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) infoTextView.getLayoutParams();
layoutParams.leftMargin = AndroidUtilities.dp(58); layoutParams.leftMargin = AndroidUtilities.dp(58);
layoutParams.rightMargin = AndroidUtilities.dp(48); layoutParams.rightMargin = AndroidUtilities.dp(48);
layoutParams.topMargin = AndroidUtilities.dp(6); layoutParams.topMargin = AndroidUtilities.dp(6);
@ -445,7 +474,6 @@ public class UndoView extends FrameLayout {
infoTextView.setText(LocaleController.getString("ChatsArchived", R.string.ChatsArchived)); infoTextView.setText(LocaleController.getString("ChatsArchived", R.string.ChatsArchived));
} }
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) infoTextView.getLayoutParams();
layoutParams.leftMargin = AndroidUtilities.dp(58); layoutParams.leftMargin = AndroidUtilities.dp(58);
layoutParams.topMargin = AndroidUtilities.dp(13); layoutParams.topMargin = AndroidUtilities.dp(13);
layoutParams.rightMargin = 0; layoutParams.rightMargin = 0;
@ -460,7 +488,6 @@ public class UndoView extends FrameLayout {
leftImageView.setProgress(0); leftImageView.setProgress(0);
leftImageView.playAnimation(); leftImageView.playAnimation();
} else { } else {
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) infoTextView.getLayoutParams();
layoutParams.leftMargin = AndroidUtilities.dp(45); layoutParams.leftMargin = AndroidUtilities.dp(45);
layoutParams.topMargin = AndroidUtilities.dp(13); layoutParams.topMargin = AndroidUtilities.dp(13);
layoutParams.rightMargin = 0; layoutParams.rightMargin = 0;
@ -509,7 +536,7 @@ public class UndoView extends FrameLayout {
width = AndroidUtilities.displaySize.x; width = AndroidUtilities.displaySize.x;
} }
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(28); undoViewHeight = infoTextView.getMeasuredHeight() + AndroidUtilities.dp(currentAction == ACTION_DICE_INFO ? 14 : 28);
} }
if (getVisibility() != VISIBLE) { if (getVisibility() != VISIBLE) {

View File

@ -1731,6 +1731,10 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
if (viewPages[0].selectedType == id) { if (viewPages[0].selectedType == id) {
return; return;
} }
ArrayList<MessagesController.DialogFilter> dialogFilters = getMessagesController().dialogFilters;
if (id != Integer.MAX_VALUE && (id < 0 || id >= dialogFilters.size())) {
return;
}
if (parentLayout != null) { if (parentLayout != null) {
parentLayout.getDrawerLayoutContainer().setAllowOpenDrawerBySwipe(id == filterTabsView.getFirstTabId()); parentLayout.getDrawerLayoutContainer().setAllowOpenDrawerBySwipe(id == filterTabsView.getFirstTabId());
} }
@ -1774,9 +1778,12 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
public int getTabCounter(int tabId) { public int getTabCounter(int tabId) {
if (tabId == Integer.MAX_VALUE) { if (tabId == Integer.MAX_VALUE) {
return getMessagesStorage().getMainUnreadCount(); return getMessagesStorage().getMainUnreadCount();
} else {
return getMessagesController().dialogFilters.get(tabId).unreadCount;
} }
ArrayList<MessagesController.DialogFilter> dialogFilters = getMessagesController().dialogFilters;
if (tabId < 0 || tabId >= dialogFilters.size()) {
return 0;
}
return getMessagesController().dialogFilters.get(tabId).unreadCount;
} }
@Override @Override
@ -3138,7 +3145,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
} else if (actionBar != null && actionBar.isActionModeShowed()) { } else if (actionBar != null && actionBar.isActionModeShowed()) {
hideActionMode(true); hideActionMode(true);
return false; return false;
} else if (filterTabsView != null && filterTabsView.getVisibility() == View.VISIBLE && !filterTabsView.isAnimatingIndicator() && filterTabsView.getCurrentTabId() != Integer.MAX_VALUE && !startedTracking) { } else if (filterTabsView != null && filterTabsView.getVisibility() == View.VISIBLE && !tabsAnimationInProgress && !filterTabsView.isAnimatingIndicator() && filterTabsView.getCurrentTabId() != Integer.MAX_VALUE && !startedTracking) {
filterTabsView.selectFirstTab(); filterTabsView.selectFirstTab();
return false; return false;
} else if (commentView != null && commentView.isPopupShowing()) { } else if (commentView != null && commentView.isPopupShowing()) {
@ -4839,7 +4846,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
} }
private void showFiltersHint() { private void showFiltersHint() {
if (askingForPermissions || !getMessagesController().filtersEnabled || filterTabsView == null || filterTabsView.getVisibility() == View.VISIBLE || isPaused || !getUserConfig().filtersLoaded) { if (askingForPermissions || !getMessagesController().showFiltersTooltip || filterTabsView == null || filterTabsView.getVisibility() == View.VISIBLE || isPaused || !getUserConfig().filtersLoaded) {
return; return;
} }
SharedPreferences preferences = MessagesController.getGlobalMainSettings(); SharedPreferences preferences = MessagesController.getGlobalMainSettings();

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

@ -969,7 +969,8 @@
<string name="TextSelectionHit">Hold the **word**, then move the cursor to select more text to copy.</string> <string name="TextSelectionHit">Hold the **word**, then move the cursor to select more text to copy.</string>
<string name="CardNumberCopied">Card number copied to clipboard</string> <string name="CardNumberCopied">Card number copied to clipboard</string>
<string name="CopyCardNumber">Copy</string> <string name="CopyCardNumber">Copy</string>
<string name="DiceInfo">The result of this throw was randomly generated by Telegram.\nSend a 🎲 emoji to any chat to get a random number from Telegram.</string> <string name="DiceInfo2">Send a **:dice:** emoji to any chat to roll a die.</string>
<string name="SendDice">SEND</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>