Merge remote-tracking branch 'telegram/master'

This commit is contained in:
NekoInverter 2020-06-05 22:35:30 +08:00
commit a15a4f6961
No known key found for this signature in database
GPG Key ID: 280D6CCCF95715F9
10 changed files with 89 additions and 103 deletions

View File

@ -286,7 +286,7 @@ android {
}
}
defaultConfig.versionCode = 10 * 1985
defaultConfig.versionCode = 10 * 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 = 336779;
public static String APP_HASH = "b91eefacc86747c068c8d8a16b41500d";

View File

@ -2052,8 +2052,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--;
}
}
@ -3553,15 +3553,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);
@ -3983,74 +3991,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) {
@ -4148,8 +4088,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

@ -969,6 +969,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

@ -13862,6 +13862,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

@ -2118,7 +2118,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

@ -1117,6 +1117,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) {
@ -1206,12 +1207,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) {
@ -1224,6 +1229,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
if (!animated) {
animAlphas[index] = alpha;
}
checkVisibility();
parent.invalidate();
}
}
@ -1232,6 +1238,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() {
@ -1246,13 +1253,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() {
@ -2813,6 +2832,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) {
@ -3496,7 +3516,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);
}
@ -5270,7 +5304,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);
}
@ -5586,8 +5620,6 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
}
inPreview = preview;
updateAccessibilityOverlayVisibility();
}
private void createVideoTextureView(MediaController.SavedFilterState savedFilterState) {
@ -5638,7 +5670,6 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
}
videoPlayer.releasePlayer(true);
videoPlayer = null;
updateAccessibilityOverlayVisibility();
} else {
playerWasPlaying = false;
}
@ -7854,7 +7885,6 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
animateCaption = false;
}
isCurrentVideo = true;
updateAccessibilityOverlayVisibility();
boolean isMuted = false;
float start = 0.0f;
float end = 1.0f;
@ -7899,7 +7929,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);
@ -8220,6 +8249,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);
@ -8233,6 +8263,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);
@ -9440,7 +9471,6 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
}
MediaController.getInstance().injectVideoPlayer(videoPlayer, currentMessageObject);
videoPlayer = null;
updateAccessibilityOverlayVisibility();
}
}
@ -11711,12 +11741,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);
}
}
}