update to 9.5.1

This commit is contained in:
xaxtix 2023-03-09 03:57:14 +04:00
parent d374d4875d
commit 1a48adbec4
23 changed files with 135 additions and 111 deletions

View file

@ -97,7 +97,11 @@ public class SQLiteDatabase {
public void beginTransaction() throws SQLiteException { public void beginTransaction() throws SQLiteException {
if (inTransaction) { if (inTransaction) {
throw new SQLiteException("database already in transaction"); if (BuildVars.DEBUG_PRIVATE_VERSION) {
throw new SQLiteException("database already in transaction");
} else {
commitTransaction();
}
} }
inTransaction = true; inTransaction = true;
beginTransaction(sqliteHandle); beginTransaction(sqliteHandle);

View file

@ -2157,43 +2157,6 @@ public class AndroidUtilities {
} }
} }
public static void slowRunOnUIThread(Runnable runnable) {
slowRunOnUIThread(runnable, 12);
}
public static void slowRunOnUIThread(Runnable runnable, int triesCount) {
if (SharedConfig.getDevicePerformanceClass() >= SharedConfig.PERFORMANCE_CLASS_HIGH) {
runOnUIThread(runnable);
} else {
runOnUIThread(new TryPost(runnable, triesCount));
}
}
private static class TryPost implements Runnable {
private final Runnable runnable;
private int triesCount;
private long lastTime = System.currentTimeMillis();
private final long threshold = (long) (1000L / AndroidUtilities.screenRefreshRate * 1.25f);
public TryPost(Runnable runnable, int triesCount) {
this.runnable = runnable;
this.triesCount = triesCount;
}
public void run() {
final long now = System.currentTimeMillis();
if (triesCount <= 0 || now - lastTime <= threshold) {
runnable.run();
} else {
triesCount--;
lastTime = now;
AndroidUtilities.runOnUIThread(this);
}
}
}
public static void cancelRunOnUIThread(Runnable runnable) { public static void cancelRunOnUIThread(Runnable runnable) {
if (ApplicationLoader.applicationHandler == null) { if (ApplicationLoader.applicationHandler == null) {
return; return;

View file

@ -24,8 +24,8 @@ 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 NO_SCOPED_STORAGE = Build.VERSION.SDK_INT <= 29; public static boolean NO_SCOPED_STORAGE = Build.VERSION.SDK_INT <= 29;
public static int BUILD_VERSION = 3195; public static int BUILD_VERSION = 3199;
public static String BUILD_VERSION_STRING = "9.5.0"; public static String BUILD_VERSION_STRING = "9.5.1";
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

@ -1679,7 +1679,7 @@ public class FileLoader extends BaseController {
Runnable dumpFilesQueueRunnable = () -> { Runnable dumpFilesQueueRunnable = () -> {
for (int i = 0; i < smallFilesQueue.length; i++) { for (int i = 0; i < smallFilesQueue.length; i++) {
FileLog.d("download queue: dc" + (i + 1) + " small_operations=" + smallFilesQueue[i].allOperations.size() + " large_operations=" + largeFilesQueue[i].allOperations.size()); FileLog.d("download queue: dc" + (i + 1) + " account=" + currentAccount + " small_operations=" + smallFilesQueue[i].allOperations.size() + " large_operations=" + largeFilesQueue[i].allOperations.size());
} }
dumpFilesQueue(); dumpFilesQueue();
}; };

View file

@ -210,7 +210,7 @@ public class FilePathDatabase {
} }
} }
private void ensureDatabaseCreated() { public void ensureDatabaseCreated() {
if (!databaseCreated) { if (!databaseCreated) {
if (!NativeLoader.loaded()) { if (!NativeLoader.loaded()) {
int tryCount = 0; int tryCount = 0;

View file

@ -6656,7 +6656,7 @@ public class MessageObject {
} }
public boolean isMusic() { public boolean isMusic() {
return isMusicMessage(messageOwner) && !isVideo(); return isMusicMessage(messageOwner) && !isVideo() && !isRoundVideo();
} }
public boolean isDocument() { public boolean isDocument() {

View file

@ -7954,6 +7954,9 @@ public class MessagesController extends BaseController implements NotificationCe
LongSparseArray<TLRPC.Chat> chatsDict = new LongSparseArray<>(); LongSparseArray<TLRPC.Chat> chatsDict = new LongSparseArray<>();
for (int a = 0; a < messagesRes.users.size(); a++) { for (int a = 0; a < messagesRes.users.size(); a++) {
TLRPC.User u = messagesRes.users.get(a); TLRPC.User u = messagesRes.users.get(a);
if (BuildVars.DEBUG_VERSION) {
FileLog.d("processLoadedMessages(): +usersDict put " + u.id + " " + u);
}
usersDict.put(u.id, u); usersDict.put(u.id, u);
} }
for (int a = 0; a < messagesRes.chats.size(); a++) { for (int a = 0; a < messagesRes.chats.size(); a++) {

View file

@ -261,6 +261,20 @@ public class MessagesStorage extends BaseController {
} }
public void openDatabase(int openTries) { public void openDatabase(int openTries) {
if (!NativeLoader.loaded()) {
int tryCount = 0;
while (!NativeLoader.loaded()) {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
tryCount++;
if (tryCount > 5) {
break;
}
}
}
File filesDir = ApplicationLoader.getFilesDirFixed(); File filesDir = ApplicationLoader.getFilesDirFixed();
if (currentAccount != 0) { if (currentAccount != 0) {
filesDir = new File(filesDir, "account" + currentAccount + "/"); filesDir = new File(filesDir, "account" + currentAccount + "/");

View file

@ -4884,9 +4884,17 @@ public class SendMessagesHelper extends BaseController implements NotificationCe
} else { } else {
String location = message.obj.messageOwner.attachPath; String location = message.obj.messageOwner.attachPath;
TLRPC.Document document = message.obj.getDocument(); TLRPC.Document document = message.obj.getDocument();
if (message.sendEncryptedRequest != null && document.dc_id != 0) { if (message.sendEncryptedRequest != null && document.dc_id != 0) {
File file = new File(location); File file = new File(location);
if (!file.exists()) { if (!file.exists()) {
file = getFileLoader().getPathToMessage(message.obj.messageOwner);
if (file != null) {
message.obj.messageOwner.attachPath = location = file.getAbsolutePath();
}
}
if (file == null || !file.exists()) {
putToDelayedMessages(FileLoader.getAttachFileName(document), message); putToDelayedMessages(FileLoader.getAttachFileName(document), message);
getFileLoader().loadFile(document, message.parentObject, FileLoader.PRIORITY_HIGH, 0); getFileLoader().loadFile(document, message.parentObject, FileLoader.PRIORITY_HIGH, 0);
return; return;

View file

@ -15,12 +15,15 @@ import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.upstream.BaseDataSource; import com.google.android.exoplayer2.upstream.BaseDataSource;
import com.google.android.exoplayer2.upstream.DataSpec; import com.google.android.exoplayer2.upstream.DataSpec;
import com.google.android.exoplayer2.upstream.TransferListener; import com.google.android.exoplayer2.upstream.TransferListener;
import com.google.android.exoplayer2.util.Log;
import org.telegram.messenger.FileLoader; import org.telegram.messenger.FileLoader;
import org.telegram.messenger.FileLog;
import org.telegram.messenger.Utilities; import org.telegram.messenger.Utilities;
import java.io.EOFException; import java.io.EOFException;
import java.io.File; import java.io.File;
import java.io.FileInputStream;
import java.io.IOException; import java.io.IOException;
import java.io.RandomAccessFile; import java.io.RandomAccessFile;
@ -28,18 +31,15 @@ public final class EncryptedFileDataSource extends BaseDataSource {
public static class EncryptedFileDataSourceException extends IOException { public static class EncryptedFileDataSourceException extends IOException {
public EncryptedFileDataSourceException(IOException cause) { public EncryptedFileDataSourceException(Throwable cause) {
super(cause); super(cause);
} }
} }
private RandomAccessFile file;
private Uri uri; private Uri uri;
private long bytesRemaining; private long bytesRemaining;
private boolean opened; private boolean opened;
private byte[] key = new byte[32];
private byte[] iv = new byte[16];
private int fileOffset; private int fileOffset;
public EncryptedFileDataSource() { public EncryptedFileDataSource() {
@ -54,6 +54,8 @@ public final class EncryptedFileDataSource extends BaseDataSource {
} }
} }
EncryptedFileInputStream fileInputStream;
@Override @Override
public long open(DataSpec dataSpec) throws EncryptedFileDataSourceException { public long open(DataSpec dataSpec) throws EncryptedFileDataSourceException {
try { try {
@ -61,22 +63,21 @@ public final class EncryptedFileDataSource extends BaseDataSource {
File path = new File(dataSpec.uri.getPath()); File path = new File(dataSpec.uri.getPath());
String name = path.getName(); String name = path.getName();
File keyPath = new File(FileLoader.getInternalCacheDir(), name + ".key"); File keyPath = new File(FileLoader.getInternalCacheDir(), name + ".key");
RandomAccessFile keyFile = new RandomAccessFile(keyPath, "r");
keyFile.read(key);
keyFile.read(iv);
keyFile.close();
file = new RandomAccessFile(path, "r"); FileLog.d("EncryptedFileDataSource " + path + " " + keyPath);
file.seek(dataSpec.position); fileInputStream = new EncryptedFileInputStream(path, keyPath);
fileOffset = (int) dataSpec.position; fileInputStream.skip(dataSpec.position);
bytesRemaining = dataSpec.length == C.LENGTH_UNSET ? file.length() - dataSpec.position : dataSpec.length; bytesRemaining = dataSpec.length == C.LENGTH_UNSET ? fileInputStream.available() : dataSpec.length;
FileLog.d("EncryptedFileDataSource bytesRemaining" + bytesRemaining);
if (bytesRemaining < 0) { if (bytesRemaining < 0) {
throw new EOFException(); throw new EOFException();
} }
} catch (IOException e) { } catch (Exception e) {
FileLog.e(e);
throw new EncryptedFileDataSourceException(e); throw new EncryptedFileDataSourceException(e);
} }
FileLog.d("EncryptedFileDataSource opened");
opened = true; opened = true;
transferStarted(dataSpec); transferStarted(dataSpec);
@ -92,10 +93,10 @@ public final class EncryptedFileDataSource extends BaseDataSource {
} else { } else {
int bytesRead; int bytesRead;
try { try {
bytesRead = file.read(buffer, offset, (int) Math.min(bytesRemaining, readLength)); bytesRead = fileInputStream.read(buffer, offset, (int) Math.min(bytesRemaining, readLength));
Utilities.aesCtrDecryptionByteArray(buffer, key, iv, offset, bytesRead, fileOffset);
fileOffset += bytesRead; fileOffset += bytesRead;
} catch (IOException e) { } catch (IOException e) {
FileLog.e(e);
throw new EncryptedFileDataSourceException(e); throw new EncryptedFileDataSourceException(e);
} }
@ -118,13 +119,13 @@ public final class EncryptedFileDataSource extends BaseDataSource {
uri = null; uri = null;
fileOffset = 0; fileOffset = 0;
try { try {
if (file != null) { if (fileInputStream != null) {
file.close(); fileInputStream.close();
} }
} catch (IOException e) { } catch (IOException e) {
FileLog.e(e);
throw new EncryptedFileDataSourceException(e); throw new EncryptedFileDataSourceException(e);
} finally { } finally {
file = null;
if (opened) { if (opened) {
opened = false; opened = false;
transferEnded(); transferEnded();

View file

@ -452,6 +452,7 @@ public class CacheControlActivity extends BaseFragment implements NotificationCe
private void loadDialogEntities() { private void loadDialogEntities() {
getFileLoader().getFileDatabase().getQueue().postRunnable(() -> { getFileLoader().getFileDatabase().getQueue().postRunnable(() -> {
getFileLoader().getFileDatabase().ensureDatabaseCreated();
CacheModel cacheModel = new CacheModel(false); CacheModel cacheModel = new CacheModel(false);
LongSparseArray<DialogFileEntities> dilogsFilesEntities = new LongSparseArray<>(); LongSparseArray<DialogFileEntities> dilogsFilesEntities = new LongSparseArray<>();

View file

@ -53,6 +53,7 @@ import android.text.TextUtils;
import android.text.style.CharacterStyle; import android.text.style.CharacterStyle;
import android.text.style.ClickableSpan; import android.text.style.ClickableSpan;
import android.text.style.URLSpan; import android.text.style.URLSpan;
import android.util.Log;
import android.util.Property; import android.util.Property;
import android.util.SparseArray; import android.util.SparseArray;
import android.util.StateSet; import android.util.StateSet;
@ -82,6 +83,7 @@ import org.telegram.PhoneFormat.PhoneFormat;
import org.telegram.messenger.AccountInstance; import org.telegram.messenger.AccountInstance;
import org.telegram.messenger.AndroidUtilities; import org.telegram.messenger.AndroidUtilities;
import org.telegram.messenger.ApplicationLoader; import org.telegram.messenger.ApplicationLoader;
import org.telegram.messenger.BuildVars;
import org.telegram.messenger.ChatObject; import org.telegram.messenger.ChatObject;
import org.telegram.messenger.ContactsController; import org.telegram.messenger.ContactsController;
import org.telegram.messenger.DialogObject; import org.telegram.messenger.DialogObject;
@ -12931,9 +12933,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
} }
return ""; return "";
} }
{ return "DELETED";
return "DELETED";
}
} }
private Object getAuthorStatus() { private Object getAuthorStatus() {

View file

@ -328,6 +328,7 @@ public class DialogCell extends BaseCell {
private int thumbsCount; private int thumbsCount;
private boolean hasVideoThumb; private boolean hasVideoThumb;
private Paint thumbBackgroundPaint; private Paint thumbBackgroundPaint;
private boolean[] thumbImageSeen = new boolean[3];
private ImageReceiver[] thumbImage = new ImageReceiver[3]; private ImageReceiver[] thumbImage = new ImageReceiver[3];
private boolean[] drawPlay = new boolean[3]; private boolean[] drawPlay = new boolean[3];
private boolean[] drawSpoiler = new boolean[3]; private boolean[] drawSpoiler = new boolean[3];
@ -2270,6 +2271,11 @@ public class DialogCell extends BaseCell {
} }
for (int i = 0; i < thumbsCount; ++i) { for (int i = 0; i < thumbsCount; ++i) {
thumbImage[i].setImageX(left + offset + AndroidUtilities.dp((thumbSize + 2) * i)); thumbImage[i].setImageX(left + offset + AndroidUtilities.dp((thumbSize + 2) * i));
thumbImageSeen[i] = true;
}
} else {
for (int i = 0; i < 3; ++i) {
thumbImageSeen[i] = false;
} }
} }
} }
@ -3646,6 +3652,9 @@ public class DialogCell extends BaseCell {
canvas.translate(0, top); canvas.translate(0, top);
} }
for (int i = 0; i < thumbsCount; ++i) { for (int i = 0; i < thumbsCount; ++i) {
if (!thumbImageSeen[i]) {
continue;
}
if (thumbBackgroundPaint == null) { if (thumbBackgroundPaint == null) {
thumbBackgroundPaint = new Paint(Paint.ANTI_ALIAS_FLAG); thumbBackgroundPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
thumbBackgroundPaint.setShadowLayer(AndroidUtilities.dp(1.34f), 0, AndroidUtilities.dp(0.34f), 0x18000000); thumbBackgroundPaint.setShadowLayer(AndroidUtilities.dp(1.34f), 0, AndroidUtilities.dp(0.34f), 0x18000000);

View file

@ -344,7 +344,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
private long chatInviterId; private long chatInviterId;
private static ArrayList<ChatMessageCell> chatMessageCellsCache = new ArrayList<>(); private ArrayList<ChatMessageCell> chatMessageCellsCache = new ArrayList<>();
private HashMap<MessageObject, Boolean> alreadyPlayedStickers = new HashMap<>(); private HashMap<MessageObject, Boolean> alreadyPlayedStickers = new HashMap<>();
@ -2713,6 +2713,11 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
} }
actionBarBackgroundPaint.setColor(getThemedColor(Theme.key_actionBarDefault)); actionBarBackgroundPaint.setColor(getThemedColor(Theme.key_actionBarDefault));
if (chatMessageCellsCache.isEmpty()) {
for (int a = 0; a < 15; a++) {
chatMessageCellsCache.add(new ChatMessageCell(context, true, themeDelegate));
}
}
for (int a = 1; a >= 0; a--) { for (int a = 1; a >= 0; a--) {
selectedMessagesIds[a].clear(); selectedMessagesIds[a].clear();
selectedMessagesCanCopyIds[a].clear(); selectedMessagesCanCopyIds[a].clear();
@ -27541,14 +27546,15 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
View view = null; View view = null;
if (viewType == 0) { if (viewType == 0) {
if (!chatMessageCellsCache.isEmpty()) { if (!chatMessageCellsCache.isEmpty()) {
view = chatMessageCellsCache.remove(0); view = chatMessageCellsCache.get(0);
chatMessageCellsCache.remove(0);
} else { } else {
view = new ChatMessageCell(mContext, true, themeDelegate); view = new ChatMessageCell(mContext, true, themeDelegate);
} }
ChatMessageCell chatMessageCell = (ChatMessageCell) view; ChatMessageCell chatMessageCell = (ChatMessageCell) view;
chatMessageCell.setResourcesProvider(themeDelegate); chatMessageCell.setResourcesProvider(themeDelegate);
chatMessageCell.shouldCheckVisibleOnScreen = true; chatMessageCell.shouldCheckVisibleOnScreen = true;
chatMessageCell.setDelegate(getChatMessageCellDelegate()); chatMessageCell.setDelegate(new ChatMessageCellDelegate());
if (currentEncryptedChat == null) { if (currentEncryptedChat == null) {
chatMessageCell.setAllowAssistant(true); chatMessageCell.setAllowAssistant(true);
} }
@ -31661,14 +31667,6 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
return skeleton; return skeleton;
} }
public static void preload(Context context) {
if (context != null && chatMessageCellsCache.isEmpty()) {
for (int i = 0; i < 8; ++i) {
chatMessageCellsCache.add(new ChatMessageCell(context, true, null));
}
}
}
@Override @Override
public SizeNotifierFrameLayout getContentView() { public SizeNotifierFrameLayout getContentView() {
return contentView; return contentView;

View file

@ -2453,7 +2453,7 @@ public class ChatActivityEnterView extends BlurredFrameLayout implements Notific
if (Build.VERSION.SDK_INT >= 21) { if (Build.VERSION.SDK_INT >= 21) {
giftButton.setBackground(Theme.createSelectorDrawable(getThemedColor(Theme.key_listSelector))); giftButton.setBackground(Theme.createSelectorDrawable(getThemedColor(Theme.key_listSelector)));
} }
attachLayout.addView(giftButton, 0, LayoutHelper.createFrame(48, 48, Gravity.BOTTOM | Gravity.RIGHT)); attachLayout.addView(giftButton, 0, LayoutHelper.createFrame(48, 48, Gravity.CENTER_VERTICAL | Gravity.RIGHT));
giftButton.setOnClickListener(v -> new GiftPremiumBottomSheet(getParentFragment(), getParentFragment().getCurrentUser()).show()); giftButton.setOnClickListener(v -> new GiftPremiumBottomSheet(getParentFragment(), getParentFragment().getCurrentUser()).show());
} }
@ -5453,11 +5453,11 @@ public class ChatActivityEnterView extends BlurredFrameLayout implements Notific
scheduledButton.setVisibility(VISIBLE); scheduledButton.setVisibility(VISIBLE);
scheduledButton.setTag(1); scheduledButton.setTag(1);
scheduledButton.setPivotX(AndroidUtilities.dp(48)); scheduledButton.setPivotX(AndroidUtilities.dp(48));
animators.add(ObjectAnimator.ofFloat(scheduledButton, View.TRANSLATION_X, AndroidUtilities.dp(botButton != null && botButton.getVisibility() == VISIBLE ? 96 : 48))); animators.add(ObjectAnimator.ofFloat(scheduledButton, View.TRANSLATION_X, AndroidUtilities.dp(botButton != null && botButton.getVisibility() == VISIBLE ? 96 : 48) - AndroidUtilities.dp(giftButton != null && giftButton.getVisibility() == VISIBLE ? 48 : 0)));
animators.add(ObjectAnimator.ofFloat(scheduledButton, View.ALPHA, 1.0f)); animators.add(ObjectAnimator.ofFloat(scheduledButton, View.ALPHA, 1.0f));
animators.add(ObjectAnimator.ofFloat(scheduledButton, View.SCALE_X, 1.0f)); animators.add(ObjectAnimator.ofFloat(scheduledButton, View.SCALE_X, 1.0f));
} else { } else {
scheduledButton.setTranslationX(AndroidUtilities.dp(botButton != null && botButton.getVisibility() == VISIBLE ? 96 : 48)); scheduledButton.setTranslationX(AndroidUtilities.dp(botButton != null && botButton.getVisibility() == VISIBLE ? 96 : 48) - AndroidUtilities.dp(giftButton != null && giftButton.getVisibility() == VISIBLE ? 48 : 0));
scheduledButton.setAlpha(1.0f); scheduledButton.setAlpha(1.0f);
scheduledButton.setScaleX(1.0f); scheduledButton.setScaleX(1.0f);
} }
@ -5584,7 +5584,7 @@ public class ChatActivityEnterView extends BlurredFrameLayout implements Notific
scheduledButton.setVisibility(VISIBLE); scheduledButton.setVisibility(VISIBLE);
scheduledButton.setTag(1); scheduledButton.setTag(1);
} }
scheduledButton.setTranslationX(AndroidUtilities.dp(botButton != null && botButton.getVisibility() == VISIBLE ? 96 : 48)); scheduledButton.setTranslationX(AndroidUtilities.dp(botButton != null && botButton.getVisibility() == VISIBLE ? 96 : 48) - AndroidUtilities.dp(giftButton != null && giftButton.getVisibility() == VISIBLE ? 48 : 0));
scheduledButton.setAlpha(1.0f); scheduledButton.setAlpha(1.0f);
scheduledButton.setScaleX(1.0f); scheduledButton.setScaleX(1.0f);
scheduledButton.setScaleY(1.0f); scheduledButton.setScaleY(1.0f);
@ -5629,11 +5629,11 @@ public class ChatActivityEnterView extends BlurredFrameLayout implements Notific
scheduledButton.setTag(null); scheduledButton.setTag(null);
animators.add(ObjectAnimator.ofFloat(scheduledButton, View.ALPHA, 0.0f)); animators.add(ObjectAnimator.ofFloat(scheduledButton, View.ALPHA, 0.0f));
animators.add(ObjectAnimator.ofFloat(scheduledButton, View.SCALE_X, 0.0f)); animators.add(ObjectAnimator.ofFloat(scheduledButton, View.SCALE_X, 0.0f));
animators.add(ObjectAnimator.ofFloat(scheduledButton, View.TRANSLATION_X, AndroidUtilities.dp(botButton == null || botButton.getVisibility() == GONE ? 48 : 96))); animators.add(ObjectAnimator.ofFloat(scheduledButton, View.TRANSLATION_X, AndroidUtilities.dp(botButton != null && botButton.getVisibility() == VISIBLE ? 96 : 48) - AndroidUtilities.dp(giftButton != null && giftButton.getVisibility() == VISIBLE ? 48 : 0)));
} else { } else {
scheduledButton.setAlpha(0.0f); scheduledButton.setAlpha(0.0f);
scheduledButton.setScaleX(0.0f); scheduledButton.setScaleX(0.0f);
scheduledButton.setTranslationX(AndroidUtilities.dp(botButton == null || botButton.getVisibility() == GONE ? 48 : 96)); scheduledButton.setTranslationX(AndroidUtilities.dp(botButton != null && botButton.getVisibility() == VISIBLE ? 96 : 48) - AndroidUtilities.dp(giftButton != null && giftButton.getVisibility() == VISIBLE ? 48 : 0));
} }
} }
runningAnimation2.playTogether(animators); runningAnimation2.playTogether(animators);
@ -5788,7 +5788,7 @@ public class ChatActivityEnterView extends BlurredFrameLayout implements Notific
scheduledButton.setAlpha(0.0f); scheduledButton.setAlpha(0.0f);
scheduledButton.setScaleX(0.0f); scheduledButton.setScaleX(0.0f);
scheduledButton.setScaleY(1.0f); scheduledButton.setScaleY(1.0f);
scheduledButton.setTranslationX(AndroidUtilities.dp(botButton == null || botButton.getVisibility() == GONE ? 48 : 96)); scheduledButton.setTranslationX(AndroidUtilities.dp(botButton != null && botButton.getVisibility() == VISIBLE ? 96 : 48) - AndroidUtilities.dp(giftButton != null && giftButton.getVisibility() == VISIBLE ? 48 : 0));
} }
} }
} }
@ -5990,7 +5990,7 @@ public class ChatActivityEnterView extends BlurredFrameLayout implements Notific
scheduledButton.setPivotX(AndroidUtilities.dp(48)); scheduledButton.setPivotX(AndroidUtilities.dp(48));
animators.add(ObjectAnimator.ofFloat(scheduledButton, View.ALPHA, 1.0f)); animators.add(ObjectAnimator.ofFloat(scheduledButton, View.ALPHA, 1.0f));
animators.add(ObjectAnimator.ofFloat(scheduledButton, View.SCALE_X, 1.0f)); animators.add(ObjectAnimator.ofFloat(scheduledButton, View.SCALE_X, 1.0f));
animators.add(ObjectAnimator.ofFloat(scheduledButton, View.TRANSLATION_X, 0)); animators.add(ObjectAnimator.ofFloat(scheduledButton, View.TRANSLATION_X, giftButton != null && giftButton.getVisibility() == VISIBLE ? -AndroidUtilities.dp(48) : 0));
} else { } else {
scheduledButton.setAlpha(1.0f); scheduledButton.setAlpha(1.0f);
scheduledButton.setScaleX(1.0f); scheduledButton.setScaleX(1.0f);
@ -7410,8 +7410,9 @@ public class ChatActivityEnterView extends BlurredFrameLayout implements Notific
public void updateGiftButton(boolean animated) { public void updateGiftButton(boolean animated) {
boolean visible = !MessagesController.getInstance(currentAccount).premiumLocked && MessagesController.getInstance(currentAccount).giftAttachMenuIcon && boolean visible = !MessagesController.getInstance(currentAccount).premiumLocked && MessagesController.getInstance(currentAccount).giftAttachMenuIcon &&
MessagesController.getInstance(currentAccount).giftTextFieldIcon && getParentFragment() != null && getParentFragment().getCurrentUser() != null && !BuildVars.IS_BILLING_UNAVAILABLE && MessagesController.getInstance(currentAccount).giftTextFieldIcon && getParentFragment() != null && getParentFragment().getCurrentUser() != null &&
!getParentFragment().getCurrentUser().self && !getParentFragment().getCurrentUser().premium && getParentFragment().getCurrentUserInfo() != null && !getParentFragment().getCurrentUserInfo().premium_gifts.isEmpty(); !BuildVars.IS_BILLING_UNAVAILABLE && !getParentFragment().getCurrentUser().self && !getParentFragment().getCurrentUser().premium &&
getParentFragment().getCurrentUserInfo() != null && !getParentFragment().getCurrentUserInfo().premium_gifts.isEmpty() && !isInScheduleMode();
if (!visible && giftButton == null) { if (!visible && giftButton == null) {
return; return;
@ -7419,6 +7420,14 @@ public class ChatActivityEnterView extends BlurredFrameLayout implements Notific
createGiftButton(); createGiftButton();
AndroidUtilities.updateViewVisibilityAnimated(giftButton, visible, 1f, animated); AndroidUtilities.updateViewVisibilityAnimated(giftButton, visible, 1f, animated);
if (scheduledButton != null && scheduledButton.getVisibility() == View.VISIBLE) {
float tX = (visible ? -AndroidUtilities.dp(48) : 0) + AndroidUtilities.dp(botButton != null && botButton.getVisibility() == VISIBLE ? 48 : 0);
if (animated) {
scheduledButton.animate().translationX(tX).setDuration(150).start();
} else {
scheduledButton.setTranslationX(tX);
}
}
} }
public void updateScheduleButton(boolean animated) { public void updateScheduleButton(boolean animated) {
@ -7470,6 +7479,9 @@ public class ChatActivityEnterView extends BlurredFrameLayout implements Notific
if (notifyButton != null) { if (notifyButton != null) {
notifyButton.setVisibility(notifyVisible && scheduledButton.getVisibility() != VISIBLE ? VISIBLE : GONE); notifyButton.setVisibility(notifyVisible && scheduledButton.getVisibility() != VISIBLE ? VISIBLE : GONE);
} }
if (giftButton != null && giftButton.getVisibility() == VISIBLE) {
scheduledButton.setTranslationX(-AndroidUtilities.dp(48));
}
} }
} else if (scheduledButton != null) { } else if (scheduledButton != null) {
if (visible) { if (visible) {

View file

@ -231,16 +231,22 @@ public class LimitReachedBottomSheet extends BottomSheetWithRecyclerListView {
} }
private void sendInviteMessages() { private void sendInviteMessages() {
String link = null;
TLRPC.ChatFull chatFull = MessagesController.getInstance(currentAccount).getChatFull(fromChat.id);
if (chatFull == null) {
dismiss();
return;
}
if (fromChat.username != null) {
link = "@" + fromChat.username;
} else if (chatFull.exported_invite != null) {
link = chatFull.exported_invite.link;
} else {
dismiss();
return;
}
for (Object obj : selectedChats) { for (Object obj : selectedChats) {
TLRPC.User user = (TLRPC.User) obj; TLRPC.User user = (TLRPC.User) obj;
TLRPC.ChatFull chatFull = MessagesController.getInstance(currentAccount).getChatFull(fromChat.id);
String link;
if (fromChat.username != null) {
link = "@" + fromChat.username;
} else {
link = chatFull.exported_invite.link;
}
TLRPC.TL_webPage webPage = null;
SendMessagesHelper.getInstance(currentAccount).sendMessage(link, user.id, null, null, linkPreview, false, null, null, null, false, 0, null, false); SendMessagesHelper.getInstance(currentAccount).sendMessage(link, user.id, null, null, linkPreview, false, null, null, null, false, 0, null, false);
} }
AndroidUtilities.runOnUIThread(() -> { AndroidUtilities.runOnUIThread(() -> {
@ -497,7 +503,7 @@ public class LimitReachedBottomSheet extends BottomSheetWithRecyclerListView {
TLRPC.ChatFull chatFull = MessagesController.getInstance(currentAccount).getChatFull(fromChat.id); TLRPC.ChatFull chatFull = MessagesController.getInstance(currentAccount).getChatFull(fromChat.id);
String link; String link;
if (fromChat.username == null && chatFull != null) { if (fromChat.username == null && chatFull != null && chatFull.exported_invite != null) {
link = chatFull.exported_invite.link; link = chatFull.exported_invite.link;
TLRPC.TL_messages_getWebPage webPagePreview = new TLRPC.TL_messages_getWebPage(); TLRPC.TL_messages_getWebPage webPagePreview = new TLRPC.TL_messages_getWebPage();

View file

@ -906,7 +906,11 @@ public class ProfileGalleryView extends CircularViewPager implements Notificatio
thumbsFileNames.add(null); thumbsFileNames.add(null);
videoFileNames.add(null); videoFileNames.add(null);
imagesLocations.add(prevImageLocation); imagesLocations.add(prevImageLocation);
thumbsLocations.add(prevThumbLocation); ImageLocation thumbLocation = prevThumbLocation;
if (thumbLocation == null) {
thumbLocation = ImageLocation.getForPhoto(sizeThumb, photo);
}
thumbsLocations.add(thumbLocation);
vectorAvatars.add(prevVectorAvatarThumbDrawable); vectorAvatars.add(prevVectorAvatarThumbDrawable);
videoLocations.add(null); videoLocations.add(null);
photos.add(null); photos.add(null);
@ -1115,7 +1119,7 @@ public class ProfileGalleryView extends CircularViewPager implements Notificatio
item.imageView.isVideo = videoLocation != null; item.imageView.isVideo = videoLocation != null;
needProgress = vectorAvatars.get(imageLocationPosition) == null; needProgress = vectorAvatars.get(imageLocationPosition) == null;
ImageLocation location = thumbsLocations.get(imageLocationPosition); ImageLocation location = thumbsLocations.get(imageLocationPosition);
String filter = location.photoSize instanceof TLRPC.TL_photoStrippedSize ? "b" : null; String filter = (location != null && location.photoSize instanceof TLRPC.TL_photoStrippedSize) ? "b" : null;
String parent = "avatar_" + dialogId; String parent = "avatar_" + dialogId;
item.imageView.setImageMedia(vectorAvatars.get(imageLocationPosition), videoLocation, null, imagesLocations.get(imageLocationPosition), null, thumbsLocations.get(imageLocationPosition), filter, null, imagesLocationsSizes.get(imageLocationPosition), 1, parent); item.imageView.setImageMedia(vectorAvatars.get(imageLocationPosition), videoLocation, null, imagesLocations.get(imageLocationPosition), null, thumbsLocations.get(imageLocationPosition), filter, null, imagesLocationsSizes.get(imageLocationPosition), 1, parent);
} }

View file

@ -446,6 +446,10 @@ public class ReactedUsersListView extends FrameLayout {
} }
void setUserReaction(TLRPC.MessagePeerReaction reaction) { void setUserReaction(TLRPC.MessagePeerReaction reaction) {
if (reaction == null) {
return;
}
TLRPC.User u = MessagesController.getInstance(currentAccount).getUser(MessageObject.getPeerId(reaction.peer_id)); TLRPC.User u = MessagesController.getInstance(currentAccount).getUser(MessageObject.getPeerId(reaction.peer_id));
if (u == null) { if (u == null) {
return; return;

View file

@ -24,6 +24,7 @@ import org.telegram.messenger.LocaleController;
import org.telegram.messenger.MessagesController; import org.telegram.messenger.MessagesController;
import org.telegram.messenger.R; import org.telegram.messenger.R;
import org.telegram.messenger.TranslateController; import org.telegram.messenger.TranslateController;
import org.telegram.messenger.UserConfig;
import org.telegram.tgnet.TLRPC; import org.telegram.tgnet.TLRPC;
import org.telegram.ui.ActionBar.ActionBarMenuSubItem; import org.telegram.ui.ActionBar.ActionBarMenuSubItem;
import org.telegram.ui.ActionBar.ActionBarPopupWindow; import org.telegram.ui.ActionBar.ActionBarPopupWindow;
@ -302,5 +303,7 @@ public class TranslateButton extends FrameLayout {
} }
textView.setText(TextUtils.concat(translateIcon, " ", text)); textView.setText(TextUtils.concat(translateIcon, " ", text));
} }
menuView.setVisibility(UserConfig.getInstance(currentAccount).isPremium() ? VISIBLE : GONE);
} }
} }

View file

@ -2343,10 +2343,6 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
databaseMigrationHint = null; databaseMigrationHint = null;
} }
if (initialDialogsType == DIALOGS_TYPE_DEFAULT) {
AndroidUtilities.runOnUIThread(DialogsActivity::preload, 350);
}
return true; return true;
} }
@ -2368,14 +2364,6 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
} }
} }
private static void preload() {
if (SharedConfig.getDevicePerformanceClass() < SharedConfig.PERFORMANCE_CLASS_HIGH) {
SecretMediaViewer.getInstance();
ChatActivity.preload(ApplicationLoader.applicationContext);
ArticleViewer.hasInstance();
}
}
private Drawable premiumStar; private Drawable premiumStar;
public void updateStatus(TLRPC.User user, boolean animated) { public void updateStatus(TLRPC.User user, boolean animated) {
if (statusDrawable == null || actionBar == null) { if (statusDrawable == null || actionBar == null) {

View file

@ -223,7 +223,9 @@ public class LiteModeSettingsActivity extends BaseFragment {
items.add(Item.asCheckbox(LocaleController.getString("LiteOptionsBackground"), LiteMode.FLAG_CHAT_BACKGROUND)); items.add(Item.asCheckbox(LocaleController.getString("LiteOptionsBackground"), LiteMode.FLAG_CHAT_BACKGROUND));
items.add(Item.asCheckbox(LocaleController.getString("LiteOptionsTopics"), LiteMode.FLAG_CHAT_FORUM_TWOCOLUMN)); items.add(Item.asCheckbox(LocaleController.getString("LiteOptionsTopics"), LiteMode.FLAG_CHAT_FORUM_TWOCOLUMN));
items.add(Item.asCheckbox(LocaleController.getString("LiteOptionsSpoiler"), LiteMode.FLAG_CHAT_SPOILER)); items.add(Item.asCheckbox(LocaleController.getString("LiteOptionsSpoiler"), LiteMode.FLAG_CHAT_SPOILER));
items.add(Item.asCheckbox(LocaleController.getString("LiteOptionsBlur"), LiteMode.FLAG_CHAT_BLUR)); if (SharedConfig.canBlurChat()) {
items.add(Item.asCheckbox(LocaleController.getString("LiteOptionsBlur"), LiteMode.FLAG_CHAT_BLUR));
}
items.add(Item.asCheckbox(LocaleController.getString("LiteOptionsScale"), LiteMode.FLAG_CHAT_SCALE)); items.add(Item.asCheckbox(LocaleController.getString("LiteOptionsScale"), LiteMode.FLAG_CHAT_SCALE));
} }
items.add(Item.asSwitch(R.drawable.msg2_call_earpiece, LocaleController.getString("LiteOptionsCalls"), LiteMode.FLAG_CALLS_ANIMATIONS)); items.add(Item.asSwitch(R.drawable.msg2_call_earpiece, LocaleController.getString("LiteOptionsCalls"), LiteMode.FLAG_CALLS_ANIMATIONS));
@ -557,6 +559,9 @@ public class LiteModeSettingsActivity extends BaseFragment {
count += ((flags & LiteMode.FLAG_ANIMATED_EMOJI_CHAT_NOT_PREMIUM) > 0 ? -1 : 0) + ((flags & LiteMode.FLAG_ANIMATED_EMOJI_CHAT_PREMIUM) > 0 ? -1 : 0) + ((flags & LiteMode.FLAG_ANIMATED_EMOJI_CHAT) > 0 ? +1 : 0); count += ((flags & LiteMode.FLAG_ANIMATED_EMOJI_CHAT_NOT_PREMIUM) > 0 ? -1 : 0) + ((flags & LiteMode.FLAG_ANIMATED_EMOJI_CHAT_PREMIUM) > 0 ? -1 : 0) + ((flags & LiteMode.FLAG_ANIMATED_EMOJI_CHAT) > 0 ? +1 : 0);
count += ((flags & LiteMode.FLAG_ANIMATED_EMOJI_REACTIONS_NOT_PREMIUM) > 0 ? -1 : 0) + ((flags & LiteMode.FLAG_ANIMATED_EMOJI_REACTIONS_PREMIUM) > 0 ? -1 : 0) + ((flags & LiteMode.FLAG_ANIMATED_EMOJI_REACTIONS) > 0 ? +1 : 0); count += ((flags & LiteMode.FLAG_ANIMATED_EMOJI_REACTIONS_NOT_PREMIUM) > 0 ? -1 : 0) + ((flags & LiteMode.FLAG_ANIMATED_EMOJI_REACTIONS_PREMIUM) > 0 ? -1 : 0) + ((flags & LiteMode.FLAG_ANIMATED_EMOJI_REACTIONS) > 0 ? +1 : 0);
count += ((flags & LiteMode.FLAG_ANIMATED_EMOJI_KEYBOARD_NOT_PREMIUM) > 0 ? -1 : 0) + ((flags & LiteMode.FLAG_ANIMATED_EMOJI_KEYBOARD_PREMIUM) > 0 ? -1 : 0) + ((flags & LiteMode.FLAG_ANIMATED_EMOJI_KEYBOARD) > 0 ? +1 : 0); count += ((flags & LiteMode.FLAG_ANIMATED_EMOJI_KEYBOARD_NOT_PREMIUM) > 0 ? -1 : 0) + ((flags & LiteMode.FLAG_ANIMATED_EMOJI_KEYBOARD_PREMIUM) > 0 ? -1 : 0) + ((flags & LiteMode.FLAG_ANIMATED_EMOJI_KEYBOARD) > 0 ? +1 : 0);
if (!SharedConfig.canBlurChat() && (flags & LiteMode.FLAG_CHAT_BLUR) > 0) {
count--;
}
return count; return count;
} }

View file

@ -9,6 +9,7 @@ import com.microsoft.appcenter.crashes.Crashes;
import com.microsoft.appcenter.distribute.Distribute; import com.microsoft.appcenter.distribute.Distribute;
import org.telegram.messenger.regular.BuildConfig; import org.telegram.messenger.regular.BuildConfig;
import org.telegram.tgnet.TLRPC;
public class ApplicationLoaderImpl extends ApplicationLoader { public class ApplicationLoaderImpl extends ApplicationLoader {
@Override @Override

View file

@ -13,8 +13,8 @@
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true # org.gradle.parallel=true
#Sat Mar 12 05:53:50 MSK 2016 #Sat Mar 12 05:53:50 MSK 2016
APP_VERSION_CODE=3195 APP_VERSION_CODE=3199
APP_VERSION_NAME=9.5.0 APP_VERSION_NAME=9.5.1
APP_PACKAGE=org.telegram.messenger APP_PACKAGE=org.telegram.messenger
RELEASE_KEY_PASSWORD=android RELEASE_KEY_PASSWORD=android
RELEASE_KEY_ALIAS=androidkey RELEASE_KEY_ALIAS=androidkey