Update to 8.7.2

This commit is contained in:
xaxtix 2022-04-23 12:51:09 +03:00
parent 8309ac8d7c
commit 8283c12364
17 changed files with 233 additions and 98 deletions

View file

@ -300,7 +300,7 @@ android {
}
}
defaultConfig.versionCode = 2629
defaultConfig.versionCode = 2634
applicationVariants.all { variant ->
variant.outputs.all { output ->
@ -319,7 +319,7 @@ android {
defaultConfig {
minSdkVersion 16
targetSdkVersion 30
versionName "8.7.1"
versionName "8.7.2"
vectorDrawables.generatedDensities = ['mdpi', 'hdpi', 'xhdpi', 'xxhdpi']

View file

@ -25,6 +25,7 @@
#include "tgcalls/VideoCaptureInterface.h"
#include "tgcalls/v2/InstanceV2Impl.h"
#include "tgcalls/v2_4_0_0/InstanceV2_4_0_0Impl.h"
#include "tgcalls/v2/InstanceV2ReferenceImpl.h"
using namespace tgcalls;
@ -32,6 +33,7 @@ const auto RegisterTag = Register<InstanceImpl>();
const auto RegisterTagLegacy = Register<InstanceImplLegacy>();
const auto RegisterTagV2_4_0_0 = Register<InstanceV2_4_0_0Impl>();
const auto RegisterTagV2_4_0_1 = Register<InstanceV2Impl>();
const auto RegisterTagV2_4_1_2 = Register<InstanceV2ReferenceImpl>();
jclass TrafficStatsClass;
jclass FingerprintClass;

View file

@ -20,8 +20,8 @@ public class BuildVars {
public static boolean USE_CLOUD_STRINGS = true;
public static boolean CHECK_UPDATES = true;
public static boolean NO_SCOPED_STORAGE = Build.VERSION.SDK_INT <= 29;
public static int BUILD_VERSION = 2629;
public static String BUILD_VERSION_STRING = "8.7.1";
public static int BUILD_VERSION = 2634;
public static String BUILD_VERSION_STRING = "8.7.2";
public static int APP_ID = 4;
public static String APP_HASH = "014b35b6184100b085b0d0572f9b5103";

View file

@ -12582,7 +12582,7 @@ public class MessagesStorage extends BaseController {
state.dispose();
if (count == 0) {
state = database.executeFast("UPDATE reaction_mentions SET state = 0 WHERE dialog_id ?");
state = database.executeFast("UPDATE reaction_mentions SET state = 0 WHERE dialog_id = ?");
state.bindLong(1, dialogId);
state.step();
state.dispose();

View file

@ -15,7 +15,7 @@ import java.util.List;
public final class Instance {
public static final List<String> AVAILABLE_VERSIONS = Build.VERSION.SDK_INT >= 18 ? Arrays.asList("4.0.1", "4.0.0", "3.0.0", "2.7.7", "2.4.4") : Arrays.asList("2.4.4");
public static final List<String> AVAILABLE_VERSIONS = Build.VERSION.SDK_INT >= 18 ? Arrays.asList("4.1.2", "4.0.2", "4.0.1", "4.0.0", "3.0.0", "2.7.7", "2.4.4") : Arrays.asList("2.4.4");
public static final int AUDIO_STATE_MUTED = 0;
public static final int AUDIO_STATE_ACTIVE = 1;

View file

@ -312,9 +312,7 @@ public class CalendarActivity extends BaseFragment {
@Override
public void run(boolean forAll) {
finishFragment();
if (parentLayout == null) {
return;
}
if (parentLayout.fragmentsStack.size() >= 2) {
BaseFragment fragment = parentLayout.fragmentsStack.get(parentLayout.fragmentsStack.size() - 2);
if (fragment instanceof ChatActivity) {

View file

@ -10872,12 +10872,19 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
replyTextWidth = AndroidUtilities.dp(4 + (needReplyImage ? 44 : 0));
if (stringFinalText != null) {
SpannableStringBuilder sb = new SpannableStringBuilder(stringFinalText);
boolean changed = false;
for (TextStyleSpan span : sb.getSpans(0, sb.length(), TextStyleSpan.class)) {
if ((span.getTextStyleRun().flags & TextStyleSpan.FLAG_STYLE_MONO) != 0) {
changed = true;
sb.removeSpan(span);
}
}
replyTextLayout = new StaticLayout(sb, Theme.chat_replyTextPaint, maxWidth + AndroidUtilities.dp(10), Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false);
if (changed) {
stringFinalText = TextUtils.ellipsize(sb, Theme.chat_replyTextPaint, maxWidth, TextUtils.TruncateAt.END);
} else {
stringFinalText = sb;
}
replyTextLayout = new StaticLayout(stringFinalText, Theme.chat_replyTextPaint, maxWidth + AndroidUtilities.dp(10), Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false);
if (replyTextLayout.getLineCount() > 0) {
replyTextWidth += (int) Math.ceil(replyTextLayout.getLineWidth(0)) + AndroidUtilities.dp(8);
replyTextOffset = (int) replyTextLayout.getLineLeft(0);

View file

@ -201,6 +201,7 @@ public class ChatRightsEditActivity extends BaseFragment {
adminRights.ban_users = myAdminRights.ban_users;
adminRights.invite_users = myAdminRights.invite_users;
adminRights.pin_messages = myAdminRights.pin_messages;
adminRights.other = myAdminRights.other;
initialIsSet = false;
}
} else {
@ -216,10 +217,11 @@ public class ChatRightsEditActivity extends BaseFragment {
adminRights.pin_messages = rightsAdmin.pin_messages;
adminRights.add_admins = rightsAdmin.add_admins;
adminRights.anonymous = rightsAdmin.anonymous;
adminRights.other = rightsAdmin.other;
initialIsSet = adminRights.change_info || adminRights.post_messages || adminRights.edit_messages ||
adminRights.delete_messages || adminRights.ban_users || adminRights.invite_users ||
adminRights.pin_messages || adminRights.add_admins || adminRights.manage_call || adminRights.anonymous;
adminRights.pin_messages || adminRights.add_admins || adminRights.manage_call || adminRights.anonymous || adminRights.other;
if (type == TYPE_ADD_BOT) {
asAdmin = isChannel || initialIsSet;

View file

@ -3061,6 +3061,11 @@ public class AlertsCreator {
int[] values = new int[]{
0,
30,
60,
60 * 2,
60 * 3,
60 * 8,
60 * 24,
2 * 60 * 24,
3 * 60 * 24,
@ -3084,14 +3089,18 @@ public class AlertsCreator {
protected CharSequence getContentDescription(int index) {
if (values[index] == 0) {
return LocaleController.getString("MuteNever", R.string.MuteNever);
} else if (values[index] < 60) {
return LocaleController.formatPluralString("Minutes", values[index]);
} else if (values[index] < 60 * 24) {
return LocaleController.formatPluralString("Hours", values[index] / 60);
} else if (values[index] < 7 * 60 * 24) {
return LocaleController.formatPluralString("Days", values[index] / (60 * 24));
} else if (values[index] < 31 * 60 * 24) {
return LocaleController.formatPluralString("Weeks", values[index] / (60 * 24));
return LocaleController.formatPluralString("Weeks", values[index] / (7 * 60 * 24));
} else if (values[index] < 365 * 60 * 24) {
return LocaleController.formatPluralString("Months", values[index] / (7 * 60 * 24));
return LocaleController.formatPluralString("Months", values[index] / (31 * 60 * 24));
} else {
return LocaleController.formatPluralString("Years", values[index] * 5 / 31 * 60 * 24);
return LocaleController.formatPluralString("Years", values[index] / (365 * 60 * 24));
}
}
};
@ -3102,6 +3111,10 @@ public class AlertsCreator {
numberPicker.setFormatter(index -> {
if (values[index] == 0) {
return LocaleController.getString("MuteNever", R.string.MuteNever);
} else if (values[index] < 60) {
return LocaleController.formatPluralString("Minutes", values[index]);
} else if (values[index] < 60 * 24) {
return LocaleController.formatPluralString("Hours", values[index] / 60);
} else if (values[index] < 7 * 60 * 24) {
return LocaleController.formatPluralString("Days", values[index] / (60 * 24));
} else if (values[index] < 31 * 60 * 24) {

View file

@ -108,6 +108,8 @@ public class BotWebViewContainer extends FrameLayout implements NotificationCent
private Activity parentActivity;
private boolean isViewPortByMeasureSuppressed;
public BotWebViewContainer(@NonNull Context context, Theme.ResourcesProvider resourcesProvider, int backgroundColor) {
super(context);
this.resourcesProvider = resourcesProvider;
@ -165,6 +167,10 @@ public class BotWebViewContainer extends FrameLayout implements NotificationCent
setFocusable(false);
}
public void setViewPortByMeasureSuppressed(boolean viewPortByMeasureSuppressed) {
isViewPortByMeasureSuppressed = viewPortByMeasureSuppressed;
}
private void checkCreateWebView() {
if (webView == null && !webViewNotAvailable) {
try {
@ -571,8 +577,10 @@ public class BotWebViewContainer extends FrameLayout implements NotificationCent
@Override
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
super.onSizeChanged(w, h, oldw, oldh);
if (!isViewPortByMeasureSuppressed) {
invalidateViewPortHeight(true);
}
}
public void invalidateViewPortHeight() {
invalidateViewPortHeight(false);

View file

@ -3487,6 +3487,10 @@ public class ChatActivityEnterView extends BlurredFrameLayout implements Notific
}
}
public void forceSmoothKeyboard(boolean smoothKeyboard) {
this.smoothKeyboard = smoothKeyboard && SharedConfig.smoothKeyboard && !AndroidUtilities.isInMultiwindow && (parentFragment == null || !parentFragment.isInBubbleMode());
}
protected void onLineCountChanged(int oldLineCount, int newLineCount) {
}

View file

@ -136,6 +136,8 @@ public class ChatAttachAlert extends BottomSheet implements NotificationCenter.N
ChatAttachAlertBotWebViewLayout webViewLayout = new ChatAttachAlertBotWebViewLayout(this, getContext(), resourcesProvider);
botAttachLayouts.put(id, webViewLayout);
botAttachLayouts.get(id).setDelegate(new BotWebViewContainer.Delegate() {
private ValueAnimator botButtonAnimator;
@Override
public void onCloseRequested(Runnable callback) {
if (currentAttachLayout != webViewLayout) {
@ -173,8 +175,13 @@ public class ChatAttachAlert extends BottomSheet implements NotificationCenter.N
botMainButtonTextView.setTextColor(textColor);
botMainButtonTextView.setBackground(BotWebViewContainer.getMainButtonRippleDrawable(color));
if (botButtonWasVisible != isVisible) {
ValueAnimator animator = ValueAnimator.ofFloat(isVisible ? 0 : 1, isVisible ? 1 : 0).setDuration(250);
animator.addUpdateListener(animation -> {
botButtonWasVisible = isVisible;
if (botButtonAnimator != null) {
botButtonAnimator.cancel();
}
botButtonAnimator = ValueAnimator.ofFloat(isVisible ? 0 : 1, isVisible ? 1 : 0).setDuration(250);
botButtonAnimator.addUpdateListener(animation -> {
float value = (float) animation.getAnimatedValue();
buttonsRecyclerView.setAlpha(1f - value);
botMainButtonTextView.setAlpha(value);
@ -182,7 +189,7 @@ public class ChatAttachAlert extends BottomSheet implements NotificationCenter.N
shadow.setTranslationY(botMainButtonOffsetY);
buttonsRecyclerView.setTranslationY(botMainButtonOffsetY);
});
animator.addListener(new AnimatorListenerAdapter() {
botButtonAnimator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationStart(Animator animation) {
if (isVisible) {
@ -201,7 +208,6 @@ public class ChatAttachAlert extends BottomSheet implements NotificationCenter.N
@Override
public void onAnimationEnd(Animator animation) {
botButtonWasVisible = isVisible;
if (!isVisible) {
botMainButtonTextView.setVisibility(View.GONE);
} else {
@ -212,9 +218,13 @@ public class ChatAttachAlert extends BottomSheet implements NotificationCenter.N
for (int i = 0; i < botAttachLayouts.size(); i++) {
botAttachLayouts.valueAt(i).setMeasureOffsetY(offsetY);
}
if (botButtonAnimator == animation) {
botButtonAnimator = null;
}
}
});
animator.start();
botButtonAnimator.start();
}
botProgressView.setProgressColor(textColor);
if (botButtonProgressWasVisible != isProgressVisible) {

View file

@ -217,10 +217,21 @@ public class ChatAttachAlertBotWebViewLayout extends ChatAttachAlert.AttachAlert
return;
}
webViewContainer.setViewPortByMeasureSuppressed(true);
boolean doNotScroll = false;
float openOffset = -swipeContainer.getOffsetY() + swipeContainer.getTopActionBarOffsetY();
if (swipeContainer.getSwipeOffsetY() != openOffset) {
swipeContainer.stickTo(openOffset);
doNotScroll = true;
}
int oldh = contentHeight + parentAlert.sizeNotifierFrameLayout.measureKeyboardHeight();
setMeasuredDimension(getMeasuredWidth(), contentHeight);
ignoreMeasure = true;
swipeContainer.setSwipeOffsetAnimationDisallowed(true);
if (!doNotScroll) {
if (webViewScrollAnimator != null) {
webViewScrollAnimator.cancel();
webViewScrollAnimator = null;
@ -251,10 +262,13 @@ public class ChatAttachAlertBotWebViewLayout extends ChatAttachAlert.AttachAlert
webViewScrollAnimator.start();
}
}
}
@Override
public void onPanTransitionEnd() {
ignoreMeasure = false;
swipeContainer.setSwipeOffsetAnimationDisallowed(false);
webViewContainer.setViewPortByMeasureSuppressed(false);
requestLayout();
}
@ -443,7 +457,7 @@ public class ChatAttachAlertBotWebViewLayout extends ChatAttachAlert.AttachAlert
@Override
int getButtonsHideOffset() {
return AndroidUtilities.dp(56);
return (int) swipeContainer.getTopActionBarOffsetY() + AndroidUtilities.dp(12);
}
@Override
@ -510,9 +524,12 @@ public class ChatAttachAlertBotWebViewLayout extends ChatAttachAlert.AttachAlert
private float topActionBarOffsetY = ActionBar.getCurrentActionBarHeight();
private float offsetY = -1;
private float pendingOffsetY = -1;
private float swipeOffsetY;
private boolean isSwipeOffsetAnimationDisallowed;
private ValueAnimator offsetYAnimator;
private boolean flingInProgress;
private WebView webView;
@ -655,18 +672,43 @@ public class ChatAttachAlertBotWebViewLayout extends ChatAttachAlert.AttachAlert
float wasOffsetY = this.offsetY;
boolean wasOnTop = swipeOffsetY == -wasOffsetY + topActionBarOffsetY;
if (wasOffsetY != -1 && !isSwipeOffsetAnimationDisallowed) {
ValueAnimator animator = ValueAnimator.ofFloat(wasOffsetY, offsetY).setDuration(200);
animator.setInterpolator(CubicBezierInterpolator.DEFAULT);
animator.addUpdateListener(animation -> {
offsetYAnimator = ValueAnimator.ofFloat(wasOffsetY, offsetY).setDuration(200);
offsetYAnimator.setInterpolator(CubicBezierInterpolator.DEFAULT);
offsetYAnimator.addUpdateListener(animation -> {
this.offsetY = (float) animation.getAnimatedValue();
if (wasOnTop) {
swipeOffsetY = -this.offsetY + topActionBarOffsetY;
} else {
swipeOffsetY = MathUtils.clamp(swipeOffsetY, -this.offsetY + topActionBarOffsetY, getHeight() - this.offsetY + topActionBarOffsetY);
}
if (scrollAnimator != null && scrollAnimator.getSpring().getFinalPosition() == -wasOffsetY + topActionBarOffsetY) {
scrollAnimator.getSpring().setFinalPosition(-offsetY + topActionBarOffsetY);
}
invalidateTranslation();
});
animator.start();
offsetYAnimator.addListener(new AnimatorListenerAdapter() {
private boolean isCanceled;
@Override
public void onAnimationEnd(Animator animation) {
if (offsetYAnimator == animation) {
offsetYAnimator = null;
if (!isCanceled) {
WebViewSwipeContainer.this.offsetY = offsetY;
invalidateTranslation();
} else {
pendingOffsetY = offsetY;
}
}
}
@Override
public void onAnimationCancel(Animator animation) {
isCanceled = true;
}
});
offsetYAnimator.start();
} else {
this.offsetY = offsetY;
if (wasOnTop) {
@ -724,9 +766,13 @@ public class ChatAttachAlertBotWebViewLayout extends ChatAttachAlert.AttachAlert
flingInProgress = false;
} else {
if (swipeOffsetY <= -swipeStickyRange) {
if (swipeOffsetY != -offsetY + topActionBarOffsetY) {
stickTo(-offsetY + topActionBarOffsetY);
}
} else if (swipeOffsetY > -swipeStickyRange && swipeOffsetY <= swipeStickyRange) {
if (swipeOffsetY != 0) {
stickTo(0);
}
} else {
if (delegate != null) {
delegate.onDismiss();
@ -747,7 +793,7 @@ public class ChatAttachAlertBotWebViewLayout extends ChatAttachAlert.AttachAlert
}
public void stickTo(float offset, Runnable callback) {
if (swipeOffsetY == offset) {
if (swipeOffsetY == offset || scrollAnimator != null && scrollAnimator.getSpring().getFinalPosition() == offset) {
if (callback != null) {
callback.run();
}
@ -757,6 +803,9 @@ public class ChatAttachAlertBotWebViewLayout extends ChatAttachAlert.AttachAlert
return;
}
if (offsetYAnimator != null) {
offsetYAnimator.cancel();
}
if (scrollAnimator != null) {
scrollAnimator.cancel();
}
@ -775,6 +824,14 @@ public class ChatAttachAlertBotWebViewLayout extends ChatAttachAlert.AttachAlert
if (scrollEndListener != null) {
scrollEndListener.run();
}
if (pendingOffsetY != -1) {
boolean wasDisallowed = isSwipeOffsetAnimationDisallowed;
isSwipeOffsetAnimationDisallowed = true;
setOffsetY(pendingOffsetY);
pendingOffsetY = -1;
isSwipeOffsetAnimationDisallowed = wasDisallowed;
}
}
});
scrollAnimator.start();

View file

@ -40,6 +40,9 @@ public class ChatScrimPopupContainerLayout extends LinearLayout {
if (popupWindowLayout.getSwipeBack() != null) {
widthDiff = popupWindowLayout.getSwipeBack().getMeasuredWidth() - popupWindowLayout.getSwipeBack().getChildAt(0).getMeasuredWidth();
}
if (reactionsLayout.getLayoutParams().width != LayoutHelper.WRAP_CONTENT && reactionsLayout.getLayoutParams().width + widthDiff > getMeasuredWidth()) {
widthDiff = getMeasuredWidth() - reactionsLayout.getLayoutParams().width + AndroidUtilities.dp(8);
}
((LayoutParams) reactionsLayout.getLayoutParams()).rightMargin = widthDiff;
if (bottomView != null) {
if (popupWindowLayout.getSwipeBack() != null) {

View file

@ -303,6 +303,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
private RecyclerView sideMenu;
private ChatActivityEnterView commentView;
private View commentViewBg;
private final boolean commentViewAnimated = false;
private ImageView[] writeButton;
private FrameLayout writeButtonContainer;
private View selectedCountView;
@ -781,13 +782,6 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
} else {
h = heightSize - inputFieldHeight + AndroidUtilities.dp(2) - (onlySelect ? 0 : actionBar.getMeasuredHeight()) - topPadding;
}
int paddingBottom = 0;
if (keyboardSize > AndroidUtilities.dp(20)) {
h += (paddingBottom = inputFieldHeight + keyboardSize);
}
if (((ViewPage) child).listView != null) {
((ViewPage) child).listView.setPadding(0, 0, 0, paddingBottom);
}
if (filtersTabAnimator != null && filterTabsView != null && filterTabsView.getVisibility() == VISIBLE) {
h += filterTabsMoveFrom;
@ -822,39 +816,10 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
}
}
private int previousHeight = -1;
private AnimatorSet keyboardAnimator;
@Override
protected void onLayout(boolean changed, int l, int t, int r, int b) {
final int count = getChildCount();
int layoutHeight = b - t;
if (previousHeight != -1 && commentView != null) {
if (Math.abs(previousHeight - layoutHeight) > AndroidUtilities.dp(20)) {
if (keyboardAnimator != null) {
keyboardAnimator.cancel();
}
keyboardAnimator = new AnimatorSet();
ArrayList<Animator> animators = new ArrayList<>();
animators.add(ObjectAnimator.ofFloat(commentView, TRANSLATION_Y, previousHeight - layoutHeight, 0));
if (commentViewBg != null) {
animators.add(ObjectAnimator.ofFloat(commentViewBg, TRANSLATION_Y, previousHeight - layoutHeight, 0));
}
if (writeButtonContainer != null) {
animators.add(ObjectAnimator.ofFloat(writeButtonContainer, TRANSLATION_Y, previousHeight - layoutHeight, 0));
}
if (selectedCountView != null) {
animators.add(ObjectAnimator.ofFloat(selectedCountView, TRANSLATION_Y, previousHeight - layoutHeight, 0));
}
keyboardAnimator.playTogether(animators);
keyboardAnimator.setDuration(AdjustPanLayoutHelper.keyboardDuration);
keyboardAnimator.setInterpolator(AdjustPanLayoutHelper.keyboardInterpolator);
keyboardAnimator.start();
}
}
previousHeight = layoutHeight;
int paddingBottom;
Object tag = commentView != null ? commentView.getTag() : null;
int keyboardSize = measureKeyboardHeight();
@ -866,9 +831,9 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
setBottomClip(paddingBottom);
lastMeasuredTopPadding = topPadding;
for (int i = 0; i < count; i++) {
final View child = getChildAt(i);
if (child.getVisibility() == GONE) {
for (int i = -1; i < count; i++) {
final View child = i == -1 ? commentView : getChildAt(i);
if (child == null || child.getVisibility() == GONE) {
continue;
}
final FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) child.getLayoutParams();
@ -943,6 +908,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
searchViewPager.setKeyboardHeight(keyboardSize);
notifyHeightChanged();
updateContextViewPosition();
updateCommentView();
}
@Override
@ -3367,17 +3333,35 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
AndroidUtilities.requestAdjustResize(getParentActivity(), classGuid);
}
return super.dispatchTouchEvent(ev);
}
@Override
public void setTranslationY(float translationY) {
super.setTranslationY(translationY);
if (!commentViewAnimated) {
return;
}
if (commentViewBg != null) {
commentViewBg.setTranslationY(translationY);
}
if (writeButtonContainer != null) {
writeButtonContainer.setTranslationY(translationY);
}
if (selectedCountView != null) {
selectedCountView.setTranslationY(translationY);
}
}
};
contentView.setClipChildren(false);
contentView.setClipToPadding(false);
commentView.allowBlur = false;
commentView.setAllowStickersAndGifs(false, false);
commentView.setForceShowSendButton(true, false);
commentView.setVisibility(View.GONE);
commentView.getSendButton().setAlpha(0);
contentView.addView(commentView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.LEFT | Gravity.BOTTOM));
commentViewBg = new View(getParentActivity());
commentViewBg.setBackgroundColor(getThemedColor(Theme.key_chat_messagePanelBackground));
contentView.addView(commentViewBg, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 1600, Gravity.BOTTOM | Gravity.FILL_HORIZONTAL, 0, 0, 0, -1600));
contentView.addView(commentView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.LEFT | Gravity.BOTTOM));
commentView.setDelegate(new ChatActivityEnterView.ChatActivityEnterViewDelegate() {
@Override
public void onMessageSend(CharSequence message, boolean notify, int scheduleDate) {
@ -3397,6 +3381,20 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
}
@Override
public void bottomPanelTranslationYChanged(float translation) {
if (commentViewAnimated) {
if (keyboardAnimator != null) {
keyboardAnimator.cancel();
keyboardAnimator = null;
}
if (commentView != null) {
commentView.setTranslationY(translation);
commentViewIgnoreTopUpdate = true;
}
}
}
@Override
public void onStickersExpandedChange() {
@ -3797,6 +3795,35 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
return fragmentView;
}
private int commentViewPreviousTop = -1;
private ValueAnimator keyboardAnimator;
private boolean commentViewIgnoreTopUpdate = false;
private void updateCommentView() {
if (!commentViewAnimated || commentView == null) {
return;
}
int top = commentView.getTop();
if (commentViewPreviousTop > 0 && Math.abs(top - commentViewPreviousTop) > AndroidUtilities.dp(20) && !commentView.isPopupShowing()) {
if (commentViewIgnoreTopUpdate) {
commentViewIgnoreTopUpdate = false;
commentViewPreviousTop = top;
return;
}
if (keyboardAnimator != null) {
keyboardAnimator.cancel();
}
keyboardAnimator = ValueAnimator.ofFloat(commentViewPreviousTop - top, 0);
keyboardAnimator.addUpdateListener(a -> {
commentView.setTranslationY((float) a.getAnimatedValue());
});
keyboardAnimator.setDuration(AdjustPanLayoutHelper.keyboardDuration);
keyboardAnimator.setInterpolator(AdjustPanLayoutHelper.keyboardInterpolator);
keyboardAnimator.start();
}
commentViewPreviousTop = top;
}
private void updateAppUpdateViews(boolean animated) {
if (updateLayout == null) {
return;
@ -7644,11 +7671,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
int[] location = new int[2];
view.getLocationInWindow(location);
int y;
// if (keyboardVisible && parentFragment.contentView.getMeasuredHeight() > AndroidUtilities.dp(58)) {
// y = location[1] + view.getMeasuredHeight();
// } else {
y = location[1] - layout.getMeasuredHeight() - AndroidUtilities.dp(2);
// }
sendPopupWindow.showAtLocation(view, Gravity.LEFT | Gravity.TOP, location[0] + view.getMeasuredWidth() - layout.getMeasuredWidth() + AndroidUtilities.dp(8), y);
sendPopupWindow.dimBehind();
view.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);

View file

@ -73,6 +73,7 @@ public class DownloadProgressIcon extends View implements NotificationCenter.Not
paint.setColor(Theme.getColor(Theme.key_actionBarDefaultIcon));
paint2.setColor(Theme.getColor(Theme.key_actionBarDefaultIcon));
downloadImageReceiver.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_actionBarDefaultIcon), PorterDuff.Mode.MULTIPLY));
downloadCompleteImageReceiver.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_actionBarDefaultIcon), PorterDuff.Mode.MULTIPLY));
paint2.setAlpha(100);
}

View file

@ -3037,7 +3037,7 @@ public class LaunchActivity extends BasePermissionsActivity implements ActionBar
MessagesController.getInstance(intentAccount).checkIsInChat(chat, user, (isInChatAlready, currentRights, currentRank) -> AndroidUtilities.runOnUIThread(() -> {
TLRPC.TL_chatAdminRights requestingRights = null;
if (botChatAdminParams != null) {
String[] adminParams = botChatAdminParams.split("\\+");
String[] adminParams = botChatAdminParams.split("\\+| ");
requestingRights = new TLRPC.TL_chatAdminRights();
final int count = adminParams.length;
for (int i = 0; i < count; ++i) {
@ -3053,12 +3053,14 @@ public class LaunchActivity extends BasePermissionsActivity implements ActionBar
requestingRights.edit_messages = true;
break;
case "add_admins":
case "promote_members":
requestingRights.add_admins = true;
break;
case "delete_messages":
requestingRights.delete_messages = true;
break;
case "ban_users":
case "restrict_members":
requestingRights.ban_users = true;
break;
case "invite_users":
@ -3067,9 +3069,13 @@ public class LaunchActivity extends BasePermissionsActivity implements ActionBar
case "pin_messages":
requestingRights.pin_messages = true;
break;
case "manage_video_chats":
case "manage_call":
requestingRights.manage_call = true;
break;
case "manage_chat":
requestingRights.other = true;
break;
case "anonymous":
requestingRights.anonymous = true;
break;
@ -3094,6 +3100,7 @@ public class LaunchActivity extends BasePermissionsActivity implements ActionBar
editRights.pin_messages = requestingRights.pin_messages || editRights.pin_messages;
editRights.manage_call = requestingRights.manage_call || editRights.manage_call;
editRights.anonymous = requestingRights.anonymous || editRights.anonymous;
editRights.other = requestingRights.other || editRights.other;
}
}
ChatRightsEditActivity editRightsActivity = new ChatRightsEditActivity(user.id, -did, editRights, null, null, currentRank, ChatRightsEditActivity.TYPE_ADD_BOT, true, !isInChatAlready, null);