Update to 5.15.0 (1867)

This commit is contained in:
DrKLO 2020-02-14 05:26:25 +03:00
parent 071d511494
commit 08a8e007eb
13 changed files with 263 additions and 225 deletions

View file

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

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 = 1866; public static int BUILD_VERSION = 1867;
public static String BUILD_VERSION_STRING = "5.15.0"; public static String BUILD_VERSION_STRING = "5.15.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

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

View file

@ -3632,10 +3632,8 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
drawName = true; drawName = true;
drawForwardedName = true; drawForwardedName = true;
drawPhotoImage = false; 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); backgroundWidth = maxWidth + AndroidUtilities.dp(31);
availableTimeWidth = AndroidUtilities.dp(120);
measureTime(messageObject);
TLRPC.TL_messageMediaPoll media = (TLRPC.TL_messageMediaPoll) messageObject.messageOwner.media; TLRPC.TL_messageMediaPoll media = (TLRPC.TL_messageMediaPoll) messageObject.messageOwner.media;
@ -3680,7 +3678,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
docTitleOffsetX = 0; 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; TextPaint textPaint = !media.poll.public_voters && !media.poll.multiple_choice ? Theme.chat_livePaint : Theme.chat_locationAddressPaint;
CharSequence votes; CharSequence votes;
@ -3693,10 +3691,13 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
if (infoLayout != null) { if (infoLayout != null) {
if (!media.poll.public_voters && !media.poll.multiple_choice) { if (!media.poll.public_voters && !media.poll.multiple_choice) {
infoX = (int) Math.ceil(infoLayout.getLineCount() > 0 ? -infoLayout.getLineLeft(0) : 0); infoX = (int) Math.ceil(infoLayout.getLineCount() > 0 ? -infoLayout.getLineLeft(0) : 0);
availableTimeWidth = (int) (maxWidth - infoLayout.getLineWidth(0) - AndroidUtilities.dp(16));
} else { } else {
infoX = (int) ((backgroundWidth - AndroidUtilities.dp(28) - Math.ceil(infoLayout.getLineWidth(0))) / 2 - infoLayout.getLineLeft(0)); infoX = (int) ((backgroundWidth - AndroidUtilities.dp(28) - Math.ceil(infoLayout.getLineWidth(0))) / 2 - infoLayout.getLineLeft(0));
availableTimeWidth = maxWidth;
} }
} }
measureTime(messageObject);
lastPoll = media.poll; lastPoll = media.poll;
lastPollResults = media.results.results; lastPollResults = media.results.results;
@ -3958,9 +3959,11 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
backgroundWidth = maxTextWidth; backgroundWidth = maxTextWidth;
maxWidth = maxTextWidth - AndroidUtilities.dp(31); maxWidth = maxTextWidth - AndroidUtilities.dp(31);
} }
availableTimeWidth = maxWidth;
if (drawPhotoImage) { if (drawPhotoImage) {
photoWidth = AndroidUtilities.dp(86); photoWidth = AndroidUtilities.dp(86);
photoHeight = AndroidUtilities.dp(86); photoHeight = AndroidUtilities.dp(86);
availableTimeWidth -= photoWidth;
} else { } else {
photoWidth = AndroidUtilities.dp(56); photoWidth = AndroidUtilities.dp(56);
photoHeight = AndroidUtilities.dp(56); photoHeight = AndroidUtilities.dp(56);
@ -3968,7 +3971,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
photoHeight += (docTitleLayout.getLineCount() - 1) * AndroidUtilities.dp(16); photoHeight += (docTitleLayout.getLineCount() - 1) * AndroidUtilities.dp(16);
} }
} }
availableTimeWidth = maxWidth;
if (!drawPhotoImage && TextUtils.isEmpty(messageObject.caption) && infoLayout != null) { if (!drawPhotoImage && TextUtils.isEmpty(messageObject.caption) && infoLayout != null) {
int lineCount = infoLayout.getLineCount(); int lineCount = infoLayout.getLineCount();
measureTime(messageObject); measureTime(messageObject);
@ -7784,8 +7787,12 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
viewsTextWidth = (int) Math.ceil(Theme.chat_timePaint.measureText(currentViewsString)); viewsTextWidth = (int) Math.ceil(Theme.chat_timePaint.measureText(currentViewsString));
timeWidth += viewsTextWidth + Theme.chat_msgInViewsDrawable.getIntrinsicWidth() + AndroidUtilities.dp(10); timeWidth += viewsTextWidth + Theme.chat_msgInViewsDrawable.getIntrinsicWidth() + AndroidUtilities.dp(10);
} }
if (messageObject.scheduled && messageObject.isSendError()) { if (messageObject.scheduled) {
timeWidth += AndroidUtilities.dp(18); 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 (signString != null) {
if (availableTimeWidth == 0) { if (availableTimeWidth == 0) {

View file

@ -406,7 +406,6 @@ public class AdminLogFilterAlert extends BottomSheet {
switch (viewType) { switch (viewType) {
case 0: case 0:
view = new CheckBoxCell(context, 1, 21); view = new CheckBoxCell(context, 1, 21);
view.setBackgroundDrawable(Theme.getSelectorDrawable(false));
break; break;
case 1: case 1:
ShadowSectionCell shadowSectionCell = new ShadowSectionCell(context, 18); 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.MessagesController;
import org.telegram.messenger.NotificationCenter; import org.telegram.messenger.NotificationCenter;
import org.telegram.messenger.R; import org.telegram.messenger.R;
import org.telegram.messenger.SharedConfig;
import org.telegram.ui.ActionBar.AlertDialog; import org.telegram.ui.ActionBar.AlertDialog;
import org.telegram.ui.ActionBar.BaseFragment; import org.telegram.ui.ActionBar.BaseFragment;
import org.telegram.ui.ActionBar.Theme; import org.telegram.ui.ActionBar.Theme;
@ -104,7 +105,9 @@ public class EditTextEmoji extends FrameLayout implements NotificationCenter.Not
@Override @Override
public boolean requestRectangleOnScreen(Rect rectangle) { public boolean requestRectangleOnScreen(Rect rectangle) {
rectangle.bottom += AndroidUtilities.dp(1000); if (SharedConfig.smoothKeyboard) {
rectangle.bottom += AndroidUtilities.dp(1000);
}
return super.requestRectangleOnScreen(rectangle); return super.requestRectangleOnScreen(rectangle);
} }
}; };

View file

@ -34,6 +34,9 @@ public class GestureDetector2 {
boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY); boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY);
void onLongPress(MotionEvent e); void onLongPress(MotionEvent e);
boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY); 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 LONGPRESS_TIMEOUT = ViewConfiguration.getLongPressTimeout();
private static final int TAP_TIMEOUT = ViewConfiguration.getTapTimeout(); 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 DOUBLE_TAP_MIN_TIME = 40;
private static final int SHOW_PRESS = 1; private static final int SHOW_PRESS = 1;
@ -364,7 +367,7 @@ public class GestureDetector2 {
handled |= mDoubleTapListener.onDoubleTapEvent(ev); handled |= mDoubleTapListener.onDoubleTapEvent(ev);
} else { } else {
// This is a first tap // 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(); 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; return false;
} }

View file

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

View file

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

View file

@ -8804,7 +8804,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
@Override @Override
public boolean onDown(MotionEvent e) { 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(); float x = e.getX();
int side = containerView.getMeasuredWidth() / 5; int side = containerView.getMeasuredWidth() / 5;
if (x < side) { if (x < side) {
@ -8822,6 +8822,18 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
return false; 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() { private void hidePressedDrawables() {
drawPressedDrawable[0] = drawPressedDrawable[1] = false; drawPressedDrawable[0] = drawPressedDrawable[1] = false;
containerView.invalidate(); containerView.invalidate();
@ -8989,6 +9001,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
animateTo(1.0f, 0, 0, true); animateTo(1.0f, 0, 0, true);
} }
doubleTap = true; doubleTap = true;
hidePressedDrawables();
return true; return true;
} }

View file

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

View file

@ -1849,12 +1849,14 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
openingAvatar = true; openingAvatar = true;
allowPullingDown = true; allowPullingDown = true;
View child = listView.getChildAt(0); View child = listView.getChildAt(0);
RecyclerView.ViewHolder holder = listView.findContainingViewHolder(child); if (child != null) {
if (holder != null) { RecyclerView.ViewHolder holder = listView.findContainingViewHolder(child);
Integer offset = positionToOffset.get(holder.getAdapterPosition()); if (holder != null) {
if (offset != null) { Integer offset = positionToOffset.get(holder.getAdapterPosition());
listView.smoothScrollBy(0, -(offset + (listView.getPaddingTop() - child.getTop() - actionBar.getMeasuredHeight())), CubicBezierInterpolator.EASE_OUT_QUINT); if (offset != null) {
return; listView.smoothScrollBy(0, -(offset + (listView.getPaddingTop() - child.getTop() - actionBar.getMeasuredHeight())), CubicBezierInterpolator.EASE_OUT_QUINT);
return;
}
} }
} }
} }
@ -3142,7 +3144,11 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
} }
updateRowsIds(); updateRowsIds();
if (listAdapter != null) { if (listAdapter != null) {
listAdapter.notifyDataSetChanged(); try {
listAdapter.notifyDataSetChanged();
} catch (Exception e) {
FileLog.e(e);
}
} }
sharedMediaLayout.setCommonGroupsCount(userInfo.common_chats_count); sharedMediaLayout.setCommonGroupsCount(userInfo.common_chats_count);
updateSelectedMediaTabText(); updateSelectedMediaTabText();
@ -4069,6 +4075,9 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
} }
private void createActionBarMenu() { private void createActionBarMenu() {
if (actionBar == null || otherItem == null) {
return;
}
ActionBarMenu menu = actionBar.createMenu(); ActionBarMenu menu = actionBar.createMenu();
otherItem.removeAllSubItems(); otherItem.removeAllSubItems();
animatingItem = null; animatingItem = null;