Update to 7.1.1 (2096)

This commit is contained in:
DrKLO 2020-10-02 14:25:02 +03:00
parent 4992f231b3
commit 99f5637dda
20 changed files with 283 additions and 108 deletions

View file

@ -284,7 +284,7 @@ android {
}
}
defaultConfig.versionCode = 2094
defaultConfig.versionCode = 2096
applicationVariants.all { variant ->
variant.outputs.all { output ->

View file

@ -18,7 +18,7 @@ public class BuildVars {
public static boolean LOGS_ENABLED = false;
public static boolean USE_CLOUD_STRINGS = true;
public static boolean CHECK_UPDATES = true;
public static int BUILD_VERSION = 2094;
public static int BUILD_VERSION = 2096;
public static String BUILD_VERSION_STRING = "7.1.0";
public static int APP_ID = 4;
public static String APP_HASH = "014b35b6184100b085b0d0572f9b5103";

View file

@ -853,12 +853,16 @@ public class ImageReceiver implements NotificationCenter.NotificationCenterDeleg
bitmapH = bitmapDrawable.getIntrinsicHeight();
}
} else {
Bitmap bitmap = bitmapDrawable.getBitmap();
if (bitmap != null && bitmap.isRecycled()) {
return;
}
if (orientation % 360 == 90 || orientation % 360 == 270) {
bitmapW = bitmapDrawable.getBitmap().getHeight();
bitmapH = bitmapDrawable.getBitmap().getWidth();
bitmapW = bitmap.getHeight();
bitmapH = bitmap.getWidth();
} else {
bitmapW = bitmapDrawable.getBitmap().getWidth();
bitmapH = bitmapDrawable.getBitmap().getHeight();
bitmapW = bitmap.getWidth();
bitmapH = bitmap.getHeight();
}
}
float realImageW = imageW - sideClip * 2;

View file

@ -4562,7 +4562,7 @@ public class MessagesController extends BaseController implements NotificationCe
if ((messageViews.flags & 2) != 0) {
if (forwards == null) {
forwards = new SparseIntArray();
channelViews.put(key, forwards);
channelForwards.put(key, forwards);
}
forwards.put(req.id.get(a1), messageViews.forwards);
}

View file

@ -910,7 +910,7 @@ public class ActionBarMenuItem extends FrameLayout {
ignoreRequestLayout = true;
measureChildWithMargins(searchFilterLayout, widthMeasureSpec, width, heightMeasureSpec, 0);
int filterWidth = searchFilterLayout.getVisibility() == View.VISIBLE ? searchFilterLayout.getMeasuredWidth() : 0;
measureChildWithMargins(searchField, widthMeasureSpec, width + filterWidth, heightMeasureSpec, 0);
measureChildWithMargins(searchField, MeasureSpec.makeMeasureSpec(minWidth - AndroidUtilities.dp(6), MeasureSpec.UNSPECIFIED), width + filterWidth, heightMeasureSpec, 0);
ignoreRequestLayout = false;
setMeasuredDimension(Math.max(filterWidth + searchField.getMeasuredWidth(), minWidth), MeasureSpec.getSize(heightMeasureSpec));
}
@ -1109,7 +1109,7 @@ public class ActionBarMenuItem extends FrameLayout {
searchContainer.addView(searchFilterLayout, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, 32, Gravity.CENTER_VERTICAL, 0, 0, 48, 0));
} else {
searchContainer.addView(searchFilterLayout, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, 32, Gravity.CENTER_VERTICAL, 0, 0, 48, 0));
searchContainer.addView(searchField, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, 36, Gravity.CENTER_VERTICAL, 0, 0, 0, 0));
searchContainer.addView(searchField, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, 36, Gravity.CENTER_VERTICAL, 0, 0, wrapInScrollView ? 0 : 48, 0));
searchContainer.addView(searchFieldCaption, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, 36, Gravity.CENTER_VERTICAL | Gravity.RIGHT, 0, 5.5f, 48, 0));
}
searchFilterLayout.setClipChildren(false);

View file

