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 tgVoipDexClasses = ["AudioRecordJNI", "AudioTrackJNI", "NativeTgVoipDelegate", "NativeTgVoipInstance", "TgVoipNativeLoader", "Resampler", "VLog"]
@ -380,7 +380,7 @@ android {
defaultConfig {
minSdkVersion 16
targetSdkVersion 28
versionName "6.0.0"
versionName "6.0.1"
vectorDrawables.generatedDensities = ['mdpi', 'hdpi', 'xhdpi', 'xxhdpi']

View file

@ -1,3 +1,3 @@
APP_PLATFORM := android-16
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 CHECK_UPDATES = true;
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 int APP_ID = 4;
public static String APP_HASH = "014b35b6184100b085b0d0572f9b5103";

View file

@ -257,6 +257,7 @@ public class MessagesController extends BaseController implements NotificationCe
public boolean backgroundConnection;
public float animatedEmojisZoom;
public boolean filtersEnabled;
public boolean showFiltersTooltip;
public String venueSearchBot;
public String gifSearchBot;
public String imageSearchBot;
@ -524,6 +525,7 @@ public class MessagesController extends BaseController implements NotificationCe
animatedEmojisZoom = mainPreferences.getFloat("animatedEmojisZoom", 0.625f);
qrLoginCamera = mainPreferences.getBoolean("qrLoginCamera", 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) {
@ -993,6 +995,15 @@ public class MessagesController extends BaseController implements NotificationCe
filtersEnabled = bool.value;
editor.putBoolean("filtersEnabled", filtersEnabled);
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);
}
}
@ -11630,9 +11641,13 @@ public class MessagesController extends BaseController implements NotificationCe
}
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);
if (mute_type == -1) {
return !getNotificationsController().isGlobalNotificationsEnabled(dialog_id);
return !getNotificationsController().isGlobalNotificationsEnabled(dialog_id, chat);
}
if (mute_type == 2) {
return true;

View file

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

View file

@ -10,13 +10,13 @@ package org.telegram.messenger;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.os.Build;
import java.io.File;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.Locale;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
@ -24,36 +24,105 @@ public class NativeLoader {
private final static int LIB_VERSION = 30;
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 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) {
if (!nativeLoaded) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR2) {
if (!loadNativeLib(context, SHARED_LIB_NAME)) {
throw new IllegalStateException("unable to load shared c++ library: " + SHARED_LIB_NAME);
@SuppressLint({"UnsafeDynamicallyLoadedCode", "SetWorldReadable"})
private static boolean loadFromZip(Context context, File destDir, File destLocalFile, String folder) {
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_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)) {
throw new IllegalStateException("unable to load native library: " + LIB_NAME);
if (zipFile != null) {
try {
zipFile.close();
} catch (Exception e) {
FileLog.e(e);
}
}
nativeLoaded = true;
}
return false;
}
@SuppressLint("UnsafeDynamicallyLoadedCode")
private static boolean loadNativeLib(Context context, String libName) {
public static synchronized void initNativeLibs(Context context) {
if (nativeLoaded) {
return;
}
try {
try {
System.loadLibrary(libName);
System.loadLibrary(LIB_NAME);
nativeLoaded = true;
if (BuildVars.LOGS_ENABLED) {
FileLog.d("loaded normal lib: " + libName);
FileLog.d("loaded normal lib");
}
return true;
return;
} catch (Error e) {
FileLog.e(e);
}
@ -89,17 +158,32 @@ public class NativeLoader {
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");
destDir.mkdirs();
File destLocalFile = new File(destDir, "lib" + libName + "loc.so");
File destLocalFile = new File(destDir, LOCALE_LIB_SO_NAME);
if (destLocalFile.exists()) {
try {
System.load(destLocalFile.getAbsolutePath());
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) {
FileLog.e(e);
}
@ -107,89 +191,24 @@ public class NativeLoader {
}
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)) {
return true;
if (loadFromZip(context, destDir, destLocalFile, folder)) {
return;
}
} catch (Throwable e) {
e.printStackTrace();
}
try {
System.loadLibrary(libName);
if (BuildVars.LOGS_ENABLED) {
FileLog.d("loaded lib: " + libName);
}
return true;
System.loadLibrary(LIB_NAME);
nativeLoaded = true;
} catch (Error e) {
FileLog.e(e);
}
return false;
}
@SuppressLint({"UnsafeDynamicallyLoadedCode", "SetWorldReadable"})
private static boolean loadFromZip(Context context, File destDir, File destLocalFile, String folder, String libName) {
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;
}
private static native void init(String path, boolean enable);
//public static native void crash();
}

View file

@ -3805,10 +3805,16 @@ public class NotificationsController extends BaseController {
}
public boolean isGlobalNotificationsEnabled(long did) {
return isGlobalNotificationsEnabled(did, null);
}
public boolean isGlobalNotificationsEnabled(long did, TLRPC.Chat chat) {
int type;
int lower_id = (int) did;
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) {
type = TYPE_CHANNEL;
} else {

View file

@ -250,7 +250,7 @@ public class SharedLinkCell extends FrameLayout {
}
}
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);
} else {
links.add(link);

View file

@ -16144,15 +16144,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
return;
}
if (message.isDice()) {
try {
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();
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));
} else if (message.isAnimatedEmoji()) {
restartSticker(cell);
} else if (message.needDrawBluredPreview()) {

View file

@ -944,7 +944,7 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe
@Override
protected void onDraw(Canvas canvas) {
float multilinTooltipOffset = 0;
if (tooltipLayout.getLineCount() > 1) {
if (tooltipLayout != null && tooltipLayout.getLineCount() > 1) {
multilinTooltipOffset = tooltipLayout.getHeight() - tooltipLayout.getLineBottom(0);
}
int cx = getMeasuredWidth() - AndroidUtilities.dp2(26);
@ -1192,47 +1192,50 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe
}
}
int alphaInt = (int) (tooltipAlpha * 255);
tooltipBackground.setAlpha(alphaInt);
tooltipBackgroundArrow.setAlpha(alphaInt);
tooltipPaint.setAlpha(alphaInt);
canvas.save();
rectF.set(0, 0, getMeasuredWidth(), getMeasuredHeight());
canvas.translate(getMeasuredWidth() - tooltipWidth - AndroidUtilities.dp(44), AndroidUtilities.dpf2(16));
tooltipBackground.setBounds(
-AndroidUtilities.dp(8), -AndroidUtilities.dp(2),
(int) (tooltipWidth + AndroidUtilities.dp(36)), (int) (tooltipLayout.getHeight() + AndroidUtilities.dpf2(4))
);
tooltipBackground.draw(canvas);
tooltipLayout.draw(canvas);
canvas.restore();
if (tooltipLayout != null) {
canvas.save();
rectF.set(0, 0, getMeasuredWidth(), getMeasuredHeight());
canvas.translate(getMeasuredWidth() - tooltipWidth - AndroidUtilities.dp(44), AndroidUtilities.dpf2(16));
tooltipBackground.setBounds(
-AndroidUtilities.dp(8), -AndroidUtilities.dp(2),
(int) (tooltipWidth + AndroidUtilities.dp(36)), (int) (tooltipLayout.getHeight() + AndroidUtilities.dpf2(4))
);
tooltipBackground.draw(canvas);
tooltipLayout.draw(canvas);
canvas.restore();
canvas.save();
canvas.translate(cx, AndroidUtilities.dpf2(17) + tooltipLayout.getHeight() / 2f - idleProgress * AndroidUtilities.dpf2(3f));
path.reset();
path.setLastPoint(-AndroidUtilities.dpf2(5), AndroidUtilities.dpf2(4));
path.lineTo(0, 0);
path.lineTo(AndroidUtilities.dpf2(5), AndroidUtilities.dpf2(4));
canvas.save();
canvas.translate(cx, AndroidUtilities.dpf2(17) + tooltipLayout.getHeight() / 2f - idleProgress * AndroidUtilities.dpf2(3f));
path.reset();
path.setLastPoint(-AndroidUtilities.dpf2(5), AndroidUtilities.dpf2(4));
path.lineTo(0, 0);
path.lineTo(AndroidUtilities.dpf2(5), AndroidUtilities.dpf2(4));
Paint p = new Paint(Paint.ANTI_ALIAS_FLAG);
p.setColor(Color.WHITE);
p.setAlpha(alphaInt);
p.setStyle(Paint.Style.STROKE);
p.setStrokeCap(Paint.Cap.ROUND);
p.setStrokeJoin(Paint.Join.ROUND);
p.setStrokeWidth(AndroidUtilities.dpf2(1.5f));
canvas.drawPath(path, p);
canvas.restore();
Paint p = new Paint(Paint.ANTI_ALIAS_FLAG);
p.setColor(Color.WHITE);
p.setAlpha(alphaInt);
p.setStyle(Paint.Style.STROKE);
p.setStrokeCap(Paint.Cap.ROUND);
p.setStrokeJoin(Paint.Join.ROUND);
p.setStrokeWidth(AndroidUtilities.dpf2(1.5f));
canvas.drawPath(path, p);
canvas.restore();
canvas.save();
tooltipBackgroundArrow.setBounds(
cx - tooltipBackgroundArrow.getIntrinsicWidth() / 2, (int) (tooltipLayout.getHeight() + AndroidUtilities.dpf2(20)),
cx + tooltipBackgroundArrow.getIntrinsicWidth() / 2, (int) (tooltipLayout.getHeight() + AndroidUtilities.dpf2(20)) + tooltipBackgroundArrow.getIntrinsicHeight()
);
tooltipBackgroundArrow.draw(canvas);
canvas.restore();
canvas.save();
tooltipBackgroundArrow.setBounds(
cx - tooltipBackgroundArrow.getIntrinsicWidth() / 2, (int) (tooltipLayout.getHeight() + AndroidUtilities.dpf2(20)),
cx + tooltipBackgroundArrow.getIntrinsicWidth() / 2, (int) (tooltipLayout.getHeight() + AndroidUtilities.dpf2(20)) + tooltipBackgroundArrow.getIntrinsicHeight()
);
tooltipBackgroundArrow.draw(canvas);
canvas.restore();
}
}
canvas.save();
@ -4437,9 +4440,12 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe
sendButton.setVisibility(GONE);
cancelBotButton.setVisibility(GONE);
setSlowModeButtonVisible(false);
audioVideoButtonContainer.setVisibility(VISIBLE);
runningAnimation = null;
runningAnimationType = 0;
if (audioVideoButtonContainer != null) {
audioVideoButtonContainer.setVisibility(VISIBLE);
}
}
}
@ -5112,7 +5118,9 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe
messageEditText.requestFocus();
}
recordedAudioBackground.setAlpha(1f);
attachLayout.setTranslationX(0);
if (attachLayout != null) {
attachLayout.setTranslationX(0);
}
slideText.setCancelToProgress(0f);
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_INCORRECT = 14;
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) {
super(context);
@ -267,6 +269,12 @@ public class UndoView extends FrameLayout {
lastUpdateTime = SystemClock.elapsedRealtime();
undoTextView.setText(LocaleController.getString("Undo", R.string.Undo).toUpperCase());
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()) {
CharSequence infoText;
@ -328,7 +336,6 @@ public class UndoView extends FrameLayout {
leftImageView.setAnimation(icon, size, size);
if (subInfoText != null) {
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) infoTextView.getLayoutParams();
layoutParams.leftMargin = AndroidUtilities.dp(58);
layoutParams.topMargin = AndroidUtilities.dp(6);
layoutParams.rightMargin = 0;
@ -339,7 +346,6 @@ public class UndoView extends FrameLayout {
infoTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14);
infoTextView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
} else {
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) infoTextView.getLayoutParams();
layoutParams.leftMargin = AndroidUtilities.dp(58);
layoutParams.topMargin = AndroidUtilities.dp(13);
layoutParams.rightMargin = 0;
@ -359,7 +365,6 @@ public class UndoView extends FrameLayout {
infoTextView.setText(LocaleController.getString("AuthAnotherClientOk", R.string.AuthAnotherClientOk));
leftImageView.setAnimation(R.raw.contact_check, 36, 36);
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) infoTextView.getLayoutParams();
layoutParams.leftMargin = AndroidUtilities.dp(58);
layoutParams.topMargin = AndroidUtilities.dp(6);
subinfoTextView.setText(authorization.app_name);
@ -381,7 +386,6 @@ public class UndoView extends FrameLayout {
leftImageView.setAnimation(R.raw.filter_new, 36, 36);
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.rightMargin = margin;
layoutParams.topMargin = AndroidUtilities.dp(6);
@ -408,13 +412,38 @@ public class UndoView extends FrameLayout {
leftImageView.setProgress(0);
leftImageView.playAnimation();
} else if (currentAction == ACTION_THEME_CHANGED) {
TLRPC.TL_authorization authorization = (TLRPC.TL_authorization) infoObject;
} else if (currentAction == ACTION_DICE_INFO || currentAction == ACTION_DICE_NO_SEND_INFO) {
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));
leftImageView.setImageResource(R.drawable.toast_pallete);
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) infoTextView.getLayoutParams();
layoutParams.leftMargin = AndroidUtilities.dp(58);
layoutParams.rightMargin = AndroidUtilities.dp(48);
layoutParams.topMargin = AndroidUtilities.dp(6);
@ -445,7 +474,6 @@ public class UndoView extends FrameLayout {
infoTextView.setText(LocaleController.getString("ChatsArchived", R.string.ChatsArchived));
}
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) infoTextView.getLayoutParams();
layoutParams.leftMargin = AndroidUtilities.dp(58);
layoutParams.topMargin = AndroidUtilities.dp(13);
layoutParams.rightMargin = 0;
@ -460,7 +488,6 @@ public class UndoView extends FrameLayout {
leftImageView.setProgress(0);
leftImageView.playAnimation();
} else {
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) infoTextView.getLayoutParams();
layoutParams.leftMargin = AndroidUtilities.dp(45);
layoutParams.topMargin = AndroidUtilities.dp(13);
layoutParams.rightMargin = 0;
@ -509,7 +536,7 @@ public class UndoView extends FrameLayout {
width = AndroidUtilities.displaySize.x;
}
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) {

View file

@ -1731,6 +1731,10 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
if (viewPages[0].selectedType == id) {
return;
}
ArrayList<MessagesController.DialogFilter> dialogFilters = getMessagesController().dialogFilters;
if (id != Integer.MAX_VALUE && (id < 0 || id >= dialogFilters.size())) {
return;
}
if (parentLayout != null) {
parentLayout.getDrawerLayoutContainer().setAllowOpenDrawerBySwipe(id == filterTabsView.getFirstTabId());
}
@ -1774,9 +1778,12 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
public int getTabCounter(int tabId) {
if (tabId == Integer.MAX_VALUE) {
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
@ -3138,7 +3145,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
} else if (actionBar != null && actionBar.isActionModeShowed()) {
hideActionMode(true);
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();
return false;
} else if (commentView != null && commentView.isPopupShowing()) {
@ -4839,7 +4846,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
}
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;
}
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="CardNumberCopied">Card number copied to clipboard</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-->
<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>