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 tgVoipDexFileName = "libtgvoip.dex"
def tgVoipDexClasses = ["AudioRecordJNI", "AudioTrackJNI", "NativeTgVoipDelegate", "NativeTgVoipInstance", "TgVoipNativeLoader", "Resampler", "VLog"] 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 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 = 1985; public static int BUILD_VERSION = 1986;
public static String BUILD_VERSION_STRING = "6.2.0"; public static String BUILD_VERSION_STRING = "6.2.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

@ -2046,8 +2046,8 @@ public class MessagesStorage extends BaseController {
flag = MessagesController.DIALOG_FILTER_FLAG_GROUPS; flag = MessagesController.DIALOG_FILTER_FLAG_GROUPS;
} }
if ((flags & flag) != 0) { if ((flags & flag) != 0) {
if (((flags & MessagesController.DIALOG_FILTER_FLAG_EXCLUDE_ARCHIVED) == 0 || archivedDialogs.indexOfKey(-chat.id) < 0 || dialogsWithMentions.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)) { ((flags & MessagesController.DIALOG_FILTER_FLAG_EXCLUDE_MUTED) == 0 || mutedDialogs.indexOfKey(-chat.id) < 0 || dialogsWithMentions.indexOfKey(-chat.id) >= 0)) {
unreadCount--; unreadCount--;
} }
} }
@ -3537,15 +3537,23 @@ public class MessagesStorage extends BaseController {
public void resetMentionsCount(final long did, final int count) { public void resetMentionsCount(final long did, final int count) {
storageQueue.postRunnable(() -> { storageQueue.postRunnable(() -> {
try { try {
if (count == 0) { int prevUnreadCount = 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(); 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(); cursor.dispose();
LongSparseArray<Integer> sparseArray = new LongSparseArray<>(1); if (prevUnreadCount != 0 || count != 0) {
sparseArray.put(did, count); if (count == 0) {
getMessagesController().processDialogsUpdateRead(null, sparseArray); 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();
if (count == 0) { }
updateFiltersReadCounter(null, sparseArray, true); 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) { } catch (Exception e) {
FileLog.e(e); FileLog.e(e);
@ -3967,74 +3975,6 @@ public class MessagesStorage extends BaseController {
} }
} }
if (filter != null) { 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++) { for (int b = 0, N2 = filter.alwaysShow.size(); b < N2; b++) {
int did = filter.alwaysShow.get(b); int did = filter.alwaysShow.get(b);
if (did > 0) { if (did > 0) {
@ -4132,8 +4072,8 @@ public class MessagesStorage extends BaseController {
flag = MessagesController.DIALOG_FILTER_FLAG_GROUPS; flag = MessagesController.DIALOG_FILTER_FLAG_GROUPS;
} }
if ((flags & flag) != 0) { if ((flags & flag) != 0) {
if (((flags & MessagesController.DIALOG_FILTER_FLAG_EXCLUDE_ARCHIVED) == 0 || archivedDialogs.indexOfKey(-chat.id) < 0 || dialogsWithMentions.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)) { ((flags & MessagesController.DIALOG_FILTER_FLAG_EXCLUDE_MUTED) == 0 || mutedDialogs.indexOfKey(-chat.id) < 0 || dialogsWithMentions.indexOfKey(-chat.id) >= 0)) {
unreadCount++; unreadCount++;
} }
} }

View file

@ -21,6 +21,7 @@ import android.graphics.Rect;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.os.Build; import android.os.Build;
import androidx.annotation.Keep; import androidx.annotation.Keep;
import android.view.DisplayCutout; import android.view.DisplayCutout;
import android.view.Gravity; import android.view.Gravity;
import android.view.MotionEvent; import android.view.MotionEvent;
@ -468,6 +469,8 @@ public class DrawerLayoutContainer extends FrameLayout {
} }
} }
inLayout = false; inLayout = false;
} else {
AndroidUtilities.displaySize.y = heightSize - AndroidUtilities.statusBarHeight;
} }
final boolean applyInsets = lastInsets != null && Build.VERSION.SDK_INT >= 21; 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); showMagnifier(lastX);
} }
break; break;
case MotionEvent.ACTION_CANCEL:
case MotionEvent.ACTION_UP: case MotionEvent.ACTION_UP:
hideMagnifier(); hideMagnifier();
movingHandle = false; movingHandle = false;

View file

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

View file

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

View file

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

View file

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

View file

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