Merge remote-tracking branch 'telegram/master'

This commit is contained in:
NekoInverter 2020-02-14 10:45:28 +08:00
commit f6edf0e9fa
No known key found for this signature in database
GPG Key ID: 280D6CCCF95715F9
13 changed files with 276 additions and 226 deletions

View File

@ -302,7 +302,7 @@ android {
}
}
defaultConfig.versionCode = 10 * 1866
defaultConfig.versionCode = 10 * 1867
applicationVariants.all { variant ->
variant.outputs.all { output ->

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 = 1866;
public static int BUILD_VERSION = 1867;
public static String BUILD_VERSION_STRING = "5.15.0";
public static int APP_ID = 336779; //obtain your own APP_ID at https://core.telegram.org/api/obtaining_api_id
public static String APP_HASH = "b91eefacc86747c068c8d8a16b41500d"; //obtain your own APP_HASH at https://core.telegram.org/api/obtaining_api_id

View File

@ -7423,7 +7423,7 @@ public class Theme {
File wallpaperFile;
boolean wallpaperMotion;
ThemeAccent accent = currentTheme.getAccent(false);
if (accent != null && previousTheme == null) {
if (accent != null && !hasPreviousTheme) {
wallpaperFile = accent.getPathToWallpaper();
wallpaperMotion = accent.patternMotion;
} else {

View File

@ -3670,10 +3670,8 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
drawName = true;
drawForwardedName = true;
drawPhotoImage = false;
int maxWidth = availableTimeWidth = Math.min(AndroidUtilities.dp(500), messageObject.getMaxMessageTextWidth());
int maxWidth = Math.min(AndroidUtilities.dp(500), messageObject.getMaxMessageTextWidth());
backgroundWidth = maxWidth + AndroidUtilities.dp(31);
availableTimeWidth = AndroidUtilities.dp(120);
measureTime(messageObject);
TLRPC.TL_messageMediaPoll media = (TLRPC.TL_messageMediaPoll) messageObject.messageOwner.media;
@ -3718,7 +3716,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
docTitleOffsetX = 0;
}
}
int w = maxWidth - timeWidth - AndroidUtilities.dp(messageObject.isOutOwner() ? 28 : 8);
int w = maxWidth - AndroidUtilities.dp(messageObject.isOutOwner() ? 28 : 8);
TextPaint textPaint = !media.poll.public_voters && !media.poll.multiple_choice ? Theme.chat_livePaint : Theme.chat_locationAddressPaint;
CharSequence votes;
@ -3731,10 +3729,13 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
if (infoLayout != null) {
if (!media.poll.public_voters && !media.poll.multiple_choice) {
infoX = (int) Math.ceil(infoLayout.getLineCount() > 0 ? -infoLayout.getLineLeft(0) : 0);
availableTimeWidth = (int) (maxWidth - infoLayout.getLineWidth(0) - AndroidUtilities.dp(16));
} else {
infoX = (int) ((backgroundWidth - AndroidUtilities.dp(28) - Math.ceil(infoLayout.getLineWidth(0))) / 2 - infoLayout.getLineLeft(0));
availableTimeWidth = maxWidth;
}
}
measureTime(messageObject);
lastPoll = media.poll;
lastPollResults = media.results.results;
@ -3997,9 +3998,11 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
backgroundWidth = maxTextWidth;
maxWidth = maxTextWidth - AndroidUtilities.dp(31);
}
availableTimeWidth = maxWidth;
if (drawPhotoImage) {
photoWidth = AndroidUtilities.dp(86);
photoHeight = AndroidUtilities.dp(86);
availableTimeWidth -= photoWidth;
} else {
photoWidth = AndroidUtilities.dp(56);
photoHeight = AndroidUtilities.dp(56);
@ -4007,7 +4010,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
photoHeight += (docTitleLayout.getLineCount() - 1) * AndroidUtilities.dp(16);
}
}
availableTimeWidth = maxWidth;
if (!drawPhotoImage && TextUtils.isEmpty(messageObject.caption) && infoLayout != null) {
int lineCount = infoLayout.getLineCount();
measureTime(messageObject);
@ -7832,8 +7835,12 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
viewsTextWidth = (int) Math.ceil(Theme.chat_timePaint.measureText(currentViewsString));
timeWidth += viewsTextWidth + Theme.chat_msgInViewsDrawable.getIntrinsicWidth() + AndroidUtilities.dp(10);
}
if (messageObject.scheduled && messageObject.isSendError()) {
timeWidth += AndroidUtilities.dp(18);
if (messageObject.scheduled) {
if (messageObject.isSendError()) {
timeWidth += AndroidUtilities.dp(18);
} else if (messageObject.isSending() && messageObject.messageOwner.to_id.channel_id != 0 && !messageObject.isMegagroup()) {
timeWidth += AndroidUtilities.dp(18);
}
}
if (signString != null) {
if (availableTimeWidth == 0) {

View File

@ -406,7 +406,6 @@ public class AdminLogFilterAlert extends BottomSheet {
switch (viewType) {
case 0:
view = new CheckBoxCell(context, 1, 21);
view.setBackgroundDrawable(Theme.getSelectorDrawable(false));
break;
case 1:
ShadowSectionCell shadowSectionCell = new ShadowSectionCell(context, 18);

View File

@ -24,6 +24,7 @@ import org.telegram.messenger.LocaleController;
import org.telegram.messenger.MessagesController;
import org.telegram.messenger.NotificationCenter;
import org.telegram.messenger.R;
import org.telegram.messenger.SharedConfig;
import org.telegram.ui.ActionBar.AlertDialog;
import org.telegram.ui.ActionBar.BaseFragment;
import org.telegram.ui.ActionBar.Theme;
@ -104,7 +105,9 @@ public class EditTextEmoji extends FrameLayout implements NotificationCenter.Not
@Override
public boolean requestRectangleOnScreen(Rect rectangle) {
rectangle.bottom += AndroidUtilities.dp(1000);
if (SharedConfig.smoothKeyboard) {
rectangle.bottom += AndroidUtilities.dp(1000);
}
return super.requestRectangleOnScreen(rectangle);
}
};

View File

@ -34,6 +34,9 @@ public class GestureDetector2 {
boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY);
void onLongPress(MotionEvent e);
boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY);
default int getDoubleTapTimeout(MotionEvent e) {
return DOUBLE_TAP_TIMEOUT;
}
}
/**
@ -145,7 +148,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 = 200;
public static final int DOUBLE_TAP_TIMEOUT = ViewConfiguration.getDoubleTapTimeout();
private static final int DOUBLE_TAP_MIN_TIME = 40;
private static final int SHOW_PRESS = 1;
@ -364,7 +367,7 @@ public class GestureDetector2 {
handled |= mDoubleTapListener.onDoubleTapEvent(ev);
} else {
// This is a first tap
mHandler.sendEmptyMessageDelayed(TAP, DOUBLE_TAP_TIMEOUT);
mHandler.sendEmptyMessageDelayed(TAP, mListener.getDoubleTapTimeout(ev));
}
}
@ -531,7 +534,7 @@ public class GestureDetector2 {
}
final long deltaTime = secondDown.getEventTime() - firstUp.getEventTime();
if (deltaTime > DOUBLE_TAP_TIMEOUT || deltaTime < DOUBLE_TAP_MIN_TIME) {
if (deltaTime > mListener.getDoubleTapTimeout(firstDown) || deltaTime < DOUBLE_TAP_MIN_TIME) {
return false;
}

View File

@ -1484,7 +1484,7 @@ public class SharedMediaLayout extends FrameLayout implements NotificationCenter
@Override
public boolean onTouchEvent(MotionEvent ev) {
if (!profileActivity.getParentLayout().checkTransitionAnimation() && !checkTabsAnimationInProgress()) {
if (profileActivity.getParentLayout() != null && !profileActivity.getParentLayout().checkTransitionAnimation() && !checkTabsAnimationInProgress()) {
if (ev != null && ev.getAction() == MotionEvent.ACTION_DOWN && !startedTracking && !maybeStartTracking && ev.getY() >= AndroidUtilities.dp(48)) {
startedTrackingPointerId = ev.getPointerId(0);
maybeStartTracking = true;

View File

@ -268,14 +268,16 @@ public class PeopleNearbyActivity extends BaseFragment implements NotificationCe
return;
}
if (position >= usersStartRow && position < usersEndRow) {
ManageChatUserCell cell = (ManageChatUserCell) view;
TLRPC.TL_peerLocated peerLocated = users.get(position - usersStartRow);
Bundle args1 = new Bundle();
args1.putInt("user_id", peerLocated.peer.user_id);
if (cell.hasAvatarSet()) {
args1.putBoolean("expandPhoto", true);
if (view instanceof ManageChatUserCell) {
ManageChatUserCell cell = (ManageChatUserCell) view;
TLRPC.TL_peerLocated peerLocated = users.get(position - usersStartRow);
Bundle args1 = new Bundle();
args1.putInt("user_id", peerLocated.peer.user_id);
if (cell.hasAvatarSet()) {
args1.putBoolean("expandPhoto", true);
}
presentFragment(new ProfileActivity(args1));
}
presentFragment(new ProfileActivity(args1));
} else if (position >= chatsStartRow && position < chatsEndRow) {
TLRPC.TL_peerLocated peerLocated = chats.get(position - chatsStartRow);
Bundle args1 = new Bundle();

View File

@ -8822,7 +8822,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
@Override
public boolean onDown(MotionEvent e) {
if (checkImageView.getVisibility() != View.VISIBLE && !drawPressedDrawable[0] && !drawPressedDrawable[1]) {
if (!doubleTap && checkImageView.getVisibility() != View.VISIBLE && !drawPressedDrawable[0] && !drawPressedDrawable[1]) {
float x = e.getX();
int side = containerView.getMeasuredWidth() / 5;
if (x < side) {
@ -8840,6 +8840,18 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
return false;
}
@Override
public int getDoubleTapTimeout(MotionEvent e) {
if (checkImageView.getVisibility() != View.VISIBLE && !drawPressedDrawable[0] && !drawPressedDrawable[1]) {
float x = e.getX();
int side = containerView.getMeasuredWidth() / 5;
if (x < side || x > containerView.getMeasuredWidth() - side) {
return 200;
}
}
return GestureDetector2.DOUBLE_TAP_TIMEOUT;
}
private void hidePressedDrawables() {
drawPressedDrawable[0] = drawPressedDrawable[1] = false;
containerView.invalidate();
@ -9007,6 +9019,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
animateTo(1.0f, 0, 0, true);
}
doubleTap = true;
hidePressedDrawables();
return true;
}

View File

@ -895,6 +895,9 @@ public class PollCreateActivity extends BaseFragment {
String from = answers[idx1];
answers[idx1] = answers[idx2];
answers[idx2] = from;
boolean temp = answersChecks[idx1];
answersChecks[idx1] = answersChecks[idx2];
answersChecks[idx2] = temp;
notifyItemMoved(fromIndex, toIndex);
}
}

View File

@ -1409,6 +1409,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
if (expandPhoto) {
nameTextView[1].setTextColor(Color.WHITE);
onlineTextView[1].setTextColor(Color.argb(179, 255, 255, 255));
idTextView.setTextColor(Color.argb(179, 255, 255, 255));
actionBar.setItemsBackgroundColor(Theme.ACTION_BAR_WHITE_SELECTOR_COLOR, false);
overlaysView.setOverlaysVisible();
overlaysView.setAlphaValue(1.0f, false);
@ -1854,12 +1855,14 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
openingAvatar = true;
allowPullingDown = true;
View child = listView.getChildAt(0);
RecyclerView.ViewHolder holder = listView.findContainingViewHolder(child);
if (holder != null) {
Integer offset = positionToOffset.get(holder.getAdapterPosition());
if (offset != null) {
listView.smoothScrollBy(0, -(offset + (listView.getPaddingTop() - child.getTop() - actionBar.getMeasuredHeight())), CubicBezierInterpolator.EASE_OUT_QUINT);
return;
if (child != null) {
RecyclerView.ViewHolder holder = listView.findContainingViewHolder(child);
if (holder != null) {
Integer offset = positionToOffset.get(holder.getAdapterPosition());
if (offset != null) {
listView.smoothScrollBy(0, -(offset + (listView.getPaddingTop() - child.getTop() - actionBar.getMeasuredHeight())), CubicBezierInterpolator.EASE_OUT_QUINT);
return;
}
}
}
}
@ -2061,12 +2064,21 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
final float onlineTextViewX = (1 - value) * (1 - value) * onlineX + 2 * (1 - value) * value * onlineTextViewCx + value * value * onlineTextViewXEnd;
final float onlineTextViewY = (1 - value) * (1 - value) * onlineY + 2 * (1 - value) * value * onlineTextViewCy + value * value * onlineTextViewYEnd;
final float idTextViewXEnd = AndroidUtilities.dpf2(16f) - idTextView.getLeft();
final float idTextViewYEnd = newTop + extraHeight - AndroidUtilities.dpf2(3f) - idTextView.getBottom();
final float idTextViewCx = k + idX + (idTextViewXEnd - idX) / 2f;
final float idTextViewCy = k + idY + (idTextViewYEnd - idY) / 2f;
final float idTextViewX = (1 - value) * (1 - value) * idX + 2 * (1 - value) * value * idTextViewCx + value * value * idTextViewXEnd;
final float idTextViewY = (1 - value) * (1 - value) * idY + 2 * (1 - value) * value * idTextViewCy + value * value * idTextViewYEnd;
nameTextView[1].setTranslationX(nameTextViewX);
nameTextView[1].setTranslationY(nameTextViewY);
onlineTextView[1].setTranslationX(onlineTextViewX);
onlineTextView[1].setTranslationY(onlineTextViewY);
onlineTextView[2].setTranslationX(onlineTextViewX);
onlineTextView[2].setTranslationY(onlineTextViewY);
idTextView.setTranslationX(idTextViewX);
idTextView.setTranslationY(idTextViewY);
final Object onlineTextViewTag = onlineTextView[1].getTag();
int statusColor;
if (onlineTextViewTag instanceof String) {
@ -2075,6 +2087,7 @@ 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));
idTextView.setTextColor(ColorUtils.blendARGB(Theme.getColor(Theme.key_avatar_subtitleInProfileBlue), Color.argb(179, 255, 255, 255), value));
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));
@ -2816,7 +2829,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
onlineTextView[2].setTranslationX(onlineTextView[1].getTranslationX());
onlineTextView[2].setTranslationY(onlineTextView[1].getTranslationY());
idTextView.setTranslationX(AndroidUtilities.dpf2(16f) - onlineTextView[1].getLeft());
idTextView.setTranslationY(newTop + extraHeight - AndroidUtilities.dpf2(4) - idTextView.getBottom());
idTextView.setTranslationY(newTop + h - AndroidUtilities.dpf2(3f) - idTextView.getBottom() + additionalTranslationY);
}
} else {
if (isPulledDown) {
@ -3214,7 +3227,11 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
}
updateRowsIds();
if (listAdapter != null) {
listAdapter.notifyDataSetChanged();
try {
listAdapter.notifyDataSetChanged();
} catch (Exception e) {
FileLog.e(e);
}
}
sharedMediaLayout.setCommonGroupsCount(userInfo.common_chats_count);
updateSelectedMediaTabText();
@ -3493,6 +3510,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
avatarColor = AndroidUtilities.calcBitmapColor(avatarImage.getImageReceiver().getBitmap());
nameTextView[1].setTextColor(Color.WHITE);
onlineTextView[1].setTextColor(Color.argb(179, 255, 255, 255));
idTextView.setTextColor(Color.argb(179, 255, 255, 255));
actionBar.setItemsBackgroundColor(Theme.ACTION_BAR_WHITE_SELECTOR_COLOR, false);
overlaysView.setOverlaysVisible();
}
@ -4168,6 +4186,9 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
}
private void createActionBarMenu() {
if (actionBar == null || otherItem == null) {
return;
}
ActionBarMenu menu = actionBar.createMenu();
otherItem.removeAllSubItems();
animatingItem = null;