diff --git a/TMessagesProj/build.gradle b/TMessagesProj/build.gradle index f10a0f2d6..b5a03a11d 100644 --- a/TMessagesProj/build.gradle +++ b/TMessagesProj/build.gradle @@ -283,7 +283,7 @@ android { } } - defaultConfig.versionCode = 1867 + defaultConfig.versionCode = 1868 applicationVariants.all { variant -> variant.outputs.all { output -> diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/BuildVars.java b/TMessagesProj/src/main/java/org/telegram/messenger/BuildVars.java index 25c8e7b3a..e40f47417 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 = 1867; + public static int BUILD_VERSION = 1868; 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/EmojiData.java b/TMessagesProj/src/main/java/org/telegram/messenger/EmojiData.java index bee8c32a6..e0a6ef5f8 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/EmojiData.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/EmojiData.java @@ -429,7 +429,8 @@ public class EmojiData { "๐ง", "๐ง๐ป", "๐ง๐ผ", "๐ง๐ฝ", "๐ง๐พ", "๐ง๐ฟ", "๐คฝ", "๐คฝ๐ป", "๐คฝ๐ผ", "๐คฝ๐ฝ", "๐คฝ๐พ", "๐คฝ๐ฟ", "๐ง", "๐ง๐ป", "๐ง๐ผ", "๐ง๐ฝ", "๐ง๐พ", "๐ง๐ฟ", - "๐คน", "๐คน๐ป", "๐คน๐ผ", "๐คน๐ฝ", "๐คน๐พ", "๐คน๐ฟ"}; + "๐คน", "๐คน๐ป", "๐คน๐ผ", "๐คน๐ฝ", "๐คน๐พ", "๐คน๐ฟ", + "\uD83D\uDC91"}; public static final String[] aliasNew = new String[] { "๐ฑโโ", "๐ฑ๐ปโโ", "๐ฑ๐ผโโ", "๐ฑ๐ฝโโ", "๐ฑ๐พโโ", "๐ฑ๐ฟโโ", @@ -477,7 +478,8 @@ public class EmojiData { "๐งโโ", "๐ง๐ปโโ", "๐ง๐ผโโ", "๐ง๐ฝโโ", "๐ง๐พโโ", "๐ง๐ฟโโ", "๐คฝโโ", "๐คฝ๐ปโโ", "๐คฝ๐ผโโ", "๐คฝ๐ฝโโ", "๐คฝ๐พโโ", "๐คฝ๐ฟโโ", "๐งโโ", "๐ง๐ปโโ", "๐ง๐ผโโ", "๐ง๐ฝโโ", "๐ง๐พโโ", "๐ง๐ฟโโ", - "๐คนโโ", "๐คน๐ปโโ", "๐คน๐ผโโ", "๐คน๐ฝโโ", "๐คน๐พโโ", "๐คน๐ฟโโ"}; + "๐คนโโ", "๐คน๐ปโโ", "๐คน๐ผโโ", "๐คน๐ฝโโ", "๐คน๐พโโ", "๐คน๐ฟโโ", + "๐ฉโโคโ๐จ"}; public static final String[][] data = { new String[]{ diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/LocationController.java b/TMessagesProj/src/main/java/org/telegram/messenger/LocationController.java index a69befd7c..ddaf5104f 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/LocationController.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/LocationController.java @@ -289,7 +289,11 @@ public class LocationController extends BaseController implements NotificationCe startFusedLocationRequest(true); break; case LocationSettingsStatusCodes.RESOLUTION_REQUIRED: - AndroidUtilities.runOnUIThread(() -> getNotificationCenter().postNotificationName(NotificationCenter.needShowPlayServicesAlert, status)); + Utilities.stageQueue.postRunnable(() -> { + if (lookingForPeopleNearby || !sharingLocations.isEmpty()) { + AndroidUtilities.runOnUIThread(() -> getNotificationCenter().postNotificationName(NotificationCenter.needShowPlayServicesAlert, status)); + } + }); break; case LocationSettingsStatusCodes.SETTINGS_CHANGE_UNAVAILABLE: Utilities.stageQueue.postRunnable(() -> { @@ -468,7 +472,8 @@ public class LocationController extends BaseController implements NotificationCe protected void update() { UserConfig userConfig = getUserConfig(); - if (ApplicationLoader.isScreenOn && !ApplicationLoader.mainInterfacePaused && !shareMyCurrentLocation && userConfig.sharingMyLocationUntil != 0 && Math.abs(System.currentTimeMillis() / 1000 - userConfig.lastMyLocationShareTime) >= 60 * 60) { + if (ApplicationLoader.isScreenOn && !ApplicationLoader.mainInterfacePaused && !shareMyCurrentLocation && + userConfig.isClientActivated() && userConfig.isConfigLoaded() && userConfig.sharingMyLocationUntil != 0 && Math.abs(System.currentTimeMillis() / 1000 - userConfig.lastMyLocationShareTime) >= 60 * 60) { shareMyCurrentLocation = true; } if (!sharingLocations.isEmpty()) { diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/MediaDataController.java b/TMessagesProj/src/main/java/org/telegram/messenger/MediaDataController.java index 85068d96b..59df69568 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/MediaDataController.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/MediaDataController.java @@ -1829,6 +1829,9 @@ public class MediaDataController extends BaseController { public void loadMedia(final long uid, final int count, final int max_id, final int type, final int fromCache, final int classGuid) { final boolean isChannel = (int) uid < 0 && ChatObject.isChannel(-(int) uid, currentAccount); + if (BuildVars.DEBUG_VERSION) { + FileLog.d("load media did " + uid + " count = " + count + " max_id " + max_id + " type = " + type + " cache = " + fromCache + " classGuid = " + classGuid); + } int lower_part = (int)uid; if (fromCache != 0 || lower_part == 0) { loadMediaDatabase(uid, count, max_id, type, classGuid, isChannel, fromCache); @@ -2057,6 +2060,9 @@ public class MediaDataController extends BaseController { } 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) { + if (BuildVars.DEBUG_VERSION) { + FileLog.d("process load media did " + uid + " count = " + count + " max_id " + max_id + " type = " + type + " cache = " + fromCache + " classGuid = " + classGuid); + } int lower_part = (int)uid; if (fromCache != 0 && res.messages.isEmpty() && lower_part != 0) { if (fromCache == 2) { diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/UserConfig.java b/TMessagesProj/src/main/java/org/telegram/messenger/UserConfig.java index 24767d54d..25577dbc6 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/UserConfig.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/UserConfig.java @@ -397,6 +397,10 @@ public class UserConfig extends BaseController { } } + public boolean isConfigLoaded() { + return configLoaded; + } + public void savePassword(byte[] hash, byte[] salted) { savedPasswordTime = SystemClock.elapsedRealtime(); savedPasswordHash = hash; diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ArticleViewer.java b/TMessagesProj/src/main/java/org/telegram/ui/ArticleViewer.java index ff3d02a88..f6f6d0353 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ArticleViewer.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ArticleViewer.java @@ -1116,12 +1116,14 @@ public class ArticleViewer implements NotificationCenter.NotificationCenterDeleg pressedLinkOwnerView.invalidate(); } } else if (pressedLinkOwnerView != null && textSelectionHelper.isSelectable(pressedLinkOwnerView)) { - windowView.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS); if (pressedLinkOwnerView.getTag() != null && pressedLinkOwnerView.getTag() == BOTTOM_SHEET_VIEW_TAG && textSelectionHelperBottomSheet != null) { textSelectionHelperBottomSheet.trySelect(pressedLinkOwnerView); } else { textSelectionHelper.trySelect(pressedLinkOwnerView); } + if (textSelectionHelper.isSelectionMode()) { + windowView.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS); + } } else if (pressedLinkOwnerLayout != null && pressedLinkOwnerView != null) { windowView.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS); @@ -1634,7 +1636,9 @@ public class ArticleViewer implements NotificationCenter.NotificationCenterDeleg } else { layoutManager[index].scrollToPositionWithOffset(0, 0); } - checkScrollAnimated(); + if (!previous) { + checkScrollAnimated(); + } } private boolean addPageToStack(TLRPC.WebPage webPage, String anchor, int order) { @@ -7744,6 +7748,14 @@ public class ArticleViewer implements NotificationCenter.NotificationCenterDeleg return intercept; } + @Override + public boolean onTouchEvent(MotionEvent ev) { + if (tableLayout.getMeasuredWidth() <= getMeasuredWidth() - AndroidUtilities.dp(36)) { + return false; + } + return super.onTouchEvent(ev); + } + @Override protected void onScrollChanged(int l, int t, int oldl, int oldt) { super.onScrollChanged(l, t, oldl, oldt); @@ -8631,6 +8643,7 @@ public class ArticleViewer implements NotificationCenter.NotificationCenterDeleg @Override public boolean onInterceptTouchEvent(MotionEvent ev) { windowView.requestDisallowInterceptTouchEvent(true); + cancelCheckLongPress(); return super.onInterceptTouchEvent(ev); } }; @@ -11232,8 +11245,6 @@ public class ArticleViewer implements NotificationCenter.NotificationCenterDeleg for (int a = 0, count = textLayout.getLineCount(); a < count; a++) { width = Math.max((int) Math.ceil(textLayout.getLineWidth(a)), width); } - textLayout.x = (int) getX(); - textLayout.y = (int) getY(); } } else { height = 1; @@ -11243,7 +11254,7 @@ public class ArticleViewer implements NotificationCenter.NotificationCenterDeleg @Override public boolean onTouchEvent(MotionEvent event) { - return checkLayoutForLinks(parentAdapter, event, this, textLayout, 0, 0) || super.onTouchEvent(event); + return checkLayoutForLinks(parentAdapter, event, BlockPreformattedCell.this, textLayout, 0, 0) || super.onTouchEvent(event); } @Override @@ -11253,6 +11264,8 @@ public class ArticleViewer implements NotificationCenter.NotificationCenterDeleg drawTextSelection(canvas, BlockPreformattedCell.this); textLayout.draw(canvas); canvas.restore(); + textLayout.x = (int) getX(); + textLayout.y = (int) getY(); } } }; @@ -11261,6 +11274,12 @@ public class ArticleViewer implements NotificationCenter.NotificationCenterDeleg layoutParams.topMargin = layoutParams.bottomMargin = AndroidUtilities.dp(12); scrollView.addView(textContainer, layoutParams); + scrollView.setOnScrollChangeListener((v, scrollX, scrollY, oldScrollX, oldScrollY) -> { + if (textSelectionHelper != null && textSelectionHelper.isSelectionMode()) { + textSelectionHelper.invalidate(); + } + }); + setWillNotDraw(false); } @@ -11291,6 +11310,12 @@ public class ArticleViewer implements NotificationCenter.NotificationCenterDeleg blocks.add(textLayout); } } + + @Override + public void invalidate() { + textContainer.invalidate(); + super.invalidate(); + } } private class BlockSubheaderCell extends View implements TextSelectionHelper.ArticleSelectableView{ diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatMessageCell.java b/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatMessageCell.java index 24910c0ed..f8f127262 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatMessageCell.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatMessageCell.java @@ -7241,7 +7241,12 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate buttonState = -1; } else { if (documentAttachType == DOCUMENT_ATTACH_TYPE_GIF && currentMessageObject.gifState == 1) { - buttonState = 2; + if (photoImage.isAnimationRunning()) { + currentMessageObject.gifState = 0; + buttonState = -1; + } else { + buttonState = 2; + } } else if (documentAttachType == DOCUMENT_ATTACH_TYPE_VIDEO) { buttonState = 3; } else { 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 bfe4e672b..4a50b4887 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/SharedAudioCell.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/SharedAudioCell.java @@ -117,7 +117,7 @@ public class SharedAudioCell extends FrameLayout implements DownloadController.F currentMessageObject = messageObject; TLRPC.Document document = messageObject.getDocument(); - TLRPC.PhotoSize thumb = document != null ? FileLoader.getClosestPhotoSizeWithSize(document.thumbs, 90) : null; + TLRPC.PhotoSize thumb = document != null ? FileLoader.getClosestPhotoSizeWithSize(document.thumbs, 240) : null; if (thumb instanceof TLRPC.TL_photoSize) { radialProgress.setImageOverlay(thumb, document, messageObject); } else { 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 24f21ac11..b9461a011 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/GestureDetector2.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/GestureDetector2.java @@ -34,108 +34,14 @@ 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; - } } - /** - * The listener that is used to notify when a double-tap or a confirmed - * single-tap occur. - */ public interface OnDoubleTapListener { - /** - * Notified when a single-tap occurs. - *
- * Unlike {@link OnGestureListener#onSingleTapUp(MotionEvent)}, this
- * will only be called after the detector is confident that the user's
- * first tap is not followed by a second tap leading to a double-tap
- * gesture.
- *
- * @param e The down motion event of the single-tap.
- * @return true if the event is consumed, else false
- */
boolean onSingleTapConfirmed(MotionEvent e);
-
- /**
- * Notified when a double-tap occurs.
- *
- * @param e The down motion event of the first tap of the double-tap.
- * @return true if the event is consumed, else false
- */
boolean onDoubleTap(MotionEvent e);
-
- /**
- * Notified when an event within a double-tap gesture occurs, including
- * the down, move, and up events.
- *
- * @param e The motion event that occurred during the double-tap gesture.
- * @return true if the event is consumed, else false
- */
boolean onDoubleTapEvent(MotionEvent e);
- }
-
- public interface OnContextClickListener {
- /**
- * Notified when a context click occurs.
- *
- * @param e The motion event that occurred during the context click.
- * @return true if the event is consumed, else false
- */
- boolean onContextClick(MotionEvent e);
- }
-
- /**
- * A convenience class to extend when you only want to listen for a subset
- * of all the gestures. This implements all methods in the
- * {@link OnGestureListener}, {@link OnDoubleTapListener}, and {@link OnContextClickListener}
- * but does nothing and return {@code false} for all applicable methods.
- */
- public static class SimpleOnGestureListener implements OnGestureListener, OnDoubleTapListener,
- OnContextClickListener {
-
- public boolean onSingleTapUp(MotionEvent e) {
- return false;
- }
-
- public void onLongPress(MotionEvent e) {
- }
-
- public boolean onScroll(MotionEvent e1, MotionEvent e2,
- float distanceX, float distanceY) {
- return false;
- }
-
- public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX,
- float velocityY) {
- return false;
- }
-
- public void onShowPress(MotionEvent e) {
- }
-
- public boolean onDown(MotionEvent e) {
- return false;
- }
-
- public void onUp(MotionEvent e) {
-
- }
-
- public boolean onDoubleTap(MotionEvent e) {
- return false;
- }
-
- public boolean onDoubleTapEvent(MotionEvent e) {
- return false;
- }
-
- public boolean onSingleTapConfirmed(MotionEvent e) {
- return false;
- }
-
- public boolean onContextClick(MotionEvent e) {
- return false;
+ default boolean canDoubleTap(MotionEvent e) {
+ return true;
}
}
@@ -304,7 +210,6 @@ public class GestureDetector2 {
final boolean pointerUp = (action & MotionEvent.ACTION_MASK) == MotionEvent.ACTION_POINTER_UP;
final int skipIndex = pointerUp ? ev.getActionIndex() : -1;
- // Determine focal point
float sumX = 0, sumY = 0;
final int count = ev.getPointerCount();
for (int i = 0; i < count; i++) {
@@ -322,7 +227,6 @@ public class GestureDetector2 {
case MotionEvent.ACTION_POINTER_DOWN:
mDownFocusX = mLastFocusX = focusX;
mDownFocusY = mLastFocusY = focusY;
- // Cancel long press and taps
cancelTaps();
break;
@@ -330,8 +234,6 @@ public class GestureDetector2 {
mDownFocusX = mLastFocusX = focusX;
mDownFocusY = mLastFocusY = focusY;
- // Check the dot product of current velocities.
- // If the pointer that left was opposing another velocity vector, clear.
mVelocityTracker.computeCurrentVelocity(1000, mMaximumFlingVelocity);
final int upIndex = ev.getActionIndex();
final int id1 = ev.getPointerId(upIndex);
@@ -353,21 +255,20 @@ public class GestureDetector2 {
break;
case MotionEvent.ACTION_DOWN:
+ mDeferConfirmSingleTap = false;
if (mDoubleTapListener != null) {
- boolean hadTapMessage = mHandler.hasMessages(TAP);
- if (hadTapMessage) mHandler.removeMessages(TAP);
- if ((mCurrentDownEvent != null) && (mPreviousUpEvent != null)
- && hadTapMessage
- && isConsideredDoubleTap(mCurrentDownEvent, mPreviousUpEvent, ev)) {
- // This is a second tap
- mIsDoubleTapping = true;
- // Give a callback with the first tap of the double-tap
- handled |= mDoubleTapListener.onDoubleTap(mCurrentDownEvent);
- // Give a callback with down event of the double-tap
- handled |= mDoubleTapListener.onDoubleTapEvent(ev);
+ if (mDoubleTapListener.canDoubleTap(ev)) {
+ boolean hadTapMessage = mHandler.hasMessages(TAP);
+ if (hadTapMessage) mHandler.removeMessages(TAP);
+ if ((mCurrentDownEvent != null) && (mPreviousUpEvent != null) && hadTapMessage && isConsideredDoubleTap(mCurrentDownEvent, mPreviousUpEvent, ev)) {
+ mIsDoubleTapping = true;
+ handled |= mDoubleTapListener.onDoubleTap(mCurrentDownEvent);
+ handled |= mDoubleTapListener.onDoubleTapEvent(ev);
+ } else {
+ mHandler.sendEmptyMessageDelayed(TAP, DOUBLE_TAP_TIMEOUT);
+ }
} else {
- // This is a first tap
- mHandler.sendEmptyMessageDelayed(TAP, mListener.getDoubleTapTimeout(ev));
+ mDeferConfirmSingleTap = true;
}
}
@@ -381,16 +282,12 @@ public class GestureDetector2 {
mAlwaysInBiggerTapRegion = true;
mStillDown = true;
mInLongPress = false;
- mDeferConfirmSingleTap = false;
if (mIsLongpressEnabled) {
mHandler.removeMessages(LONG_PRESS);
- mHandler.sendMessageAtTime(
- mHandler.obtainMessage(LONG_PRESS, 0, 0), mCurrentDownEvent.getDownTime()
- + ViewConfiguration.getLongPressTimeout());
+ mHandler.sendMessageAtTime(mHandler.obtainMessage(LONG_PRESS, 0, 0), mCurrentDownEvent.getDownTime() + ViewConfiguration.getLongPressTimeout());
}
- mHandler.sendEmptyMessageAtTime(SHOW_PRESS,
- mCurrentDownEvent.getDownTime() + TAP_TIMEOUT);
+ mHandler.sendEmptyMessageAtTime(SHOW_PRESS, mCurrentDownEvent.getDownTime() + TAP_TIMEOUT);
handled |= mListener.onDown(ev);
break;
@@ -472,8 +369,7 @@ public class GestureDetector2 {
final float velocityY = velocityTracker.getYVelocity(pointerId);
final float velocityX = velocityTracker.getXVelocity(pointerId);
- if ((Math.abs(velocityY) > mMinimumFlingVelocity)
- || (Math.abs(velocityX) > mMinimumFlingVelocity)) {
+ if ((Math.abs(velocityY) > mMinimumFlingVelocity) || (Math.abs(velocityX) > mMinimumFlingVelocity)) {
handled = mListener.onFling(mCurrentDownEvent, ev, velocityX, velocityY);
}
}
@@ -534,7 +430,7 @@ public class GestureDetector2 {
}
final long deltaTime = secondDown.getEventTime() - firstUp.getEventTime();
- if (deltaTime > mListener.getDoubleTapTimeout(firstDown) || deltaTime < DOUBLE_TAP_MIN_TIME) {
+ if (deltaTime > DOUBLE_TAP_TIMEOUT || deltaTime < DOUBLE_TAP_MIN_TIME) {
return false;
}
diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/SharedMediaLayout.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/SharedMediaLayout.java
index 9614b1312..5de0fdfa9 100644
--- a/TMessagesProj/src/main/java/org/telegram/ui/Components/SharedMediaLayout.java
+++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/SharedMediaLayout.java
@@ -556,11 +556,13 @@ public class SharedMediaLayout extends FrameLayout implements NotificationCenter
messagesDict[0].remove(oldMid);
messagesDict[0].put(newMid, obj);
obj.messageOwner.id = newMid;
+ max_id[0] = Math.min(newMid, max_id[0]);
}
}
}
private SharedMediaData[] sharedMediaData = new SharedMediaData[5];
+ private SharedMediaPreloader sharedMediaPreloader;
private final static int forward = 100;
private final static int delete = 101;
@@ -577,9 +579,11 @@ public class SharedMediaLayout extends FrameLayout implements NotificationCenter
private boolean isActionModeShowed;
- public SharedMediaLayout(Context context, long did, int[] mediaCount, SharedMediaData[] mediaData, int commonGroupsCount, ArrayList