From 071d5114941a09618d2b323b427c1161a5aaa95b Mon Sep 17 00:00:00 2001 From: DrKLO Date: Thu, 13 Feb 2020 23:45:02 +0300 Subject: [PATCH] Update to 5.15.0 (1866) --- TMessagesProj/build.gradle | 2 +- .../jni/tgnet/ConnectionsManager.cpp | 1 + .../telegram/messenger/AndroidUtilities.java | 2 +- .../org/telegram/messenger/BuildVars.java | 2 +- .../messenger/MediaDataController.java | 4 ++- .../messenger/MessagesController.java | 6 ++-- .../messenger/NotificationCenter.java | 2 +- .../java/org/telegram/ui/ActionBar/Theme.java | 14 ++++++--- .../java/org/telegram/ui/ArticleViewer.java | 1 + .../telegram/ui/Cells/SharedAudioCell.java | 2 +- .../java/org/telegram/ui/ChatActivity.java | 29 +++++++++++++++++-- .../ui/Components/GestureDetector2.java | 2 +- .../org/telegram/ui/LocationActivity.java | 1 + .../org/telegram/ui/PeopleNearbyActivity.java | 8 +---- .../java/org/telegram/ui/ProfileActivity.java | 23 +++++++-------- 15 files changed, 63 insertions(+), 36 deletions(-) diff --git a/TMessagesProj/build.gradle b/TMessagesProj/build.gradle index d0519d455..b7f822ceb 100644 --- a/TMessagesProj/build.gradle +++ b/TMessagesProj/build.gradle @@ -283,7 +283,7 @@ android { } } - defaultConfig.versionCode = 1864 + defaultConfig.versionCode = 1866 applicationVariants.all { variant -> variant.outputs.all { output -> diff --git a/TMessagesProj/jni/tgnet/ConnectionsManager.cpp b/TMessagesProj/jni/tgnet/ConnectionsManager.cpp index cae167d4c..98ccf0b36 100644 --- a/TMessagesProj/jni/tgnet/ConnectionsManager.cpp +++ b/TMessagesProj/jni/tgnet/ConnectionsManager.cpp @@ -3345,6 +3345,7 @@ void ConnectionsManager::pauseNetwork() { } lastMonotonicPauseTime = lastPauseTime = getCurrentTimeMonotonicMillis(); lastSystemPauseTime = getCurrentTime(); + saveConfig(); } void ConnectionsManager::setNetworkAvailable(bool value, int32_t type, bool slow) { diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/AndroidUtilities.java b/TMessagesProj/src/main/java/org/telegram/messenger/AndroidUtilities.java index 6df984b08..ed14afc37 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/AndroidUtilities.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/AndroidUtilities.java @@ -1383,7 +1383,7 @@ public class AndroidUtilities { roundMessageInset = dp(2); } if (BuildVars.LOGS_ENABLED) { - FileLog.e("display size = " + displaySize.x + " " + displaySize.y + " " + displayMetrics.xdpi + "x" + displayMetrics.ydpi); + FileLog.e("density = " + density + " display size = " + displaySize.x + " " + displaySize.y + " " + displayMetrics.xdpi + "x" + displayMetrics.ydpi); } } catch (Exception e) { FileLog.e(e); diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/BuildVars.java b/TMessagesProj/src/main/java/org/telegram/messenger/BuildVars.java index f03846dd6..abe98a2d0 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/BuildVars.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/BuildVars.java @@ -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 = 1864; + public static int BUILD_VERSION = 1866; public static String BUILD_VERSION_STRING = "5.15.0"; public static int APP_ID = 4; public static String APP_HASH = "014b35b6184100b085b0d0572f9b5103"; diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/MediaDataController.java b/TMessagesProj/src/main/java/org/telegram/messenger/MediaDataController.java index ef7b00f05..85068d96b 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/MediaDataController.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/MediaDataController.java @@ -2019,6 +2019,8 @@ public class MediaDataController extends BaseController { return MEDIA_PHOTOVIDEO; } else if (MessageObject.isStickerMessage(message) || MessageObject.isAnimatedStickerMessage(message)) { return -1; + } else if (MessageObject.isNewGifMessage(message)) { + return -1; } else if (MessageObject.isMusicMessage(message)) { return MEDIA_MUSIC; } else { @@ -2051,7 +2053,7 @@ public class MediaDataController extends BaseController { } } } - return false; + return MediaDataController.getMediaType(message) != -1; } private void processLoadedMedia(final TLRPC.messages_Messages res, final long uid, int count, int max_id, final int type, final int fromCache, final int classGuid, final boolean isChannel, final boolean topReached) { diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/MessagesController.java b/TMessagesProj/src/main/java/org/telegram/messenger/MessagesController.java index 76f39eaca..e496fae66 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/MessagesController.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/MessagesController.java @@ -3213,7 +3213,7 @@ public class MessagesController extends BaseController implements NotificationCe } else { TLRPC.TL_messages_deleteHistory req = new TLRPC.TL_messages_deleteHistory(); req.peer = peer; - req.max_id = (onlyHistory == 0 ? Integer.MAX_VALUE : max_id_delete); + req.max_id = max_id_delete > 0 ? max_id_delete : Integer.MAX_VALUE; req.just_clear = onlyHistory != 0; req.revoke = revoke; final int max_id_delete_final = max_id_delete; @@ -3444,7 +3444,7 @@ public class MessagesController extends BaseController implements NotificationCe array.put(req.id.get(a1), (Integer) vector.objects.get(a1)); } getMessagesStorage().putChannelViews(channelViews, req.peer instanceof TLRPC.TL_inputPeerChannel); - AndroidUtilities.runOnUIThread(() -> getNotificationCenter().postNotificationName(NotificationCenter.didUpdatedMessagesViews, channelViews)); + AndroidUtilities.runOnUIThread(() -> getNotificationCenter().postNotificationName(NotificationCenter.didUpdateMessagesViews, channelViews)); } }); } @@ -10818,7 +10818,7 @@ public class MessagesController extends BaseController implements NotificationCe } } if (channelViewsFinal != null) { - getNotificationCenter().postNotificationName(NotificationCenter.didUpdatedMessagesViews, channelViewsFinal); + getNotificationCenter().postNotificationName(NotificationCenter.didUpdateMessagesViews, channelViewsFinal); } if (updateMask != 0) { getNotificationCenter().postNotificationName(NotificationCenter.updateInterfaces, updateMask); diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/NotificationCenter.java b/TMessagesProj/src/main/java/org/telegram/messenger/NotificationCenter.java index 34bb70f5c..259551576 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/NotificationCenter.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/NotificationCenter.java @@ -72,7 +72,7 @@ public class NotificationCenter { public static final int musicDidLoad = totalEvents++; public static final int needShowAlert = totalEvents++; public static final int needShowPlayServicesAlert = totalEvents++; - public static final int didUpdatedMessagesViews = totalEvents++; + public static final int didUpdateMessagesViews = totalEvents++; public static final int needReloadRecentDialogsSearch = totalEvents++; public static final int peerSettingsDidLoad = totalEvents++; public static final int wasUnableToFindCurrentLocation = totalEvents++; diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/Theme.java b/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/Theme.java index 7abe892e6..9aada41e7 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/Theme.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/Theme.java @@ -243,6 +243,7 @@ public class Theme { idx = 0; } int idx2 = isSelected ? 1 : 0; + boolean forceSetColor = false; if (currentBackgroundDrawableRadius[idx2][idx] != newRad) { currentBackgroundDrawableRadius[idx2][idx] = newRad; try { @@ -256,7 +257,7 @@ public class Theme { draw(canvas, shadowPaint); backgroundDrawable[idx2][idx] = new NinePatchDrawable(bitmap, getByteBuffer(bitmap.getWidth() / 2 - 1, bitmap.getWidth() / 2 + 1, bitmap.getHeight() / 2 - 1, bitmap.getHeight() / 2 + 1).array(), new Rect(), null); - backgroundDrawableColor[idx2][idx] = 0; + forceSetColor = true; setBounds(backupRect); } catch (Throwable ignore) { @@ -268,7 +269,7 @@ public class Theme { } else { color = getColor(isOut ? key_chat_outBubble : key_chat_inBubble); } - if (backgroundDrawable[idx2][idx] != null && backgroundDrawableColor[idx2][idx] != color) { + if (backgroundDrawable[idx2][idx] != null && (backgroundDrawableColor[idx2][idx] != color || forceSetColor)) { backgroundDrawable[idx2][idx].setColorFilter(new PorterDuffColorFilter(color, PorterDuff.Mode.MULTIPLY)); backgroundDrawableColor[idx2][idx] = color; } @@ -287,6 +288,7 @@ public class Theme { } else { idx = 0; } + boolean forceSetColor = false; if (currentShadowDrawableRadius[idx] != newRad) { currentShadowDrawableRadius[idx] = newRad; try { @@ -315,13 +317,13 @@ public class Theme { } shadowDrawable[idx] = new NinePatchDrawable(bitmap, getByteBuffer(bitmap.getWidth() / 2 - 1, bitmap.getWidth() / 2 + 1, bitmap.getHeight() / 2 - 1, bitmap.getHeight() / 2 + 1).array(), new Rect(), null); - shadowDrawableColor[idx] = 0; + forceSetColor = true; } catch (Throwable ignore) { } } int color = getColor(isOut ? key_chat_outBubbleShadow : key_chat_inBubbleShadow); - if (shadowDrawable[idx] != null && shadowDrawableColor[idx] != color) { + if (shadowDrawable[idx] != null && (shadowDrawableColor[idx] != color || forceSetColor)) { shadowDrawable[idx].setColorFilter(new PorterDuffColorFilter(color, PorterDuff.Mode.MULTIPLY)); shadowDrawableColor[idx] = color; } @@ -527,6 +529,10 @@ public class Theme { if (isOut) { selectedPaint.setAlpha((int) (Color.alpha(getColor(key_chat_outBubbleGradientSelectedOverlay)) * (alpha / 255.0f))); } + if (gradientShader == null) { + Drawable background = getBackgroundDrawable(); + background.setAlpha(alpha); + } } @Override diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ArticleViewer.java b/TMessagesProj/src/main/java/org/telegram/ui/ArticleViewer.java index 5b7d03e97..712374944 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ArticleViewer.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ArticleViewer.java @@ -3642,6 +3642,7 @@ public class ArticleViewer implements NotificationCenter.NotificationCenterDeleg progressView = new ContextProgressView(activity, 2); progressView.setVisibility(View.GONE); menuContainer.addView(progressView, LayoutHelper.createFrame(48, 56)); + menuButton.setOnClickListener(v -> menuButton.toggleSubMenu()); menuButton.setDelegate(id -> { if (currentPage == null || parentActivity == null) { return; diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Cells/SharedAudioCell.java b/TMessagesProj/src/main/java/org/telegram/ui/Cells/SharedAudioCell.java index e83365036..bfe4e672b 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/SharedAudioCell.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/SharedAudioCell.java @@ -450,7 +450,7 @@ public class SharedAudioCell extends FrameLayout implements DownloadController.F super.onInitializeAccessibilityNodeInfo(info); if (currentMessageObject.isMusic()) { info.setText(LocaleController.formatString("AccDescrMusicInfo", R.string.AccDescrMusicInfo, currentMessageObject.getMusicAuthor(), currentMessageObject.getMusicTitle())); - } else { // voice message + } else if (titleLayout != null && descriptionLayout != null) { info.setText(titleLayout.getText() + ", " + descriptionLayout.getText()); } if (checkBox.isChecked()) { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java index 3dc47aa57..a1c5c39ad 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java @@ -964,7 +964,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not getNotificationCenter().addObserver(this, NotificationCenter.botKeyboardDidLoad); getNotificationCenter().addObserver(this, NotificationCenter.chatSearchResultsAvailable); getNotificationCenter().addObserver(this, NotificationCenter.chatSearchResultsLoading); - getNotificationCenter().addObserver(this, NotificationCenter.didUpdatedMessagesViews); + getNotificationCenter().addObserver(this, NotificationCenter.didUpdateMessagesViews); getNotificationCenter().addObserver(this, NotificationCenter.pinnedMessageDidLoad); getNotificationCenter().addObserver(this, NotificationCenter.peerSettingsDidLoad); getNotificationCenter().addObserver(this, NotificationCenter.newDraftReceived); @@ -1153,7 +1153,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not getNotificationCenter().removeObserver(this, NotificationCenter.chatSearchResultsAvailable); getNotificationCenter().removeObserver(this, NotificationCenter.chatSearchResultsLoading); getNotificationCenter().removeObserver(this, NotificationCenter.messagePlayingPlayStateChanged); - getNotificationCenter().removeObserver(this, NotificationCenter.didUpdatedMessagesViews); + getNotificationCenter().removeObserver(this, NotificationCenter.didUpdateMessagesViews); getNotificationCenter().removeObserver(this, NotificationCenter.chatInfoCantLoad); getNotificationCenter().removeObserver(this, NotificationCenter.pinnedMessageDidLoad); getNotificationCenter().removeObserver(this, NotificationCenter.peerSettingsDidLoad); @@ -11564,11 +11564,12 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not messagesSearchAdapter.notifyDataSetChanged(); } } - } else if (id == NotificationCenter.didUpdatedMessagesViews) { + } else if (id == NotificationCenter.didUpdateMessagesViews) { SparseArray channelViews = (SparseArray) args[0]; SparseIntArray array = channelViews.get((int) dialog_id); if (array != null) { boolean updated = false; + LongSparseArray newGroups = null; for (int a = 0; a < array.size(); a++) { int messageId = array.keyAt(a); MessageObject messageObject = messagesDict[0].get(messageId); @@ -11576,11 +11577,33 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not int newValue = array.get(messageId); if (newValue > messageObject.messageOwner.views) { messageObject.messageOwner.views = newValue; + if (messageObject.hasValidGroupId()) { + MessageObject.GroupedMessages groupedMessages = groupedMessagesMap.get(messageObject.getGroupId()); + if (groupedMessages != null) { + if (newGroups == null) { + newGroups = new LongSparseArray<>(); + } + newGroups.put(groupedMessages.groupId, groupedMessages); + } + } updated = true; } } } if (updated) { + if (newGroups != null) { + for (int b = 0; b < newGroups.size(); b++) { + MessageObject.GroupedMessages groupedMessages = newGroups.valueAt(b); + MessageObject messageObject = groupedMessages.messages.get(groupedMessages.messages.size() - 1); + int index = messages.indexOf(messageObject); + if (index >= 0) { + if (chatAdapter != null) { + chatAdapter.notifyItemRangeChanged(index + chatAdapter.messagesStartRow, groupedMessages.messages.size()); + } + } + } + } + updateVisibleRows(); } } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/GestureDetector2.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/GestureDetector2.java index 18bad2c81..6af89c1be 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/GestureDetector2.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/GestureDetector2.java @@ -145,7 +145,7 @@ public class GestureDetector2 { private static final int LONGPRESS_TIMEOUT = ViewConfiguration.getLongPressTimeout(); private static final int TAP_TIMEOUT = ViewConfiguration.getTapTimeout(); - private static final int DOUBLE_TAP_TIMEOUT = 150; + private static final int DOUBLE_TAP_TIMEOUT = 200; private static final int DOUBLE_TAP_MIN_TIME = 40; private static final int SHOW_PRESS = 1; diff --git a/TMessagesProj/src/main/java/org/telegram/ui/LocationActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/LocationActivity.java index 0cbf4f34f..12cdc7947 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/LocationActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/LocationActivity.java @@ -709,6 +709,7 @@ public class LocationActivity extends BaseFragment implements NotificationCenter mapTypeButton.setBackgroundDrawable(drawable); mapTypeButton.setIcon(R.drawable.location_type); mapViewClip.addView(mapTypeButton, LayoutHelper.createFrame(Build.VERSION.SDK_INT >= 21 ? 40 : 44, Build.VERSION.SDK_INT >= 21 ? 40 : 44, Gravity.RIGHT | Gravity.TOP, 0, 12, 12, 0)); + mapTypeButton.setOnClickListener(v -> mapTypeButton.toggleSubMenu()); mapTypeButton.setDelegate(id -> { if (googleMap == null) { return; diff --git a/TMessagesProj/src/main/java/org/telegram/ui/PeopleNearbyActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/PeopleNearbyActivity.java index e018048b4..e6a3624cc 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/PeopleNearbyActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/PeopleNearbyActivity.java @@ -524,7 +524,6 @@ public class PeopleNearbyActivity extends BaseFragment implements NotificationCe getMessagesController().putChats(updates.chats, false); users.clear(); chats.clear(); - boolean hasSelf = false; UserConfig userConfig = getUserConfig(); boolean saveConfig = false; if (userConfig.sharingMyLocationUntil != 0) { @@ -545,7 +544,6 @@ public class PeopleNearbyActivity extends BaseFragment implements NotificationCe chats.add(peerLocated); } } else if (object instanceof TLRPC.TL_peerSelfLocated) { - hasSelf = true; TLRPC.TL_peerSelfLocated peerSelfLocated = (TLRPC.TL_peerSelfLocated) object; if (userConfig.sharingMyLocationUntil != peerSelfLocated.expires) { userConfig.sharingMyLocationUntil = peerSelfLocated.expires; @@ -555,10 +553,6 @@ public class PeopleNearbyActivity extends BaseFragment implements NotificationCe } } } - if (!hasSelf && userConfig.sharingMyLocationUntil != 0) { - userConfig.sharingMyLocationUntil = 0; - saveConfig = true; - } if (saveConfig) { userConfig.saveConfig(false); } @@ -893,7 +887,7 @@ public class PeopleNearbyActivity extends BaseFragment implements NotificationCe actionCell.setText(LocaleController.getString("NearbyCreateGroup", R.string.NearbyCreateGroup), null, R.drawable.groups_create, chatsStartRow != -1); } else if (position == showMeRow) { if (showingMe = (getUserConfig().sharingMyLocationUntil > getConnectionsManager().getCurrentTime())) { - actionCell.setText(LocaleController.getString("StopShowingMe", R.string.StopShowingMe), null, R.drawable.actions_nearby_off, chatsStartRow != -1); + actionCell.setText(LocaleController.getString("StopShowingMe", R.string.StopShowingMe), null, R.drawable.actions_nearby_off, usersStartRow != -1); actionCell.setColors(Theme.key_windowBackgroundWhiteRedText5, Theme.key_windowBackgroundWhiteRedText5); } else { actionCell.setText(LocaleController.getString("MakeMyselfVisible", R.string.MakeMyselfVisible), null, R.drawable.actions_nearby_on, usersStartRow != -1); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ProfileActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ProfileActivity.java index 3140aeaec..f4fd6edc5 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ProfileActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ProfileActivity.java @@ -1050,7 +1050,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter. Theme.createProfileResources(context); hasOwnBackground = true; - extraHeight = AndroidUtilities.dpf2(88f); + extraHeight = AndroidUtilities.dp(88f); actionBar.setActionBarMenuOnItemClick(new ActionBar.ActionBarMenuOnItemClick() { @Override public void onItemClick(final int id) { @@ -2001,7 +2001,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter. avatarImage.setTranslationY(AndroidUtilities.lerp((float) Math.ceil(avatarY), 0f, value)); avatarImage.setRoundRadius((int) AndroidUtilities.lerp(AndroidUtilities.dpf2(21f), 0f, value)); - if (extraHeight > AndroidUtilities.dpf2(88f) && expandProgress < 0.33f) { + if (extraHeight > AndroidUtilities.dp(88f) && expandProgress < 0.33f) { refreshNameAndOnlineXY(); } @@ -2047,13 +2047,13 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter. statusColor = Theme.getColor(Theme.key_avatar_subtitleInProfileBlue); } onlineTextView[1].setTextColor(ColorUtils.blendARGB(statusColor, Color.argb(179, 255, 255, 255), value)); - if (extraHeight > AndroidUtilities.dpf2(88f)) { + if (extraHeight > AndroidUtilities.dp(88f)) { nameTextView[1].setPivotY(AndroidUtilities.lerp(0, nameTextView[1].getMeasuredHeight(), value)); nameTextView[1].setScaleX(AndroidUtilities.lerp(1.12f, 1.67f, value)); nameTextView[1].setScaleY(AndroidUtilities.lerp(1.12f, 1.67f, value)); } - needLayoutText(Math.min(1f, extraHeight / AndroidUtilities.dpf2(88f))); + needLayoutText(Math.min(1f, extraHeight / AndroidUtilities.dp(88f))); nameTextView[1].setTextColor(ColorUtils.blendARGB(Theme.getColor(Theme.key_profile_title), Color.WHITE, value)); actionBar.setItemsColor(ColorUtils.blendARGB(Theme.getColor(Theme.key_actionBarDefaultIcon), Color.WHITE, value), false); @@ -2677,7 +2677,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter. } if (avatarImage != null) { - final float diff = Math.min(1f, extraHeight / AndroidUtilities.dpf2(88f)); + final float diff = Math.min(1f, extraHeight / AndroidUtilities.dp(88f)); listView.setTopGlowOffset((int) extraHeight); @@ -2734,8 +2734,8 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter. avatarY = (actionBar.getOccupyStatusBar() ? AndroidUtilities.statusBarHeight : 0) + ActionBar.getCurrentActionBarHeight() / 2.0f * (1.0f + diff) - 21 * AndroidUtilities.density + 27 * AndroidUtilities.density * diff + actionBar.getTranslationY(); float h = openAnimationInProgress ? initialAnimationExtraHeight : extraHeight; - if (h > AndroidUtilities.dpf2(88f) || isPulledDown) { - expandProgress = Math.max(0f, Math.min(1f, (h - AndroidUtilities.dpf2(88f)) / (listView.getMeasuredWidth() - newTop - AndroidUtilities.dpf2(88f)))); + if (h > AndroidUtilities.dp(88f) || isPulledDown) { + expandProgress = Math.max(0f, Math.min(1f, (h - AndroidUtilities.dp(88f)) / (listView.getMeasuredWidth() - newTop - AndroidUtilities.dp(88f)))); avatarScale = AndroidUtilities.lerp((42f + 18f) / 42f, (42f + 42f + 18f) / 42f, Math.min(1f, expandProgress * 3f)); final float durationFactor = Math.min(AndroidUtilities.dpf2(2000f), Math.max(AndroidUtilities.dpf2(1100f), Math.abs(listViewVelocityY))) / AndroidUtilities.dpf2(1100f); @@ -2869,11 +2869,10 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter. } final FrameLayout.LayoutParams params = (FrameLayout.LayoutParams) avatarImage.getLayoutParams(); - //params.width = params.height = (int) AndroidUtilities.lerp(AndroidUtilities.dpf2(42f), listView.getMeasuredWidth() / avatarScale, animationProgress); params.width = params.height = (int) AndroidUtilities.lerp(AndroidUtilities.dpf2(42f), (extraHeight + newTop) / avatarScale, animationProgress); params.leftMargin = (int) AndroidUtilities.lerp(AndroidUtilities.dpf2(64f), 0f, animationProgress); avatarImage.requestLayout(); - } else if (extraHeight <= AndroidUtilities.dpf2(88f)) { + } else if (extraHeight <= AndroidUtilities.dp(88f)) { avatarScale = (42 + 18 * diff) / 42.0f; float nameScale = 1.0f + 0.12f * diff; if (expandAnimator == null || !expandAnimator.isRunning()) { @@ -2933,7 +2932,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter. private void needLayoutText(float diff) { FrameLayout.LayoutParams layoutParams; float scale = nameTextView[1].getScaleX(); - float maxScale = extraHeight > AndroidUtilities.dpf2(88f) ? 1.67f : 1.12f; + float maxScale = extraHeight > AndroidUtilities.dp(88f) ? 1.67f : 1.12f; if (extraHeight > AndroidUtilities.dp(88f) && scale != maxScale) { return; @@ -3333,7 +3332,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter. bD = (int) ((Color.blue(color) - b) * progress); aD = (int) ((Color.alpha(color) - a) * progress); for (int i = 0; i < 2; i++) { - if (nameTextView[i] == null) { + if (nameTextView[i] == null || i == 1 && playProfileAnimation == 2) { continue; } nameTextView[i].setTextColor(Color.argb(a + aD, r + rD, g + gD, b + bD)); @@ -3400,7 +3399,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter. } nameTextView[1].setLayoutParams(layoutParams); - initialAnimationExtraHeight = AndroidUtilities.dpf2(88f); + initialAnimationExtraHeight = AndroidUtilities.dp(88f); } else { layoutParams = (FrameLayout.LayoutParams) nameTextView[1].getLayoutParams(); layoutParams.width = (int) ((AndroidUtilities.displaySize.x - AndroidUtilities.dp(32)) / 1.67f);