Update to 6.2.0 (1986)

This commit is contained in:
DrKLO 2020-06-05 17:08:29 +03:00
parent e2f7baf2bd
commit f424ea165a
10 changed files with 89 additions and 103 deletions

View File

@ -276,7 +276,7 @@ android {
}
}
defaultConfig.versionCode = 1985
defaultConfig.versionCode = 1986
def tgVoipDexFileName = "libtgvoip.dex"
def tgVoipDexClasses = ["AudioRecordJNI", "AudioTrackJNI", "NativeTgVoipDelegate", "NativeTgVoipInstance", "TgVoipNativeLoader", "Resampler", "VLog"]

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 = 1985;
public static int BUILD_VERSION = 1986;
public static String BUILD_VERSION_STRING = "6.2.0";
public static int APP_ID = 4;
public static String APP_HASH = "014b35b6184100b085b0d0572f9b5103";

View File

@ -2046,8 +2046,8 @@ public class MessagesStorage extends BaseController {
flag = MessagesController.DIALOG_FILTER_FLAG_GROUPS;
}
if ((flags & flag) != 0) {
if (((flags & MessagesController.DIALOG_FILTER_FLAG_EXCLUDE_ARCHIVED) == 0 || archivedDialogs.indexOfKey(-chat.id) < 0 || dialogsWithMentions.indexOfKey(-chat.id) >= 0) &&
((flags & MessagesController.DIALOG_FILTER_FLAG_EXCLUDE_MUTED) == 0 || mutedDialogs.indexOfKey(-chat.id) < 0)) {
if (((flags & MessagesController.DIALOG_FILTER_FLAG_EXCLUDE_ARCHIVED) == 0 || archivedDialogs.indexOfKey(-chat.id) < 0) &&
((flags & MessagesController.DIALOG_FILTER_FLAG_EXCLUDE_MUTED) == 0 || mutedDialogs.indexOfKey(-chat.id) < 0 || dialogsWithMentions.indexOfKey(-chat.id) >= 0)) {
unreadCount--;
}
}
@ -3537,15 +3537,23 @@ public class MessagesStorage extends BaseController {
public void resetMentionsCount(final long did, final int count) {
storageQueue.postRunnable(() -> {
try {
if (count == 0) {
database.executeFast(String.format(Locale.US, "UPDATE messages SET read_state = read_state | 2 WHERE uid = %d AND mention = 1 AND read_state IN(0, 1)", did)).stepThis().dispose();
int prevUnreadCount = 0;
SQLiteCursor cursor = database.queryFinalized("SELECT unread_count_i FROM dialogs WHERE did = " + did);
if (cursor.next()) {
prevUnreadCount = cursor.intValue(0);
}
database.executeFast(String.format(Locale.US, "UPDATE dialogs SET unread_count_i = %d WHERE did = %d", count, did)).stepThis().dispose();
LongSparseArray<Integer> sparseArray = new LongSparseArray<>(1);
sparseArray.put(did, count);
getMessagesController().processDialogsUpdateRead(null, sparseArray);
if (count == 0) {
updateFiltersReadCounter(null, sparseArray, true);
cursor.dispose();
if (prevUnreadCount != 0 || count != 0) {
if (count == 0) {
database.executeFast(String.format(Locale.US, "UPDATE messages SET read_state = read_state | 2 WHERE uid = %d AND mention = 1 AND read_state IN(0, 1)", did)).stepThis().dispose();
}
database.executeFast(String.format(Locale.US, "UPDATE dialogs SET unread_count_i = %d WHERE did = %d", count, did)).stepThis().dispose();
LongSparseArray<Integer> sparseArray = new LongSparseArray<>(1);
sparseArray.put(did, count);
getMessagesController().processDialogsUpdateRead(null, sparseArray);
if (count == 0) {
updateFiltersReadCounter(null, sparseArray, true);
}
}
} catch (Exception e) {
FileLog.e(e);
@ -3967,74 +3975,6 @@ public class MessagesStorage extends BaseController {
}
}
if (filter != null) {
for (int b = 0, N2 = filter.alwaysShow.size(); b < N2; b++) {
int did = filter.alwaysShow.get(b);
if (did > 0) {
TLRPC.User user = usersDict.get(did);
if (user != null) {
if ((flags & MessagesController.DIALOG_FILTER_FLAG_EXCLUDE_MUTED) != 0 && mutedDialogs.indexOfKey(user.id) >= 0) {
unreadCount--;
} else {
if (user.bot) {
if ((flags & MessagesController.DIALOG_FILTER_FLAG_BOTS) == 0) {
unreadCount--;
}
} else if (user.self || user.contact) {
if ((flags & MessagesController.DIALOG_FILTER_FLAG_CONTACTS) == 0) {
unreadCount--;
}
} else {
if ((flags & MessagesController.DIALOG_FILTER_FLAG_NON_CONTACTS) == 0) {
unreadCount--;
}
}
}
}
user = encUsersDict.get(did);
if (user != null) {
int count = encryptedChatsByUsersCount.get(did, 0);
if ((flags & MessagesController.DIALOG_FILTER_FLAG_EXCLUDE_MUTED) != 0 && mutedDialogs.indexOfKey(user.id) >= 0) {
unreadCount -= count;
} else {
if (user.bot) {
if ((flags & MessagesController.DIALOG_FILTER_FLAG_BOTS) == 0) {
unreadCount -= count;
}
} else if (user.self || user.contact) {
if ((flags & MessagesController.DIALOG_FILTER_FLAG_CONTACTS) == 0) {
unreadCount -= count;
}
} else {
if ((flags & MessagesController.DIALOG_FILTER_FLAG_NON_CONTACTS) == 0) {
unreadCount -= count;
}
}
}
}
} else {
TLRPC.Chat chat = chatsDict.get(-did);
if (chat != null) {
if ((flags & MessagesController.DIALOG_FILTER_FLAG_EXCLUDE_MUTED) != 0 && mutedDialogs.indexOfKey(-chat.id) >= 0 && dialogsWithMentions.indexOfKey(-chat.id) < 0 && dialogsWithUnread.indexOfKey(-chat.id) < 0) {
unreadCount--;
} else {
if (ChatObject.isChannel(chat) && !chat.megagroup) {
if ((flags & MessagesController.DIALOG_FILTER_FLAG_CHANNELS) == 0) {
unreadCount--;
}
} else {
if ((flags & MessagesController.DIALOG_FILTER_FLAG_GROUPS) == 0) {
boolean hasUnread = dialogsWithUnread.indexOfKey(did) >= 0;
boolean hasMention = dialogsWithMentions.indexOfKey(did) >= 0;
if (!hasUnread && !hasMention) {
unreadCount--;
}
}
}
}
}
}
}
for (int b = 0, N2 = filter.alwaysShow.size(); b < N2; b++) {
int did = filter.alwaysShow.get(b);
if (did > 0) {
@ -4132,8 +4072,8 @@ public class MessagesStorage extends BaseController {
flag = MessagesController.DIALOG_FILTER_FLAG_GROUPS;
}
if ((flags & flag) != 0) {
if (((flags & MessagesController.DIALOG_FILTER_FLAG_EXCLUDE_ARCHIVED) == 0 || archivedDialogs.indexOfKey(-chat.id) < 0 || dialogsWithMentions.indexOfKey(-chat.id) >= 0) &&
((flags & MessagesController.DIALOG_FILTER_FLAG_EXCLUDE_MUTED) == 0 || mutedDialogs.indexOfKey(-chat.id) < 0)) {
if (((flags & MessagesController.DIALOG_FILTER_FLAG_EXCLUDE_ARCHIVED) == 0 || archivedDialogs.indexOfKey(-chat.id) < 0) &&
((flags & MessagesController.DIALOG_FILTER_FLAG_EXCLUDE_MUTED) == 0 || mutedDialogs.indexOfKey(-chat.id) < 0 || dialogsWithMentions.indexOfKey(-chat.id) >= 0)) {
unreadCount++;
}
}

View File

@ -21,6 +21,7 @@ import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.os.Build;
import androidx.annotation.Keep;
import android.view.DisplayCutout;
import android.view.Gravity;
import android.view.MotionEvent;
@ -468,6 +469,8 @@ public class DrawerLayoutContainer extends FrameLayout {
}
}
inLayout = false;
} else {
AndroidUtilities.displaySize.y = heightSize - AndroidUtilities.statusBarHeight;
}
final boolean applyInsets = lastInsets != null && Build.VERSION.SDK_INT >= 21;

View File

@ -967,6 +967,7 @@ public abstract class TextSelectionHelper<Cell extends TextSelectionHelper.Selec
showMagnifier(lastX);
}
break;
case MotionEvent.ACTION_CANCEL:
case MotionEvent.ACTION_UP:
hideMagnifier();
movingHandle = false;

View File

@ -13745,6 +13745,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
}
}
}
chatListView.setItemAnimator(null);
}
updateBottomOverlay();
updateSecretStatus();

View File

@ -122,7 +122,7 @@ public class FiltersListBottomSheet extends BottomSheet implements NotificationC
@Override
protected void onDraw(Canvas canvas) {
int top = scrollOffsetY - backgroundPaddingTop - AndroidUtilities.dp(8);
int height = getMeasuredHeight() + AndroidUtilities.dp(28) + backgroundPaddingTop;
int height = getMeasuredHeight() + AndroidUtilities.dp(36) + backgroundPaddingTop;
int statusBarHeight = 0;
float radProgress = 1.0f;
if (Build.VERSION.SDK_INT >= 21) {
@ -360,7 +360,11 @@ public class FiltersListBottomSheet extends BottomSheet implements NotificationC
@Override
public int getItemCount() {
return dialogFilters.size() + 1;
int count = dialogFilters.size();
if (count < 10) {
count++;
}
return count;
}
@Override

View File

@ -156,6 +156,7 @@ public class VideoPlayer implements ExoPlayer.EventListener, SimpleExoPlayer.Vid
} else {
factory = new DefaultRenderersFactory(ApplicationLoader.applicationContext);
}
factory.setExtensionRendererMode(DefaultRenderersFactory.EXTENSION_RENDERER_MODE_PREFER);
player = ExoPlayerFactory.newSimpleInstance(ApplicationLoader.applicationContext, factory, trackSelector, loadControl, null);
player.addListener(this);

View File

@ -2045,7 +2045,7 @@ public class LaunchActivity extends Activity implements ActionBarLayout.ActionBa
boolean hideProgressDialog = true;
if (error == null && actionBarLayout != null) {
TLRPC.ChatInvite invite = (TLRPC.ChatInvite) response;
if (invite.chat != null && (!ChatObject.isLeftFromChat(invite.chat) || !invite.chat.kicked && !TextUtils.isEmpty(invite.chat.username))) {
if (invite.chat != null && (!ChatObject.isLeftFromChat(invite.chat) || !invite.chat.kicked && (!TextUtils.isEmpty(invite.chat.username) || BuildVars.DEBUG_PRIVATE_VERSION))) {
MessagesController.getInstance(intentAccount).putChat(invite.chat, false);
ArrayList<TLRPC.Chat> chats = new ArrayList<>();
chats.add(invite.chat);

View File

@ -1112,6 +1112,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
private float[] animAlphas = new float[3];
private float[] alphas = new float[3];
private float scale = 1.0f;
private boolean visible;
public PhotoProgressView(View parentView) {
if (decelerateInterpolator == null) {
@ -1201,12 +1202,16 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
} else {
previousBackgroundState = -2;
}
backgroundState = state;
onBackgroundStateUpdated(backgroundState = state);
parent.invalidate();
}
protected void onBackgroundStateUpdated(int state) {
}
public void setAlpha(float value) {
alphas[0] = animAlphas[0] = value;
checkVisibility();
}
public void setScale(float value) {
@ -1219,6 +1224,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
if (!animated) {
animAlphas[index] = alpha;
}
checkVisibility();
parent.invalidate();
}
}
@ -1227,6 +1233,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
for (int i = 0; i < alphas.length; i++) {
alphas[i] = animAlphas[i] = 1.0f;
}
checkVisibility();
}
private float calculateAlpha() {
@ -1241,13 +1248,25 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
return alpha;
}
public boolean isVisible() {
private void checkVisibility() {
boolean newVisible = true;
for (int i = 0; i < alphas.length; i++) {
if (alphas[i] != 1.0f) {
return false;
newVisible = false;
break;
}
}
return true;
if (newVisible != visible) {
visible = newVisible;
onVisibilityChanged(visible);
}
}
protected void onVisibilityChanged(boolean visible) {
}
public boolean isVisible() {
return visible;
}
public int getX() {
@ -2808,6 +2827,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
}
heightSize += AndroidUtilities.statusBarHeight;
}
AndroidUtilities.displaySize.y = heightSize - AndroidUtilities.statusBarHeight - insets.getStableInsetBottom();
heightSize -= insets.getSystemWindowInsetBottom();
} else {
if (heightSize > AndroidUtilities.displaySize.y) {
@ -3438,7 +3458,21 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
setCaptionHwLayerEnabled(true);
for (int a = 0; a < 3; a++) {
photoProgressViews[a] = new PhotoProgressView(containerView);
photoProgressViews[a] = new PhotoProgressView(containerView) {
@Override
protected void onBackgroundStateUpdated(int state) {
if (this == photoProgressViews[0]) {
updateAccessibilityOverlayVisibility();
}
}
@Override
protected void onVisibilityChanged(boolean visible) {
if (this == photoProgressViews[0]) {
updateAccessibilityOverlayVisibility();
}
}
};
photoProgressViews[a].setBackgroundState(PROGRESS_EMPTY, false);
}
@ -5212,7 +5246,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
if (!isPlaying) {
isPlaying = true;
photoProgressViews[0].setBackgroundState(isCurrentVideo ? PROGRESS_NONE : PROGRESS_PAUSE, false);
photoProgressViews[0].setIndexedAlpha(1, !isCurrentVideo && ((playerAutoStarted && !playerWasPlaying) || !isActionBarVisible) ? 0f : 1f, false);
photoProgressViews[0].setIndexedAlpha(1, !isCurrentVideo && !isAccessibilityEnabled() && ((playerAutoStarted && !playerWasPlaying) || !isActionBarVisible) ? 0f : 1f, false);
playerWasPlaying = true;
AndroidUtilities.runOnUIThread(updateProgressRunnable);
}
@ -5528,8 +5562,6 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
}
inPreview = preview;
updateAccessibilityOverlayVisibility();
}
private void createVideoTextureView(MediaController.SavedFilterState savedFilterState) {
@ -5580,7 +5612,6 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
}
videoPlayer.releasePlayer(true);
videoPlayer = null;
updateAccessibilityOverlayVisibility();
} else {
playerWasPlaying = false;
}
@ -7767,7 +7798,6 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
animateCaption = false;
}
isCurrentVideo = true;
updateAccessibilityOverlayVisibility();
boolean isMuted = false;
float start = 0.0f;
float end = 1.0f;
@ -7812,7 +7842,6 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
animateCaption = false;
}
isCurrentVideo = false;
updateAccessibilityOverlayVisibility();
compressItem.setVisibility(View.GONE);
if (isAnimation || sendPhotoType == SELECT_TYPE_QR || isDocumentsPicker) {
paintItem.setVisibility(View.GONE);
@ -8133,6 +8162,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
photoProgressViews[0] = photoProgressViews[2];
photoProgressViews[2] = tempProgress;
setIndexToImage(leftImage, currentIndex - 1);
updateAccessibilityOverlayVisibility();
checkProgress(1, true, false);
checkProgress(2, true, false);
@ -8146,6 +8176,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
photoProgressViews[0] = photoProgressViews[1];
photoProgressViews[1] = tempProgress;
setIndexToImage(rightImage, currentIndex + 1);
updateAccessibilityOverlayVisibility();
checkProgress(1, true, false);
checkProgress(2, true, false);
@ -9353,7 +9384,6 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
}
MediaController.getInstance().injectVideoPlayer(videoPlayer, currentMessageObject);
videoPlayer = null;
updateAccessibilityOverlayVisibility();
}
}
@ -11624,12 +11654,18 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
}
private void updateAccessibilityOverlayVisibility() {
if (playButtonAccessibilityOverlay == null)
return;
if (isCurrentVideo && (videoPlayer == null || !videoPlayer.isPlaying())) {
playButtonAccessibilityOverlay.setVisibility(View.VISIBLE);
} else {
playButtonAccessibilityOverlay.setVisibility(View.INVISIBLE);
if (playButtonAccessibilityOverlay != null) {
final int state = photoProgressViews[0].backgroundState;
if (photoProgressViews[0].isVisible() && (state == PROGRESS_PLAY || state == PROGRESS_PAUSE)) {
if (state == PROGRESS_PLAY) {
playButtonAccessibilityOverlay.setContentDescription(LocaleController.getString("AccActionPlay", R.string.AccActionPlay));
} else {
playButtonAccessibilityOverlay.setContentDescription(LocaleController.getString("AccActionPause", R.string.AccActionPause));
}
playButtonAccessibilityOverlay.setVisibility(View.VISIBLE);
} else {
playButtonAccessibilityOverlay.setVisibility(View.INVISIBLE);
}
}
}