mirror of
https://github.com/DrKLO/Telegram.git
synced 2024-12-22 14:35:03 +01:00
Update to 5.15.0 (1868)
This commit is contained in:
parent
08a8e007eb
commit
dae819b5a3
14 changed files with 180 additions and 165 deletions
|
@ -283,7 +283,7 @@ android {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
defaultConfig.versionCode = 1867
|
defaultConfig.versionCode = 1868
|
||||||
|
|
||||||
applicationVariants.all { variant ->
|
applicationVariants.all { variant ->
|
||||||
variant.outputs.all { output ->
|
variant.outputs.all { output ->
|
||||||
|
|
|
@ -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 = 1867;
|
public static int BUILD_VERSION = 1868;
|
||||||
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";
|
||||||
|
|
|
@ -429,7 +429,8 @@ public class EmojiData {
|
||||||
"🧘", "🧘🏻", "🧘🏼", "🧘🏽", "🧘🏾", "🧘🏿",
|
"🧘", "🧘🏻", "🧘🏼", "🧘🏽", "🧘🏾", "🧘🏿",
|
||||||
"🤽", "🤽🏻", "🤽🏼", "🤽🏽", "🤽🏾", "🤽🏿",
|
"🤽", "🤽🏻", "🤽🏼", "🤽🏽", "🤽🏾", "🤽🏿",
|
||||||
"🧗", "🧗🏻", "🧗🏼", "🧗🏽", "🧗🏾", "🧗🏿",
|
"🧗", "🧗🏻", "🧗🏼", "🧗🏽", "🧗🏾", "🧗🏿",
|
||||||
"🤹", "🤹🏻", "🤹🏼", "🤹🏽", "🤹🏾", "🤹🏿"};
|
"🤹", "🤹🏻", "🤹🏼", "🤹🏽", "🤹🏾", "🤹🏿",
|
||||||
|
"\uD83D\uDC91"};
|
||||||
|
|
||||||
public static final String[] aliasNew = new String[] {
|
public static final String[] aliasNew = new String[] {
|
||||||
"👱♂", "👱🏻♂", "👱🏼♂", "👱🏽♂", "👱🏾♂", "👱🏿♂",
|
"👱♂", "👱🏻♂", "👱🏼♂", "👱🏽♂", "👱🏾♂", "👱🏿♂",
|
||||||
|
@ -477,7 +478,8 @@ public class EmojiData {
|
||||||
"🧘♀", "🧘🏻♀", "🧘🏼♀", "🧘🏽♀", "🧘🏾♀", "🧘🏿♀",
|
"🧘♀", "🧘🏻♀", "🧘🏼♀", "🧘🏽♀", "🧘🏾♀", "🧘🏿♀",
|
||||||
"🤽♂", "🤽🏻♂", "🤽🏼♂", "🤽🏽♂", "🤽🏾♂", "🤽🏿♂",
|
"🤽♂", "🤽🏻♂", "🤽🏼♂", "🤽🏽♂", "🤽🏾♂", "🤽🏿♂",
|
||||||
"🧗♂", "🧗🏻♂", "🧗🏼♂", "🧗🏽♂", "🧗🏾♂", "🧗🏿♂",
|
"🧗♂", "🧗🏻♂", "🧗🏼♂", "🧗🏽♂", "🧗🏾♂", "🧗🏿♂",
|
||||||
"🤹♂", "🤹🏻♂", "🤹🏼♂", "🤹🏽♂", "🤹🏾♂", "🤹🏿♂"};
|
"🤹♂", "🤹🏻♂", "🤹🏼♂", "🤹🏽♂", "🤹🏾♂", "🤹🏿♂",
|
||||||
|
"👩❤👨"};
|
||||||
|
|
||||||
public static final String[][] data = {
|
public static final String[][] data = {
|
||||||
new String[]{
|
new String[]{
|
||||||
|
|
|
@ -289,7 +289,11 @@ public class LocationController extends BaseController implements NotificationCe
|
||||||
startFusedLocationRequest(true);
|
startFusedLocationRequest(true);
|
||||||
break;
|
break;
|
||||||
case LocationSettingsStatusCodes.RESOLUTION_REQUIRED:
|
case LocationSettingsStatusCodes.RESOLUTION_REQUIRED:
|
||||||
|
Utilities.stageQueue.postRunnable(() -> {
|
||||||
|
if (lookingForPeopleNearby || !sharingLocations.isEmpty()) {
|
||||||
AndroidUtilities.runOnUIThread(() -> getNotificationCenter().postNotificationName(NotificationCenter.needShowPlayServicesAlert, status));
|
AndroidUtilities.runOnUIThread(() -> getNotificationCenter().postNotificationName(NotificationCenter.needShowPlayServicesAlert, status));
|
||||||
|
}
|
||||||
|
});
|
||||||
break;
|
break;
|
||||||
case LocationSettingsStatusCodes.SETTINGS_CHANGE_UNAVAILABLE:
|
case LocationSettingsStatusCodes.SETTINGS_CHANGE_UNAVAILABLE:
|
||||||
Utilities.stageQueue.postRunnable(() -> {
|
Utilities.stageQueue.postRunnable(() -> {
|
||||||
|
@ -468,7 +472,8 @@ public class LocationController extends BaseController implements NotificationCe
|
||||||
|
|
||||||
protected void update() {
|
protected void update() {
|
||||||
UserConfig userConfig = getUserConfig();
|
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;
|
shareMyCurrentLocation = true;
|
||||||
}
|
}
|
||||||
if (!sharingLocations.isEmpty()) {
|
if (!sharingLocations.isEmpty()) {
|
||||||
|
|
|
@ -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) {
|
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);
|
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;
|
int lower_part = (int)uid;
|
||||||
if (fromCache != 0 || lower_part == 0) {
|
if (fromCache != 0 || lower_part == 0) {
|
||||||
loadMediaDatabase(uid, count, max_id, type, classGuid, isChannel, fromCache);
|
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) {
|
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;
|
int lower_part = (int)uid;
|
||||||
if (fromCache != 0 && res.messages.isEmpty() && lower_part != 0) {
|
if (fromCache != 0 && res.messages.isEmpty() && lower_part != 0) {
|
||||||
if (fromCache == 2) {
|
if (fromCache == 2) {
|
||||||
|
|
|
@ -397,6 +397,10 @@ public class UserConfig extends BaseController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isConfigLoaded() {
|
||||||
|
return configLoaded;
|
||||||
|
}
|
||||||
|
|
||||||
public void savePassword(byte[] hash, byte[] salted) {
|
public void savePassword(byte[] hash, byte[] salted) {
|
||||||
savedPasswordTime = SystemClock.elapsedRealtime();
|
savedPasswordTime = SystemClock.elapsedRealtime();
|
||||||
savedPasswordHash = hash;
|
savedPasswordHash = hash;
|
||||||
|
|
|
@ -1116,12 +1116,14 @@ public class ArticleViewer implements NotificationCenter.NotificationCenterDeleg
|
||||||
pressedLinkOwnerView.invalidate();
|
pressedLinkOwnerView.invalidate();
|
||||||
}
|
}
|
||||||
} else if (pressedLinkOwnerView != null && textSelectionHelper.isSelectable(pressedLinkOwnerView)) {
|
} else if (pressedLinkOwnerView != null && textSelectionHelper.isSelectable(pressedLinkOwnerView)) {
|
||||||
windowView.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS);
|
|
||||||
if (pressedLinkOwnerView.getTag() != null && pressedLinkOwnerView.getTag() == BOTTOM_SHEET_VIEW_TAG && textSelectionHelperBottomSheet != null) {
|
if (pressedLinkOwnerView.getTag() != null && pressedLinkOwnerView.getTag() == BOTTOM_SHEET_VIEW_TAG && textSelectionHelperBottomSheet != null) {
|
||||||
textSelectionHelperBottomSheet.trySelect(pressedLinkOwnerView);
|
textSelectionHelperBottomSheet.trySelect(pressedLinkOwnerView);
|
||||||
} else {
|
} else {
|
||||||
textSelectionHelper.trySelect(pressedLinkOwnerView);
|
textSelectionHelper.trySelect(pressedLinkOwnerView);
|
||||||
}
|
}
|
||||||
|
if (textSelectionHelper.isSelectionMode()) {
|
||||||
|
windowView.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS);
|
||||||
|
}
|
||||||
} else if (pressedLinkOwnerLayout != null && pressedLinkOwnerView != null) {
|
} else if (pressedLinkOwnerLayout != null && pressedLinkOwnerView != null) {
|
||||||
windowView.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS);
|
windowView.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS);
|
||||||
|
|
||||||
|
@ -1634,8 +1636,10 @@ public class ArticleViewer implements NotificationCenter.NotificationCenterDeleg
|
||||||
} else {
|
} else {
|
||||||
layoutManager[index].scrollToPositionWithOffset(0, 0);
|
layoutManager[index].scrollToPositionWithOffset(0, 0);
|
||||||
}
|
}
|
||||||
|
if (!previous) {
|
||||||
checkScrollAnimated();
|
checkScrollAnimated();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private boolean addPageToStack(TLRPC.WebPage webPage, String anchor, int order) {
|
private boolean addPageToStack(TLRPC.WebPage webPage, String anchor, int order) {
|
||||||
saveCurrentPagePosition();
|
saveCurrentPagePosition();
|
||||||
|
@ -7744,6 +7748,14 @@ public class ArticleViewer implements NotificationCenter.NotificationCenterDeleg
|
||||||
return intercept;
|
return intercept;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onTouchEvent(MotionEvent ev) {
|
||||||
|
if (tableLayout.getMeasuredWidth() <= getMeasuredWidth() - AndroidUtilities.dp(36)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return super.onTouchEvent(ev);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onScrollChanged(int l, int t, int oldl, int oldt) {
|
protected void onScrollChanged(int l, int t, int oldl, int oldt) {
|
||||||
super.onScrollChanged(l, t, oldl, oldt);
|
super.onScrollChanged(l, t, oldl, oldt);
|
||||||
|
@ -8631,6 +8643,7 @@ public class ArticleViewer implements NotificationCenter.NotificationCenterDeleg
|
||||||
@Override
|
@Override
|
||||||
public boolean onInterceptTouchEvent(MotionEvent ev) {
|
public boolean onInterceptTouchEvent(MotionEvent ev) {
|
||||||
windowView.requestDisallowInterceptTouchEvent(true);
|
windowView.requestDisallowInterceptTouchEvent(true);
|
||||||
|
cancelCheckLongPress();
|
||||||
return super.onInterceptTouchEvent(ev);
|
return super.onInterceptTouchEvent(ev);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -11232,8 +11245,6 @@ public class ArticleViewer implements NotificationCenter.NotificationCenterDeleg
|
||||||
for (int a = 0, count = textLayout.getLineCount(); a < count; a++) {
|
for (int a = 0, count = textLayout.getLineCount(); a < count; a++) {
|
||||||
width = Math.max((int) Math.ceil(textLayout.getLineWidth(a)), width);
|
width = Math.max((int) Math.ceil(textLayout.getLineWidth(a)), width);
|
||||||
}
|
}
|
||||||
textLayout.x = (int) getX();
|
|
||||||
textLayout.y = (int) getY();
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
height = 1;
|
height = 1;
|
||||||
|
@ -11243,7 +11254,7 @@ public class ArticleViewer implements NotificationCenter.NotificationCenterDeleg
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onTouchEvent(MotionEvent event) {
|
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
|
@Override
|
||||||
|
@ -11253,6 +11264,8 @@ public class ArticleViewer implements NotificationCenter.NotificationCenterDeleg
|
||||||
drawTextSelection(canvas, BlockPreformattedCell.this);
|
drawTextSelection(canvas, BlockPreformattedCell.this);
|
||||||
textLayout.draw(canvas);
|
textLayout.draw(canvas);
|
||||||
canvas.restore();
|
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);
|
layoutParams.topMargin = layoutParams.bottomMargin = AndroidUtilities.dp(12);
|
||||||
scrollView.addView(textContainer, layoutParams);
|
scrollView.addView(textContainer, layoutParams);
|
||||||
|
|
||||||
|
scrollView.setOnScrollChangeListener((v, scrollX, scrollY, oldScrollX, oldScrollY) -> {
|
||||||
|
if (textSelectionHelper != null && textSelectionHelper.isSelectionMode()) {
|
||||||
|
textSelectionHelper.invalidate();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
setWillNotDraw(false);
|
setWillNotDraw(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11291,6 +11310,12 @@ public class ArticleViewer implements NotificationCenter.NotificationCenterDeleg
|
||||||
blocks.add(textLayout);
|
blocks.add(textLayout);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void invalidate() {
|
||||||
|
textContainer.invalidate();
|
||||||
|
super.invalidate();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class BlockSubheaderCell extends View implements TextSelectionHelper.ArticleSelectableView{
|
private class BlockSubheaderCell extends View implements TextSelectionHelper.ArticleSelectableView{
|
||||||
|
|
|
@ -7241,7 +7241,12 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||||
buttonState = -1;
|
buttonState = -1;
|
||||||
} else {
|
} else {
|
||||||
if (documentAttachType == DOCUMENT_ATTACH_TYPE_GIF && currentMessageObject.gifState == 1) {
|
if (documentAttachType == DOCUMENT_ATTACH_TYPE_GIF && currentMessageObject.gifState == 1) {
|
||||||
|
if (photoImage.isAnimationRunning()) {
|
||||||
|
currentMessageObject.gifState = 0;
|
||||||
|
buttonState = -1;
|
||||||
|
} else {
|
||||||
buttonState = 2;
|
buttonState = 2;
|
||||||
|
}
|
||||||
} else if (documentAttachType == DOCUMENT_ATTACH_TYPE_VIDEO) {
|
} else if (documentAttachType == DOCUMENT_ATTACH_TYPE_VIDEO) {
|
||||||
buttonState = 3;
|
buttonState = 3;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -117,7 +117,7 @@ public class SharedAudioCell extends FrameLayout implements DownloadController.F
|
||||||
currentMessageObject = messageObject;
|
currentMessageObject = messageObject;
|
||||||
TLRPC.Document document = messageObject.getDocument();
|
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) {
|
if (thumb instanceof TLRPC.TL_photoSize) {
|
||||||
radialProgress.setImageOverlay(thumb, document, messageObject);
|
radialProgress.setImageOverlay(thumb, document, messageObject);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -34,108 +34,14 @@ 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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* The listener that is used to notify when a double-tap or a confirmed
|
|
||||||
* single-tap occur.
|
|
||||||
*/
|
|
||||||
public interface OnDoubleTapListener {
|
public interface OnDoubleTapListener {
|
||||||
/**
|
|
||||||
* Notified when a single-tap occurs.
|
|
||||||
* <p>
|
|
||||||
* 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);
|
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);
|
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);
|
boolean onDoubleTapEvent(MotionEvent e);
|
||||||
}
|
default boolean canDoubleTap(MotionEvent e) {
|
||||||
|
return true;
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -304,7 +210,6 @@ public class GestureDetector2 {
|
||||||
final boolean pointerUp = (action & MotionEvent.ACTION_MASK) == MotionEvent.ACTION_POINTER_UP;
|
final boolean pointerUp = (action & MotionEvent.ACTION_MASK) == MotionEvent.ACTION_POINTER_UP;
|
||||||
final int skipIndex = pointerUp ? ev.getActionIndex() : -1;
|
final int skipIndex = pointerUp ? ev.getActionIndex() : -1;
|
||||||
|
|
||||||
// Determine focal point
|
|
||||||
float sumX = 0, sumY = 0;
|
float sumX = 0, sumY = 0;
|
||||||
final int count = ev.getPointerCount();
|
final int count = ev.getPointerCount();
|
||||||
for (int i = 0; i < count; i++) {
|
for (int i = 0; i < count; i++) {
|
||||||
|
@ -322,7 +227,6 @@ public class GestureDetector2 {
|
||||||
case MotionEvent.ACTION_POINTER_DOWN:
|
case MotionEvent.ACTION_POINTER_DOWN:
|
||||||
mDownFocusX = mLastFocusX = focusX;
|
mDownFocusX = mLastFocusX = focusX;
|
||||||
mDownFocusY = mLastFocusY = focusY;
|
mDownFocusY = mLastFocusY = focusY;
|
||||||
// Cancel long press and taps
|
|
||||||
cancelTaps();
|
cancelTaps();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -330,8 +234,6 @@ public class GestureDetector2 {
|
||||||
mDownFocusX = mLastFocusX = focusX;
|
mDownFocusX = mLastFocusX = focusX;
|
||||||
mDownFocusY = mLastFocusY = focusY;
|
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);
|
mVelocityTracker.computeCurrentVelocity(1000, mMaximumFlingVelocity);
|
||||||
final int upIndex = ev.getActionIndex();
|
final int upIndex = ev.getActionIndex();
|
||||||
final int id1 = ev.getPointerId(upIndex);
|
final int id1 = ev.getPointerId(upIndex);
|
||||||
|
@ -353,21 +255,20 @@ public class GestureDetector2 {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MotionEvent.ACTION_DOWN:
|
case MotionEvent.ACTION_DOWN:
|
||||||
|
mDeferConfirmSingleTap = false;
|
||||||
if (mDoubleTapListener != null) {
|
if (mDoubleTapListener != null) {
|
||||||
|
if (mDoubleTapListener.canDoubleTap(ev)) {
|
||||||
boolean hadTapMessage = mHandler.hasMessages(TAP);
|
boolean hadTapMessage = mHandler.hasMessages(TAP);
|
||||||
if (hadTapMessage) mHandler.removeMessages(TAP);
|
if (hadTapMessage) mHandler.removeMessages(TAP);
|
||||||
if ((mCurrentDownEvent != null) && (mPreviousUpEvent != null)
|
if ((mCurrentDownEvent != null) && (mPreviousUpEvent != null) && hadTapMessage && isConsideredDoubleTap(mCurrentDownEvent, mPreviousUpEvent, ev)) {
|
||||||
&& hadTapMessage
|
|
||||||
&& isConsideredDoubleTap(mCurrentDownEvent, mPreviousUpEvent, ev)) {
|
|
||||||
// This is a second tap
|
|
||||||
mIsDoubleTapping = true;
|
mIsDoubleTapping = true;
|
||||||
// Give a callback with the first tap of the double-tap
|
|
||||||
handled |= mDoubleTapListener.onDoubleTap(mCurrentDownEvent);
|
handled |= mDoubleTapListener.onDoubleTap(mCurrentDownEvent);
|
||||||
// Give a callback with down event of the double-tap
|
|
||||||
handled |= mDoubleTapListener.onDoubleTapEvent(ev);
|
handled |= mDoubleTapListener.onDoubleTapEvent(ev);
|
||||||
} else {
|
} else {
|
||||||
// This is a first tap
|
mHandler.sendEmptyMessageDelayed(TAP, DOUBLE_TAP_TIMEOUT);
|
||||||
mHandler.sendEmptyMessageDelayed(TAP, mListener.getDoubleTapTimeout(ev));
|
}
|
||||||
|
} else {
|
||||||
|
mDeferConfirmSingleTap = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -381,16 +282,12 @@ public class GestureDetector2 {
|
||||||
mAlwaysInBiggerTapRegion = true;
|
mAlwaysInBiggerTapRegion = true;
|
||||||
mStillDown = true;
|
mStillDown = true;
|
||||||
mInLongPress = false;
|
mInLongPress = false;
|
||||||
mDeferConfirmSingleTap = false;
|
|
||||||
|
|
||||||
if (mIsLongpressEnabled) {
|
if (mIsLongpressEnabled) {
|
||||||
mHandler.removeMessages(LONG_PRESS);
|
mHandler.removeMessages(LONG_PRESS);
|
||||||
mHandler.sendMessageAtTime(
|
mHandler.sendMessageAtTime(mHandler.obtainMessage(LONG_PRESS, 0, 0), mCurrentDownEvent.getDownTime() + ViewConfiguration.getLongPressTimeout());
|
||||||
mHandler.obtainMessage(LONG_PRESS, 0, 0), mCurrentDownEvent.getDownTime()
|
|
||||||
+ ViewConfiguration.getLongPressTimeout());
|
|
||||||
}
|
}
|
||||||
mHandler.sendEmptyMessageAtTime(SHOW_PRESS,
|
mHandler.sendEmptyMessageAtTime(SHOW_PRESS, mCurrentDownEvent.getDownTime() + TAP_TIMEOUT);
|
||||||
mCurrentDownEvent.getDownTime() + TAP_TIMEOUT);
|
|
||||||
handled |= mListener.onDown(ev);
|
handled |= mListener.onDown(ev);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -472,8 +369,7 @@ public class GestureDetector2 {
|
||||||
final float velocityY = velocityTracker.getYVelocity(pointerId);
|
final float velocityY = velocityTracker.getYVelocity(pointerId);
|
||||||
final float velocityX = velocityTracker.getXVelocity(pointerId);
|
final float velocityX = velocityTracker.getXVelocity(pointerId);
|
||||||
|
|
||||||
if ((Math.abs(velocityY) > mMinimumFlingVelocity)
|
if ((Math.abs(velocityY) > mMinimumFlingVelocity) || (Math.abs(velocityX) > mMinimumFlingVelocity)) {
|
||||||
|| (Math.abs(velocityX) > mMinimumFlingVelocity)) {
|
|
||||||
handled = mListener.onFling(mCurrentDownEvent, ev, velocityX, velocityY);
|
handled = mListener.onFling(mCurrentDownEvent, ev, velocityX, velocityY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -534,7 +430,7 @@ public class GestureDetector2 {
|
||||||
}
|
}
|
||||||
|
|
||||||
final long deltaTime = secondDown.getEventTime() - firstUp.getEventTime();
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -556,11 +556,13 @@ public class SharedMediaLayout extends FrameLayout implements NotificationCenter
|
||||||
messagesDict[0].remove(oldMid);
|
messagesDict[0].remove(oldMid);
|
||||||
messagesDict[0].put(newMid, obj);
|
messagesDict[0].put(newMid, obj);
|
||||||
obj.messageOwner.id = newMid;
|
obj.messageOwner.id = newMid;
|
||||||
|
max_id[0] = Math.min(newMid, max_id[0]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private SharedMediaData[] sharedMediaData = new SharedMediaData[5];
|
private SharedMediaData[] sharedMediaData = new SharedMediaData[5];
|
||||||
|
private SharedMediaPreloader sharedMediaPreloader;
|
||||||
|
|
||||||
private final static int forward = 100;
|
private final static int forward = 100;
|
||||||
private final static int delete = 101;
|
private final static int delete = 101;
|
||||||
|
@ -577,9 +579,11 @@ public class SharedMediaLayout extends FrameLayout implements NotificationCenter
|
||||||
|
|
||||||
private boolean isActionModeShowed;
|
private boolean isActionModeShowed;
|
||||||
|
|
||||||
public SharedMediaLayout(Context context, long did, int[] mediaCount, SharedMediaData[] mediaData, int commonGroupsCount, ArrayList<Integer> sortedUsers, TLRPC.ChatFull chatInfo, ProfileActivity parent) {
|
public SharedMediaLayout(Context context, long did, SharedMediaPreloader preloader, int commonGroupsCount, ArrayList<Integer> sortedUsers, TLRPC.ChatFull chatInfo, ProfileActivity parent) {
|
||||||
super(context);
|
super(context);
|
||||||
|
|
||||||
|
sharedMediaPreloader = preloader;
|
||||||
|
int[] mediaCount = preloader.getLastMediaCount();
|
||||||
hasMedia = new int[]{mediaCount[0], mediaCount[1], mediaCount[2], mediaCount[3], mediaCount[4], commonGroupsCount};
|
hasMedia = new int[]{mediaCount[0], mediaCount[1], mediaCount[2], mediaCount[3], mediaCount[4], commonGroupsCount};
|
||||||
if (chatInfo != null) {
|
if (chatInfo != null) {
|
||||||
initialTab = 6;
|
initialTab = 6;
|
||||||
|
@ -599,19 +603,7 @@ public class SharedMediaLayout extends FrameLayout implements NotificationCenter
|
||||||
for (int a = 0; a < sharedMediaData.length; a++) {
|
for (int a = 0; a < sharedMediaData.length; a++) {
|
||||||
sharedMediaData[a] = new SharedMediaData();
|
sharedMediaData[a] = new SharedMediaData();
|
||||||
sharedMediaData[a].max_id[0] = ((int) dialog_id) == 0 ? Integer.MIN_VALUE : Integer.MAX_VALUE;
|
sharedMediaData[a].max_id[0] = ((int) dialog_id) == 0 ? Integer.MIN_VALUE : Integer.MAX_VALUE;
|
||||||
if (mediaData != null) {
|
fillMediaData(a);
|
||||||
sharedMediaData[a].totalCount = mediaData[a].totalCount;
|
|
||||||
sharedMediaData[a].messages.addAll(mediaData[a].messages);
|
|
||||||
sharedMediaData[a].sections.addAll(mediaData[a].sections);
|
|
||||||
for (HashMap.Entry<String, ArrayList<MessageObject>> entry : mediaData[a].sectionArrays.entrySet()) {
|
|
||||||
sharedMediaData[a].sectionArrays.put(entry.getKey(), new ArrayList<>(entry.getValue()));
|
|
||||||
}
|
|
||||||
for (int i = 0; i < 2; i++) {
|
|
||||||
sharedMediaData[a].messagesDict[i] = mediaData[a].messagesDict[i].clone();
|
|
||||||
sharedMediaData[a].max_id[i] = mediaData[a].max_id[i];
|
|
||||||
sharedMediaData[a].endReached[i] = mediaData[a].endReached[i];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (mergeDialogId != 0 && info != null) {
|
if (mergeDialogId != 0 && info != null) {
|
||||||
sharedMediaData[a].max_id[1] = info.migrated_from_max_id;
|
sharedMediaData[a].max_id[1] = info.migrated_from_max_id;
|
||||||
sharedMediaData[a].endReached[1] = false;
|
sharedMediaData[a].endReached[1] = false;
|
||||||
|
@ -966,7 +958,7 @@ public class SharedMediaLayout extends FrameLayout implements NotificationCenter
|
||||||
@Override
|
@Override
|
||||||
public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
|
public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
|
||||||
checkLoadMoreScroll(mediaPage, recyclerView, layoutManager);
|
checkLoadMoreScroll(mediaPage, recyclerView, layoutManager);
|
||||||
if (dy != 0 && mediaPages[0].selectedType == 0 && !mediaData[0].messages.isEmpty()) {
|
if (dy != 0 && mediaPages[0].selectedType == 0 && !sharedMediaData[0].messages.isEmpty()) {
|
||||||
showFloatingDateView();
|
showFloatingDateView();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1069,6 +1061,25 @@ public class SharedMediaLayout extends FrameLayout implements NotificationCenter
|
||||||
switchToCurrentSelectedMode(false);
|
switchToCurrentSelectedMode(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean fillMediaData(int type) {
|
||||||
|
SharedMediaData[] mediaData = sharedMediaPreloader.getSharedMediaData();
|
||||||
|
if (mediaData == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
sharedMediaData[type].totalCount = mediaData[type].totalCount;
|
||||||
|
sharedMediaData[type].messages.addAll(mediaData[type].messages);
|
||||||
|
sharedMediaData[type].sections.addAll(mediaData[type].sections);
|
||||||
|
for (HashMap.Entry<String, ArrayList<MessageObject>> entry : mediaData[type].sectionArrays.entrySet()) {
|
||||||
|
sharedMediaData[type].sectionArrays.put(entry.getKey(), new ArrayList<>(entry.getValue()));
|
||||||
|
}
|
||||||
|
for (int i = 0; i < 2; i++) {
|
||||||
|
sharedMediaData[type].messagesDict[i] = mediaData[type].messagesDict[i].clone();
|
||||||
|
sharedMediaData[type].max_id[i] = mediaData[type].max_id[i];
|
||||||
|
sharedMediaData[type].endReached[i] = mediaData[type].endReached[i];
|
||||||
|
}
|
||||||
|
return !mediaData[type].messages.isEmpty();
|
||||||
|
}
|
||||||
|
|
||||||
private void showFloatingDateView() {
|
private void showFloatingDateView() {
|
||||||
AndroidUtilities.cancelRunOnUIThread(hideFloatingDateRunnable);
|
AndroidUtilities.cancelRunOnUIThread(hideFloatingDateRunnable);
|
||||||
AndroidUtilities.runOnUIThread(hideFloatingDateRunnable, 650);
|
AndroidUtilities.runOnUIThread(hideFloatingDateRunnable, 650);
|
||||||
|
@ -1709,8 +1720,8 @@ public class SharedMediaLayout extends FrameLayout implements NotificationCenter
|
||||||
if (id == NotificationCenter.mediaDidLoad) {
|
if (id == NotificationCenter.mediaDidLoad) {
|
||||||
long uid = (Long) args[0];
|
long uid = (Long) args[0];
|
||||||
int guid = (Integer) args[3];
|
int guid = (Integer) args[3];
|
||||||
if (guid == profileActivity.getClassGuid()) {
|
|
||||||
int type = (Integer) args[4];
|
int type = (Integer) args[4];
|
||||||
|
if (guid == profileActivity.getClassGuid()) {
|
||||||
sharedMediaData[type].loading = false;
|
sharedMediaData[type].loading = false;
|
||||||
sharedMediaData[type].totalCount = (Integer) args[1];
|
sharedMediaData[type].totalCount = (Integer) args[1];
|
||||||
ArrayList<MessageObject> arr = (ArrayList<MessageObject>) args[2];
|
ArrayList<MessageObject> arr = (ArrayList<MessageObject>) args[2];
|
||||||
|
@ -1790,6 +1801,44 @@ public class SharedMediaLayout extends FrameLayout implements NotificationCenter
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else if (sharedMediaPreloader != null && sharedMediaData[type].messages.isEmpty()) {
|
||||||
|
if (fillMediaData(type)) {
|
||||||
|
RecyclerListView.Adapter adapter = null;
|
||||||
|
if (type == 0) {
|
||||||
|
adapter = photoVideoAdapter;
|
||||||
|
} else if (type == 1) {
|
||||||
|
adapter = documentsAdapter;
|
||||||
|
} else if (type == 2) {
|
||||||
|
adapter = voiceAdapter;
|
||||||
|
} else if (type == 3) {
|
||||||
|
adapter = linksAdapter;
|
||||||
|
} else if (type == 4) {
|
||||||
|
adapter = audioAdapter;
|
||||||
|
}
|
||||||
|
if (adapter != null) {
|
||||||
|
for (int a = 0; a < mediaPages.length; a++) {
|
||||||
|
if (mediaPages[a].listView.getAdapter() == adapter) {
|
||||||
|
mediaPages[a].listView.stopScroll();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
adapter.notifyDataSetChanged();
|
||||||
|
}
|
||||||
|
scrolling = true;
|
||||||
|
for (int a = 0; a < mediaPages.length; a++) {
|
||||||
|
if (mediaPages[a].selectedType == type) {
|
||||||
|
if (!sharedMediaData[type].loading) {
|
||||||
|
if (mediaPages[a].progressView != null) {
|
||||||
|
mediaPages[a].progressView.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
if (mediaPages[a].listView != null) {
|
||||||
|
if (mediaPages[a].listView.getEmptyView() == null) {
|
||||||
|
mediaPages[a].listView.setEmptyView(mediaPages[a].emptyView);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else if (id == NotificationCenter.messagesDeleted) {
|
} else if (id == NotificationCenter.messagesDeleted) {
|
||||||
boolean scheduled = (Boolean) args[2];
|
boolean scheduled = (Boolean) args[2];
|
||||||
|
@ -2589,7 +2638,7 @@ public class SharedMediaLayout extends FrameLayout implements NotificationCenter
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isEnabled(int section, int row) {
|
public boolean isEnabled(int section, int row) {
|
||||||
return row != 0;
|
return section == 0 || row != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -2707,7 +2756,7 @@ public class SharedMediaLayout extends FrameLayout implements NotificationCenter
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isEnabled(int section, int row) {
|
public boolean isEnabled(int section, int row) {
|
||||||
return row != 0;
|
return section == 0 || row != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -520,18 +520,24 @@ public class PeopleNearbyActivity extends BaseFragment implements NotificationCe
|
||||||
showProgressRunnable = null;
|
showProgressRunnable = null;
|
||||||
}
|
}
|
||||||
showLoadingProgress(false);
|
showLoadingProgress(false);
|
||||||
|
boolean saveConfig = false;
|
||||||
|
UserConfig userConfig = getUserConfig();
|
||||||
|
if (share == 1 && error != null) {
|
||||||
|
userConfig.sharingMyLocationUntil = 0;
|
||||||
|
saveConfig = true;
|
||||||
|
updateRows();
|
||||||
|
}
|
||||||
if (response != null && share != 2) {
|
if (response != null && share != 2) {
|
||||||
TLRPC.Updates updates = (TLRPC.TL_updates) response;
|
TLRPC.Updates updates = (TLRPC.TL_updates) response;
|
||||||
getMessagesController().putUsers(updates.users, false);
|
getMessagesController().putUsers(updates.users, false);
|
||||||
getMessagesController().putChats(updates.chats, false);
|
getMessagesController().putChats(updates.chats, false);
|
||||||
users.clear();
|
users.clear();
|
||||||
chats.clear();
|
chats.clear();
|
||||||
UserConfig userConfig = getUserConfig();
|
|
||||||
boolean saveConfig = false;
|
|
||||||
if (userConfig.sharingMyLocationUntil != 0) {
|
if (userConfig.sharingMyLocationUntil != 0) {
|
||||||
userConfig.lastMyLocationShareTime = (int) (System.currentTimeMillis() / 1000);
|
userConfig.lastMyLocationShareTime = (int) (System.currentTimeMillis() / 1000);
|
||||||
saveConfig = true;
|
saveConfig = true;
|
||||||
}
|
}
|
||||||
|
boolean hasSelf = false;
|
||||||
for (int a = 0, N = updates.updates.size(); a < N; a++) {
|
for (int a = 0, N = updates.updates.size(); a < N; a++) {
|
||||||
TLRPC.Update baseUpdate = updates.updates.get(a);
|
TLRPC.Update baseUpdate = updates.updates.get(a);
|
||||||
if (baseUpdate instanceof TLRPC.TL_updatePeerLocated) {
|
if (baseUpdate instanceof TLRPC.TL_updatePeerLocated) {
|
||||||
|
@ -546,6 +552,7 @@ public class PeopleNearbyActivity extends BaseFragment implements NotificationCe
|
||||||
chats.add(peerLocated);
|
chats.add(peerLocated);
|
||||||
}
|
}
|
||||||
} else if (object instanceof TLRPC.TL_peerSelfLocated) {
|
} else if (object instanceof TLRPC.TL_peerSelfLocated) {
|
||||||
|
hasSelf = true;
|
||||||
TLRPC.TL_peerSelfLocated peerSelfLocated = (TLRPC.TL_peerSelfLocated) object;
|
TLRPC.TL_peerSelfLocated peerSelfLocated = (TLRPC.TL_peerSelfLocated) object;
|
||||||
if (userConfig.sharingMyLocationUntil != peerSelfLocated.expires) {
|
if (userConfig.sharingMyLocationUntil != peerSelfLocated.expires) {
|
||||||
userConfig.sharingMyLocationUntil = peerSelfLocated.expires;
|
userConfig.sharingMyLocationUntil = peerSelfLocated.expires;
|
||||||
|
@ -555,12 +562,17 @@ public class PeopleNearbyActivity extends BaseFragment implements NotificationCe
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (saveConfig) {
|
if (!hasSelf && userConfig.sharingMyLocationUntil != 0) {
|
||||||
userConfig.saveConfig(false);
|
userConfig.sharingMyLocationUntil = 0;
|
||||||
|
saveConfig = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
checkForExpiredLocations(true);
|
checkForExpiredLocations(true);
|
||||||
updateRows();
|
updateRows();
|
||||||
}
|
}
|
||||||
|
if (saveConfig) {
|
||||||
|
userConfig.saveConfig(false);
|
||||||
|
}
|
||||||
if (shortPollRunnable != null) {
|
if (shortPollRunnable != null) {
|
||||||
AndroidUtilities.cancelRunOnUIThread(shortPollRunnable);
|
AndroidUtilities.cancelRunOnUIThread(shortPollRunnable);
|
||||||
AndroidUtilities.runOnUIThread(shortPollRunnable, SHORT_POLL_TIMEOUT);
|
AndroidUtilities.runOnUIThread(shortPollRunnable, SHORT_POLL_TIMEOUT);
|
||||||
|
|
|
@ -74,6 +74,7 @@ import android.view.Surface;
|
||||||
import android.view.TextureView;
|
import android.view.TextureView;
|
||||||
import android.view.VelocityTracker;
|
import android.view.VelocityTracker;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
import android.view.ViewConfiguration;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.view.ViewTreeObserver;
|
import android.view.ViewTreeObserver;
|
||||||
import android.view.WindowInsets;
|
import android.view.WindowInsets;
|
||||||
|
@ -250,9 +251,12 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
|
||||||
private ImageReceiver sideImage;
|
private ImageReceiver sideImage;
|
||||||
private boolean isCurrentVideo;
|
private boolean isCurrentVideo;
|
||||||
|
|
||||||
|
private long lastPhotoSetTime;
|
||||||
|
|
||||||
private GradientDrawable[] pressedDrawable = new GradientDrawable[2];
|
private GradientDrawable[] pressedDrawable = new GradientDrawable[2];
|
||||||
private boolean[] drawPressedDrawable = new boolean[2];
|
private boolean[] drawPressedDrawable = new boolean[2];
|
||||||
private float[] pressedDrawableAlpha = new float[2];
|
private float[] pressedDrawableAlpha = new float[2];
|
||||||
|
private int touchSlop;
|
||||||
|
|
||||||
private boolean useSmoothKeyboard;
|
private boolean useSmoothKeyboard;
|
||||||
|
|
||||||
|
@ -1898,6 +1902,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
|
||||||
}
|
}
|
||||||
parentActivity = activity;
|
parentActivity = activity;
|
||||||
actvityContext = new ContextThemeWrapper(parentActivity, R.style.Theme_TMessages);
|
actvityContext = new ContextThemeWrapper(parentActivity, R.style.Theme_TMessages);
|
||||||
|
touchSlop = ViewConfiguration.get(parentActivity).getScaledTouchSlop();
|
||||||
|
|
||||||
if (progressDrawables == null) {
|
if (progressDrawables == null) {
|
||||||
progressDrawables = new Drawable[4];
|
progressDrawables = new Drawable[4];
|
||||||
|
@ -6316,6 +6321,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
|
||||||
currentFileNames[1] = getFileName(index + 1);
|
currentFileNames[1] = getFileName(index + 1);
|
||||||
currentFileNames[2] = getFileName(index - 1);
|
currentFileNames[2] = getFileName(index - 1);
|
||||||
placeProvider.willSwitchFromPhoto(currentMessageObject, getFileLocation(currentFileLocation), currentIndex);
|
placeProvider.willSwitchFromPhoto(currentMessageObject, getFileLocation(currentFileLocation), currentIndex);
|
||||||
|
lastPhotoSetTime = SystemClock.elapsedRealtime();
|
||||||
|
|
||||||
int prevIndex = currentIndex;
|
int prevIndex = currentIndex;
|
||||||
currentIndex = index;
|
currentIndex = index;
|
||||||
|
@ -8153,7 +8159,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
|
||||||
}
|
}
|
||||||
float dx = Math.abs(ev.getX() - moveStartX);
|
float dx = Math.abs(ev.getX() - moveStartX);
|
||||||
float dy = Math.abs(ev.getY() - dragY);
|
float dy = Math.abs(ev.getY() - dragY);
|
||||||
if (dx > AndroidUtilities.dp(3) || dy > AndroidUtilities.dp(3)) {
|
if (dx > touchSlop || dy > touchSlop) {
|
||||||
discardTap = true;
|
discardTap = true;
|
||||||
hidePressedDrawables();
|
hidePressedDrawables();
|
||||||
if (qualityChooseView != null && qualityChooseView.getVisibility() == View.VISIBLE) {
|
if (qualityChooseView != null && qualityChooseView.getVisibility() == View.VISIBLE) {
|
||||||
|
@ -8806,7 +8812,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
|
||||||
public boolean onDown(MotionEvent e) {
|
public boolean onDown(MotionEvent e) {
|
||||||
if (!doubleTap && 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() / 6;
|
||||||
if (x < side) {
|
if (x < side) {
|
||||||
if (leftImage.hasImageSet()) {
|
if (leftImage.hasImageSet()) {
|
||||||
drawPressedDrawable[0] = true;
|
drawPressedDrawable[0] = true;
|
||||||
|
@ -8823,15 +8829,15 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getDoubleTapTimeout(MotionEvent e) {
|
public boolean canDoubleTap(MotionEvent e) {
|
||||||
if (checkImageView.getVisibility() != View.VISIBLE && !drawPressedDrawable[0] && !drawPressedDrawable[1]) {
|
if (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() / 6;
|
||||||
if (x < side || x > containerView.getMeasuredWidth() - side) {
|
if (x < side || x > containerView.getMeasuredWidth() - side) {
|
||||||
return 200;
|
return currentMessageObject == null || currentMessageObject.isVideo() && (SystemClock.elapsedRealtime() - lastPhotoSetTime) >= 500;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return GestureDetector2.DOUBLE_TAP_TIMEOUT;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void hidePressedDrawables() {
|
private void hidePressedDrawables() {
|
||||||
|
@ -8884,7 +8890,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
|
||||||
}
|
}
|
||||||
float x = e.getX();
|
float x = e.getX();
|
||||||
if (checkImageView.getVisibility() != View.VISIBLE) {
|
if (checkImageView.getVisibility() != View.VISIBLE) {
|
||||||
int side = containerView.getMeasuredWidth() / 5;
|
int side = containerView.getMeasuredWidth() / 6;
|
||||||
if (x < side) {
|
if (x < side) {
|
||||||
if (leftImage.hasImageSet()) {
|
if (leftImage.hasImageSet()) {
|
||||||
switchToNextIndex(-1, true);
|
switchToNextIndex(-1, true);
|
||||||
|
|
|
@ -1314,7 +1314,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
|
||||||
}
|
}
|
||||||
ArrayList<Integer> users = chatInfo != null && chatInfo.participants != null && chatInfo.participants.participants.size() > 5 ? sortedUsers : null;
|
ArrayList<Integer> users = chatInfo != null && chatInfo.participants != null && chatInfo.participants.participants.size() > 5 ? sortedUsers : null;
|
||||||
TLRPC.ChatFull chatFull = users != null ? chatInfo : null;
|
TLRPC.ChatFull chatFull = users != null ? chatInfo : null;
|
||||||
sharedMediaLayout = new SharedMediaLayout(context, did, sharedMediaPreloader.getLastMediaCount(), sharedMediaPreloader.getSharedMediaData(), userInfo != null ? userInfo.common_chats_count : 0, sortedUsers, chatFull, this) {
|
sharedMediaLayout = new SharedMediaLayout(context, did, sharedMediaPreloader, userInfo != null ? userInfo.common_chats_count : 0, sortedUsers, chatFull, this) {
|
||||||
@Override
|
@Override
|
||||||
protected void onSelectedTabChanged() {
|
protected void onSelectedTabChanged() {
|
||||||
updateSelectedMediaTabText();
|
updateSelectedMediaTabText();
|
||||||
|
@ -1512,6 +1512,11 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
|
||||||
|
|
||||||
private VelocityTracker velocityTracker;
|
private VelocityTracker velocityTracker;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean allowSelectChildAtPosition(View child) {
|
||||||
|
return child != sharedMediaLayout;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasOverlappingRendering() {
|
public boolean hasOverlappingRendering() {
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in a new issue