@ -7428,7 +7428,7 @@ public class Theme {
color = defaultColors.get(key);
}
}
if (color != null && (key_windowBackgroundWhite.equals(key) || key_windowBackgroundGray.equals(key))) {
if (color != null && (key_windowBackgroundWhite.equals(key) || key_windowBackgroundGray.equals(key) || key_actionBarDefault.equals(key) || key_actionBarDefaultArchived.equals(key))) {
color |= 0xff000000;
}
return color;
@ -7520,14 +7520,14 @@ public class Theme {
return getDefaultColor(key);
}
}
if (key_windowBackgroundWhite.equals(key) || key_windowBackgroundGray.equals(key)) {
if (key_windowBackgroundWhite.equals(key) || key_windowBackgroundGray.equals(key) || key_actionBarDefault.equals(key) || key_actionBarDefaultArchived.equals(key)) {
color |= 0xff000000;
}
return color;
}
public static void setColor(String key, int color, boolean useDefault) {
if (key.equals(key_chat_wallpaper) || key.equals(key_chat_wallpaper_gradient_to) || key.equals(key_windowBackgroundWhite) || key.equals(key_windowBackgroundGray)) {
if (key.equals(key_chat_wallpaper) || key.equals(key_chat_wallpaper_gradient_to) || key.equals(key_windowBackgroundWhite) || key.equals(key_windowBackgroundGray) || key.equals(key_actionBarDefault) || key.equals(key_actionBarDefaultArchived)) {
color = 0xff000000 | color;
}

View file

@ -56,6 +56,8 @@ import java.util.concurrent.ConcurrentHashMap;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.google.android.exoplayer2.util.Log;
public class DialogsSearchAdapter extends RecyclerListView.SelectionAdapter {
private Context mContext;
@ -93,6 +95,10 @@ public class DialogsSearchAdapter extends RecyclerListView.SelectionAdapter {
private FilteredSearchView.Delegate filtersDelegate;
private int folderId;
public boolean isSearching() {
return waitingResponseCount > 0;
}
public static class DialogSearchResult {
public TLObject object;
public int date;
@ -106,10 +112,11 @@ public class DialogsSearchAdapter extends RecyclerListView.SelectionAdapter {
}
public interface DialogsSearchAdapterDelegate {
void searchStateChanged(boolean searching);
void searchStateChanged(boolean searching, boolean animated);
void didPressedOnSubDialog(long did);
void needRemoveHint(int did);
void needClearList();
void runResultsEnterAnimation();
}
private class CategoryAdapterRecycler extends RecyclerListView.SelectionAdapter {
@ -171,6 +178,8 @@ public class DialogsSearchAdapter extends RecyclerListView.SelectionAdapter {
searchAdapterHelper.setDelegate(new SearchAdapterHelper.SearchAdapterHelperDelegate() {
@Override
public void onDataSetChanged(int searchId) {
waitingResponseCount--;
Log.d("kek", "data set change " + waitingResponseCount);
lastGlobalSearchId = searchId;
if (lastLocalSearchId != searchId) {
searchResult.clear();
@ -179,10 +188,13 @@ public class DialogsSearchAdapter extends RecyclerListView.SelectionAdapter {
searchResultMessages.clear();
}
searchWas = true;
if (!searchAdapterHelper.isSearchInProgress() && delegate != null && reqId == 0) {
delegate.searchStateChanged(false);
if (delegate != null) {
delegate.searchStateChanged(waitingResponseCount > 0, true);
}
notifyDataSetChanged();
if (delegate != null) {
delegate.runResultsEnterAnimation();
}
}
@Override
@ -191,7 +203,7 @@ public class DialogsSearchAdapter extends RecyclerListView.SelectionAdapter {
searchResultHashtags.add(arrayList.get(a).hashtag);
}
if (delegate != null) {
delegate.searchStateChanged(false);
delegate.searchStateChanged(false, false);
}
notifyDataSetChanged();
}
@ -275,9 +287,6 @@ public class DialogsSearchAdapter extends RecyclerListView.SelectionAdapter {
}
lastMessagesSearchString = query;
final int currentReqId = ++lastReqId;
/*if (delegate != null) {
delegate.searchStateChanged(true);
}*/
reqId = ConnectionsManager.getInstance(currentAccount).sendRequest(req, (response, error) -> {
final ArrayList<MessageObject> messageObjects = new ArrayList<>();
if (error == null) {
@ -291,6 +300,7 @@ public class DialogsSearchAdapter extends RecyclerListView.SelectionAdapter {
}
AndroidUtilities.runOnUIThread(() -> {
if (currentReqId == lastReqId && (searchId <= 0 || searchId == lastSearchId)) {
waitingResponseCount--;
if (error == null) {
currentMessagesQuery = query;
TLRPC.messages_Messages res = (TLRPC.messages_Messages) response;
@ -330,12 +340,13 @@ public class DialogsSearchAdapter extends RecyclerListView.SelectionAdapter {
}
}
notifyDataSetChanged();
if (delegate != null && req.offset_id == 0) {
delegate.searchStateChanged(waitingResponseCount > 0, true);
delegate.runResultsEnterAnimation();
}
}
}
reqId = 0;
if (!searchAdapterHelper.isSearchInProgress() && delegate != null) {
delegate.searchStateChanged(false);
}
});
}, ConnectionsManager.RequestFlagFailOnServerErrors);
}
@ -555,6 +566,8 @@ public class DialogsSearchAdapter extends RecyclerListView.SelectionAdapter {
private void updateSearchResults(final ArrayList<TLObject> result, final ArrayList<CharSequence> names, final ArrayList<TLRPC.User> encUsers, final int searchId) {
AndroidUtilities.runOnUIThread(() -> {
waitingResponseCount--;
Log.d("kek", "update local search " + waitingResponseCount);
if (searchId != lastSearchId) {
return;
}
@ -585,11 +598,8 @@ public class DialogsSearchAdapter extends RecyclerListView.SelectionAdapter {
searchAdapterHelper.mergeResults(searchResult);
notifyDataSetChanged();
if (delegate != null) {
if (getItemCount() == 0 && (searchRunnable2 != null || searchAdapterHelper.isSearchInProgress())) {
delegate.searchStateChanged(true);
} else {
delegate.searchStateChanged(false);
}
delegate.searchStateChanged(waitingResponseCount > 0, true);
delegate.runResultsEnterAnimation();
}
});
}
@ -604,6 +614,8 @@ public class DialogsSearchAdapter extends RecyclerListView.SelectionAdapter {
notifyDataSetChanged();
}
int waitingResponseCount;
public void searchDialogs(String text) {
if (text != null && text.equals(lastSearchText)) {
return;
@ -634,6 +646,7 @@ public class DialogsSearchAdapter extends RecyclerListView.SelectionAdapter {
}
searchWas = false;
lastSearchId = 0;
waitingResponseCount = 0;
searchMessagesInternal(null, 0);
notifyDataSetChanged();
localTipDates.clear();
@ -650,22 +663,23 @@ public class DialogsSearchAdapter extends RecyclerListView.SelectionAdapter {
for (int a = 0; a < hashtags.size(); a++) {
searchResultHashtags.add(hashtags.get(a).hashtag);
}
waitingResponseCount = 0;
notifyDataSetChanged();
if (delegate != null) {
delegate.searchStateChanged(false);
delegate.searchStateChanged(false, false);
}
} else {
/*if (delegate != null) {
delegate.searchStateChanged(true);
}*/
}
} else {
searchResultHashtags.clear();
}
notifyDataSetChanged();
final int searchId = ++lastSearchId;
waitingResponseCount = 3;
notifyDataSetChanged();
if (needMessagesSearch != 2 && delegate != null) {
delegate.searchStateChanged(true);
delegate.searchStateChanged(true, false);
}
Utilities.searchQueue.postRunnable(searchRunnable = () -> {
searchRunnable = null;
searchDialogsInternal(query, searchId);
@ -676,8 +690,14 @@ public class DialogsSearchAdapter extends RecyclerListView.SelectionAdapter {
}
if (needMessagesSearch != 2) {
searchAdapterHelper.queryServerSearch(query, true, dialogsType != 4, true, dialogsType != 4, dialogsType == 2, 0, dialogsType == 0, 0, searchId);
} else {
waitingResponseCount--;
}
if (needMessagesSearch == 0) {
waitingResponseCount--;
} else {
searchMessagesInternal(text, searchId);
}
});
}, 300);
}
@ -685,6 +705,9 @@ public class DialogsSearchAdapter extends RecyclerListView.SelectionAdapter {
@Override
public int getItemCount() {
if (waitingResponseCount == 3) {
return 0;
}
if (isRecentSearchDisplayed()) {
return (!recentSearchObjects.isEmpty() ? recentSearchObjects.size() + 1 : 0) + (!MediaDataController.getInstance(currentAccount).hints.isEmpty() ? 1 : 0);
}

View file

@ -2864,6 +2864,9 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
canStreamVideo = false;
animatingNoSound = 0;
drawSideButton = !isRepliesChat && checkNeedDrawShareButton(messageObject) ? 1 : 0;
if (drawSideButton == 1 && messageObject.messageOwner.fwd_from != null && !messageObject.isOutOwner() && messageObject.messageOwner.fwd_from.saved_from_peer != null && messageObject.getDialogId() == UserConfig.getInstance(currentAccount).getClientUserId()) {
drawSideButton = 2;
}
replyNameLayout = null;
adminLayout = null;
checkOnlyButtonPressed = false;
@ -4401,7 +4404,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
} else {
drawForwardedName = messageObject.messageOwner.fwd_from != null && !messageObject.isAnyKindOfSticker();
if (!messageObject.isAnyKindOfSticker() && messageObject.type != MessageObject.TYPE_ROUND_VIDEO) {
drawName = messageObject.isFromGroup() && messageObject.isMegagroup();
drawName = messageObject.isFromGroup() && messageObject.isMegagroup() && (currentPosition == null || (currentPosition.flags & MessageObject.POSITION_FLAG_TOP) != 0);
}
mediaBackground = isMedia = messageObject.type != 9;
drawImageButton = true;
@ -8725,8 +8728,6 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
private boolean checkNeedDrawShareButton(MessageObject messageObject) {
if ((currentPosition != null && !currentPosition.last) || currentMessageObject.deleted) {
return false;
} else if (messageObject.messageOwner.fwd_from != null && !messageObject.isOutOwner() && messageObject.messageOwner.fwd_from.saved_from_peer != null && messageObject.getDialogId() == UserConfig.getInstance(currentAccount).getClientUserId()) {
drawSideButton = 2;
}
return messageObject.needDrawShareButton();
}
@ -10048,11 +10049,33 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
Theme.chat_adminPaint.setColor(color);
canvas.save();
float ax;
if (currentMessagesGroup != null) {
int dWidth = getGroupPhotosWidth();
int firstLineWidth = 0;
for (int a = 0; a < currentMessagesGroup.posArray.size(); a++) {
MessageObject.GroupedMessagePosition position = currentMessagesGroup.posArray.get(a);
if (position.minY == 0) {
firstLineWidth += Math.ceil((position.pw + position.leftSpanOffset) / 1000.0f * dWidth);
} else {
break;
}
}
if (!mediaBackground && currentMessageObject.isOutOwner()) {
ax = backgroundDrawableLeft + firstLineWidth - AndroidUtilities.dp(17) - adminLayout.getLineWidth(0);
} else {
ax = backgroundDrawableLeft + firstLineWidth - AndroidUtilities.dp(11) - adminLayout.getLineWidth(0);
}
ax -= getExtraTextX() + AndroidUtilities.dp(8);
if (!currentMessageObject.isOutOwner()) {
ax -= AndroidUtilities.dp(48);
}
} else {
if (!mediaBackground && currentMessageObject.isOutOwner()) {
ax = backgroundDrawableLeft + backgroundDrawableRight - AndroidUtilities.dp(17) - adminLayout.getLineWidth(0);
} else {
ax = backgroundDrawableLeft + backgroundDrawableRight - AndroidUtilities.dp(11) - adminLayout.getLineWidth(0);
}
}
canvas.translate(ax, nameY + AndroidUtilities.dp(0.5f));
if (transitionParams.animateSign) {
Theme.chat_adminPaint.setAlpha((int) (Color.alpha(color) * transitionParams.animateChangeProgress));
@ -12372,9 +12395,13 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
}
} else if (virtualViewId == COMMENT) {
if (delegate != null) {
if (isRepliesChat) {
delegate.didPressSideButton(ChatMessageCell.this);
} else {
delegate.didPressCommentButton(ChatMessageCell.this);
}
}
}
} else if (action == AccessibilityNodeInfo.ACTION_LONG_CLICK) {
ClickableSpan link = getLinkById(virtualViewId);
if (link != null) {

View file

@ -410,7 +410,7 @@ public class SharedAudioCell extends FrameLayout implements DownloadController.F
if (titleLayout != null) {
canvas.save();
canvas.translate(AndroidUtilities.dp(LocaleController.isRTL ? 8 : AndroidUtilities.leftBaseline), titleY);
canvas.translate(AndroidUtilities.dp(LocaleController.isRTL ? 8 : AndroidUtilities.leftBaseline) + (LocaleController.isRTL && dateLayout != null ? dateLayout.getWidth() + AndroidUtilities.dp(4) : 0), titleY);
titleLayout.draw(canvas);
canvas.restore();
}

View file

@ -309,7 +309,7 @@ public class SharedLinkCell extends FrameLayout {
titleFinal = titleH;
}
titleLayout = ChatMessageCell.generateStaticLayout(titleFinal, titleTextPaint, maxWidth - dateWidth, maxWidth - dateWidth, 0, 3);
titleLayout = ChatMessageCell.generateStaticLayout(titleFinal, titleTextPaint, maxWidth - dateWidth - AndroidUtilities.dp(4), maxWidth - dateWidth - AndroidUtilities.dp(4), 0, 3);
if (titleLayout.getLineCount() > 0) {
descriptionY = titleY + titleLayout.getLineBottom(titleLayout.getLineCount() - 1) + AndroidUtilities.dp(4);
}
@ -565,7 +565,11 @@ public class SharedLinkCell extends FrameLayout {
}
if (titleLayout != null) {
canvas.save();
canvas.translate(AndroidUtilities.dp(LocaleController.isRTL ? 8 : AndroidUtilities.leftBaseline), titleY);
float x = AndroidUtilities.dp(LocaleController.isRTL ? 8 : AndroidUtilities.leftBaseline);
if (LocaleController.isRTL) {
x += dateLayout == null ? 0 : (dateLayout.getWidth() + AndroidUtilities.dp(4));
}
canvas.translate(x, titleY);
titleLayout.draw(canvas);
canvas.restore();
}

View file

@ -2508,23 +2508,9 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
continue;
}
if (child == chatListView) {
/*globalIgnoreLayout = true;
int additionalPadding = inputFieldHeight - AndroidUtilities.dp(51);
if (pinnedMessageView != null && pinnedMessageView.getTag() == null || topChatPanelView != null && topChatPanelView.getTag() == null) {
chatListView.setPadding(0, AndroidUtilities.dp(52) + additionalPadding, 0, AndroidUtilities.dp(3));
} else {
chatListView.setPadding(0, AndroidUtilities.dp(4) + additionalPadding, 0, AndroidUtilities.dp(3));
}
globalIgnoreLayout = false;*/
// if (chatActivityEnterView.getAlpha() != 1.0f) {
// chatListView.setTranslationY(inputFieldHeight - AndroidUtilities.dp(51));
// }
chatListViewClipTop = inPreviewMode ? 0 : (inputFieldHeight - AndroidUtilities.dp(51));
int contentWidthSpec = MeasureSpec.makeMeasureSpec(widthSize, MeasureSpec.EXACTLY);
int h = heightSize - listViewTopHeight - (inPreviewMode && Build.VERSION.SDK_INT >= 21 ? AndroidUtilities.statusBarHeight : 0);
// if (!chatActivityEnterView.pannelAniamationInProgress()) {
// h -= chatEmojiViewPadding;
// }
if (keyboardSize > AndroidUtilities.dp(20) && getLayoutParams().height < 0) {
h += keyboardSize;
}
@ -2727,9 +2713,6 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
if (keyboardSize > AndroidUtilities.dp(20) && getLayoutParams().height < 0) {
childTop -= keyboardSize;
}
// if (!chatActivityEnterView.pannelAniamationInProgress()) {
// childTop += chatEmojiViewPadding;
// }
} else if (child == progressView) {
if (chatActivityEnterView.isTopViewVisible()) {
childTop -= AndroidUtilities.dp(48);
@ -14567,6 +14550,9 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
} else {
pinnedMessageEnterOffset = 0;
invalidateChatListViewTopPadding();
if (firstLoading) {
updateChatListViewTopPadding();
}
pinnedMessageView.setVisibility(View.VISIBLE);
}
}
@ -14974,9 +14960,13 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
}
if (actionBar != null) {
actionBar.setBackButtonDrawable(!value ? new BackDrawable(false) : null);
if (headerItem != null) {
headerItem.setAlpha(!value ? 1.0f : 0.0f);
}
if (attachItem != null) {
attachItem.setAlpha(!value ? 1.0f : 0.0f);
}
}
if (chatListView != null) {
int count = chatListView.getChildCount();

View file

@ -6565,9 +6565,9 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe
keyboardHeightLand = MessagesController.getGlobalEmojiSettings().getInt("kbd_height_land3", AndroidUtilities.dp(200));
}
int currentHeight = AndroidUtilities.displaySize.x > AndroidUtilities.displaySize.y ? keyboardHeightLand : keyboardHeight;
if (!samePannelWasVisible && !anotherPanelWasVisible) {
/*if (!samePannelWasVisible && !anotherPanelWasVisible) {
currentHeight = 0;
} else if (contentType == 1) {
} else */if (contentType == 1) {
currentHeight = Math.min(botKeyboardView.getKeyboardHeight(), currentHeight);
}
if (botKeyboardView != null) {

View file

@ -529,6 +529,7 @@ public class ChatAttachAlertAudioLayout extends ChatAttachAlert.AttachAlertLayou
message.out = true;
message.id = id;
message.peer_id = new TLRPC.TL_peerUser();
message.from_id = new TLRPC.TL_peerUser();
message.peer_id.user_id = message.from_id.user_id = UserConfig.getInstance(parentAlert.currentAccount).getClientUserId();
message.date = (int) (System.currentTimeMillis() / 1000);
message.message = "";

View file

@ -2500,6 +2500,7 @@ public class ChatAttachAlertPhotoLayout extends ChatAttachAlert.AttachAlertLayou
if (cameraIcon != null) {
cameraIcon.setVisibility(VISIBLE);
}
if (cameraView != null) {
int count = gridView.getChildCount();
for (int a = 0; a < count; a++) {
View child = gridView.getChildAt(a);
@ -2509,6 +2510,7 @@ public class ChatAttachAlertPhotoLayout extends ChatAttachAlert.AttachAlertLayou
}
}
}
}
@Override
void onHideShowProgress(float progress) {

View file

@ -16,7 +16,6 @@ import android.animation.ValueAnimator;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.ColorFilter;
import android.graphics.Paint;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffColorFilter;
@ -382,6 +381,9 @@ public class PhotoViewerCaptionEnterView extends FrameLayout implements Notifica
public void updateColors() {
Theme.setDrawableColor(drawable, Theme.getColor(Theme.key_dialogFloatingButton));
Theme.setDrawableColor(checkDrawable, Theme.getColor(Theme.key_dialogFloatingIcon));
if (emojiView != null) {
emojiView.updateColors();
}
}
public boolean hideActionMode() {
@ -522,11 +524,7 @@ public class PhotoViewerCaptionEnterView extends FrameLayout implements Notifica
Emoji.replaceEmoji(builder, messageEditText.getPaint().getFontMetricsInt(), AndroidUtilities.dp(20), false);
}
messageEditText.setText(builder);
if (start + text.length() <= messageEditText.length()) {
messageEditText.setSelection(start + text.length());
} else {
messageEditText.setSelection(messageEditText.length());
}
messageEditText.setSelection(Math.min(start + text.length(), messageEditText.length()));
} catch (Exception e) {
FileLog.e(e);
}

View file

@ -2,9 +2,16 @@ package org.telegram.ui.Components;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.animation.ValueAnimator;
import android.content.Context;
import android.graphics.Canvas;
import android.os.Bundle;
import android.util.SparseArray;
import android.util.SparseIntArray;
import android.view.View;
import android.view.ViewTreeObserver;
import android.widget.FrameLayout;
import androidx.recyclerview.widget.LinearLayoutManager;
@ -40,7 +47,9 @@ import org.telegram.ui.ViewPagerFixed;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
public class SearchViewPager extends ViewPagerFixed implements FilteredSearchView.UiCallback {
@ -80,6 +89,8 @@ public class SearchViewPager extends ViewPagerFixed implements FilteredSearchVie
private final int folderId;
ArrayList<SearchResultsEnterAnimator> currentAnimators = new ArrayList<>();
public SearchViewPager(Context context, BaseFragment fragment, int type, int initialDialogsType, int folderId, ChatPreviewDelegate chatPreviewDelegate) {
super(context);
this.folderId = folderId;
@ -96,14 +107,30 @@ public class SearchViewPager extends ViewPagerFixed implements FilteredSearchVie
}
};
searchListView = new RecyclerListView(context);
searchListView = new RecyclerListView(context) {
@Override
protected void dispatchDraw(Canvas canvas) {
int n = getChildCount();
loop: for (int i = 0; i < n; i++) {
View v = getChildAt(i);
int position = searchlayoutManager.getPosition(v);
for (int k = 0; k < currentAnimators.size(); k++) {
if (currentAnimators.get(k).setup(v, position)) {
continue loop;
}
}
v.setAlpha(1f);
}
super.dispatchDraw(canvas);
}
};
searchListView.setPivotY(0);
searchListView.setAdapter(dialogsSearchAdapter);
searchListView.setVerticalScrollBarEnabled(true);
searchListView.setInstantClick(true);
searchListView.setVerticalScrollbarPosition(LocaleController.isRTL ? RecyclerListView.SCROLLBAR_POSITION_LEFT : RecyclerListView.SCROLLBAR_POSITION_RIGHT);
searchListView.setLayoutManager(searchlayoutManager = new LinearLayoutManager(context, LinearLayoutManager.VERTICAL, false));
searchListView.setAnimateEmptyView(true, 0);
searchListView.setOnScrollListener(new RecyclerView.OnScrollListener() {
@Override
public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
@ -226,6 +253,8 @@ public class SearchViewPager extends ViewPagerFixed implements FilteredSearchVie
dialogsSearchAdapter.setFiltersDelegate(filteredSearchViewDelegate, false);
noMediaFiltersSearchView.animate().setListener(null).cancel();
noMediaFiltersSearchView.setDelegate(null, false);
emptyView.showProgress(!dialogsSearchAdapter.isSearching(), false);
emptyView.showProgress(dialogsSearchAdapter.isSearching(), false);
if (reset) {
noMediaFiltersSearchView.setVisibility(View.GONE);
} else {
@ -629,6 +658,74 @@ public class SearchViewPager extends ViewPagerFixed implements FilteredSearchVie
}
}
public void runResultsEnterAnimation() {
Set<Integer> hasSet = new HashSet<>();
int n = searchListView.getChildCount();
for (int i = 0; i < n; i++) {
hasSet.add(searchlayoutManager.getPosition(searchListView.getChildAt(i)));
}
searchListView.getViewTreeObserver().addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() {
@Override
public boolean onPreDraw() {
searchListView.getViewTreeObserver().removeOnPreDrawListener(this);
int n = searchListView.getChildCount();
for (int i = 0; i < n; i++) {
View child = searchListView.getChildAt(i);
int position = searchlayoutManager.getPosition(child);
if (!hasSet.contains(position)) {
SearchResultsEnterAnimator animator = new SearchResultsEnterAnimator();
child.setAlpha(0);
int s = Math.min(searchListView.getMeasuredHeight(), Math.max(0, child.getTop()));
int delay = (int) ((s / (float) searchListView.getMeasuredHeight()) * 100);
animator.position = position;
animator.valueAnimator.setStartDelay(delay);
animator.valueAnimator.setDuration(200);
animator.valueAnimator.start();
}
}
return true;
}
});
}
public void cancelEnterAnimation() {
for (int i = 0; i < currentAnimators.size(); i++) {
SearchResultsEnterAnimator animator = currentAnimators.get(i);
animator.valueAnimator.cancel();
currentAnimators.remove(animator);
i--;
}
}
private class SearchResultsEnterAnimator {
final ValueAnimator valueAnimator;
float progress;
int position;
private SearchResultsEnterAnimator() {
valueAnimator = ValueAnimator.ofFloat(0, 1f);
valueAnimator.addUpdateListener(valueAnimator -> {
progress = (float) valueAnimator.getAnimatedValue();
searchListView.invalidate();
});
valueAnimator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
currentAnimators.remove(SearchResultsEnterAnimator.this);
}
});
currentAnimators.add(this);
}
public boolean setup(View view, int position) {
if (this.position == position) {
view.setAlpha(progress);
return true;
}
return false;
}
}
public interface ChatPreviewDelegate {
void startChatPreview(DialogCell cell);

View file

@ -2608,14 +2608,20 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
searchViewPager.dialogsSearchAdapter.setDelegate(new DialogsSearchAdapter.DialogsSearchAdapterDelegate() {
@Override
public void searchStateChanged(boolean search) {
public void searchStateChanged(boolean search, boolean animated) {
if (searchViewPager.emptyView.getVisibility() == View.VISIBLE) {
animated = true;
}
if (searching && searchWas && searchViewPager.emptyView != null) {
if (search || searchViewPager.dialogsSearchAdapter.getItemCount() != 0) {
searchViewPager.emptyView.showProgress(true);
searchViewPager.emptyView.showProgress(true, animated);
} else {
searchViewPager.emptyView.showProgress(false);
searchViewPager.emptyView.showProgress(false, animated);
}
}
if (search && searchViewPager.dialogsSearchAdapter.getItemCount() == 0) {
searchViewPager.cancelEnterAnimation();
}
}
@Override
@ -2702,6 +2708,13 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
button.setTextColor(Theme.getColor(Theme.key_dialogTextRed2));
}
}
@Override
public void runResultsEnterAnimation() {
if (searchViewPager != null) {
searchViewPager.runResultsEnterAnimation();
}
}
});
searchViewPager.searchListView.setOnItemClickListener((view, position) -> onItemClick(view, position, searchViewPager.dialogsSearchAdapter));
@ -3753,7 +3766,6 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
}
searchWasFullyShowed = true;
AndroidUtilities.requestAdjustResize(getParentActivity(), classGuid);
fragmentView.requestLayout();
searchItem.setVisibility(View.GONE);
} else {
whiteActionBar = false;
@ -3769,9 +3781,11 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
hideFloatingButton(false);
}
searchWasFullyShowed = false;
fragmentView.requestLayout();
searchItem.getSearchContainer().setAlpha(1f);
}
if (fragmentView != null) {
fragmentView.requestLayout();
}
viewPages[0].listView.setVerticalScrollBarEnabled(true);
@ -5931,6 +5945,9 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
if (doneItem != null) {
doneItem.setIconColor(Theme.getColor(Theme.key_actionBarDefaultIcon));
}
if (commentView != null) {
commentView.updateColors();
}
if (filtersView != null) {
filtersView.updateColors();
@ -6304,6 +6321,15 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_player_button));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_player_buttonActive));
if (commentView != null) {
arrayList.add(new ThemeDescription(commentView, 0, null, Theme.chat_composeBackgroundPaint, null, null, Theme.key_chat_messagePanelBackground));
arrayList.add(new ThemeDescription(commentView, 0, null, null, new Drawable[]{Theme.chat_composeShadowDrawable}, null, Theme.key_chat_messagePanelShadow));
arrayList.add(new ThemeDescription(commentView, ThemeDescription.FLAG_TEXTCOLOR, new Class[]{ChatActivityEnterView.class}, new String[]{"messageEditText"}, null, null, null, Theme.key_chat_messagePanelText));
arrayList.add(new ThemeDescription(commentView, ThemeDescription.FLAG_CURSORCOLOR, new Class[]{ChatActivityEnterView.class}, new String[]{"messageEditText"}, null, null, null, Theme.key_chat_messagePanelCursor));
arrayList.add(new ThemeDescription(commentView, ThemeDescription.FLAG_HINTTEXTCOLOR, new Class[]{ChatActivityEnterView.class}, new String[]{"messageEditText"}, null, null, null, Theme.key_chat_messagePanelHint));
arrayList.add(new ThemeDescription(commentView, ThemeDescription.FLAG_IMAGECOLOR, new Class[]{ChatActivityEnterView.class}, new String[]{"sendButton"}, null, null, null, Theme.key_chat_messagePanelSend));
}
arrayList.add(new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_actionBarTipBackground));
arrayList.add(new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_windowBackgroundWhiteBlackText));
arrayList.add(new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_player_time));

View file

@ -2250,7 +2250,6 @@ public class LaunchActivity extends Activity implements ActionBarLayout.ActionBa
FileLog.e(e);
}
}
//TODO error
try {
progressDialog.dismiss();
} catch (Exception e) {
@ -3163,6 +3162,7 @@ public class LaunchActivity extends Activity implements ActionBarLayout.ActionBa
});
mainFragmentsStack.get(mainFragmentsStack.size() - 1).showDialog(alert);
} else {
String captionToSend = null;
for (int i = 0; i < dids.size(); i++) {
final long did = dids.get(i);
int lower_part = (int) did;
@ -3177,14 +3177,13 @@ public class LaunchActivity extends Activity implements ActionBarLayout.ActionBa
}
} else {
if (videoPath != null) {
String caption = null;
if (sendingText != null && sendingText.length() <= 1024) {
caption = sendingText;
captionToSend = sendingText;
sendingText = null;
}
ArrayList<String> arrayList = new ArrayList<>();
arrayList.add(videoPath);
SendMessagesHelper.prepareSendingDocuments(accountInstance, arrayList, arrayList, null, caption, null, did, null, null, null, null, true, 0);
SendMessagesHelper.prepareSendingDocuments(accountInstance, arrayList, arrayList, null, captionToSend, null, did, null, null, null, null, true, 0);
}
}
if (photoPathsArray != null) {
@ -3195,12 +3194,11 @@ public class LaunchActivity extends Activity implements ActionBarLayout.ActionBa
SendMessagesHelper.prepareSendingMedia(accountInstance, photoPathsArray, did, null, null, null, false, false, null, true, 0);
}
if (documentsPathsArray != null || documentsUrisArray != null) {
String caption = null;
if (sendingText != null && sendingText.length() <= 1024 && ((documentsPathsArray != null ? documentsPathsArray.size() : 0) + (documentsUrisArray != null ? documentsUrisArray.size() : 0)) == 1) {
caption = sendingText;
captionToSend = sendingText;
sendingText = null;
}
SendMessagesHelper.prepareSendingDocuments(accountInstance, documentsPathsArray, documentsOriginalPathsArray, documentsUrisArray, caption, documentsMimeType, did, null, null, null, null, true, 0);
SendMessagesHelper.prepareSendingDocuments(accountInstance, documentsPathsArray, documentsOriginalPathsArray, documentsUrisArray, captionToSend, documentsMimeType, did, null, null, null, null, true, 0);
}
if (sendingText != null) {
SendMessagesHelper.prepareSendingText(accountInstance, sendingText, did, true, 0);

View file

@ -6935,7 +6935,9 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
}
File f = new File(FileLoader.getDirectory(FileLoader.MEDIA_DIR_CACHE), SharedConfig.getLastLocalId() + "_temp.jpg");
mergeImages(entry.thumbPath = f.getAbsolutePath(), null, croppedPaintBitmap, croppedBitmap, thumbSize, true);
if (croppedPaintBitmap != null) {
croppedPaintBitmap.recycle();
}
paintBitmap.recycle();
} else {
if (!isCurrentVideo) {
@ -9621,6 +9623,17 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
editState.mediaEntities = searchImage.mediaEntities;
editState.cropState = searchImage.cropState;
}
if (object instanceof MediaController.MediaEditState) {
MediaController.MediaEditState state = (MediaController.MediaEditState) object;
if (hasAnimatedMediaEntities()) {
currentImagePath = state.imagePath;
} else if (state.filterPath != null) {
currentImagePath = state.filterPath;
} else {
currentImagePath = currentPathObject;
}
}
}
if (editState.cropState != null) {
previousHasTransform = true;
previousCropPx = editState.cropState.cropPx;
@ -9636,17 +9649,6 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
previousHasTransform = false;
cropTransform.setViewTransform(false, previousCropPx, previousCropPy, previousCropRotation, previousCropOrientation, previousCropScale, 1.0f, 1.0f, previousCropPw, previousCropPh, 0, 0, previousCropMirrored);
}
if (object instanceof MediaController.MediaEditState) {
MediaController.MediaEditState state = (MediaController.MediaEditState) object;
if (hasAnimatedMediaEntities()) {
currentImagePath = state.imagePath;
} else if (state.filterPath != null) {
currentImagePath = state.filterPath;
} else {
currentImagePath = currentPathObject;
}
}
}
} else if (pageBlocksAdapter != null) {
if (currentIndex < 0 || currentIndex >= pageBlocksAdapter.getItemsCount()) {
closePhoto(false, false);

View file

@ -4862,6 +4862,9 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
}
} else if (chat_id != 0) {
if (chatInfo != null && (!TextUtils.isEmpty(chatInfo.about) || chatInfo.location instanceof TLRPC.TL_channelLocation) || !TextUtils.isEmpty(currentChat.username)) {
if (LocaleController.isRTL && ChatObject.isChannel(currentChat) && !currentChat.megagroup && chatInfo.linked_chat_id != 0) {
emptyRow = rowCount++;
}
infoHeaderRow = rowCount++;
if (chatInfo != null) {
if (!TextUtils.isEmpty(chatInfo.about)) {