Skip to content

Commit

Permalink
Update to 7.1.1 (2096)
Browse files Browse the repository at this point in the history
  • Loading branch information
DrKLO committed Oct 2, 2020
1 parent 4992f23 commit 99f5637
Show file tree
Hide file tree
Showing 20 changed files with 283 additions and 108 deletions.
2 changes: 1 addition & 1 deletion TMessagesProj/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ android {
}
}

defaultConfig.versionCode = 2094
defaultConfig.versionCode = 2096

applicationVariants.all { variant ->
variant.outputs.all { output ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -853,12 +853,16 @@ private void drawDrawable(Canvas canvas, Drawable drawable, int alpha, BitmapSha
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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4562,7 +4562,7 @@ public void updateTimerProc() {
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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -910,7 +910,7 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
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));
}
Expand Down Expand Up @@ -1109,7 +1109,7 @@ public void afterTextChanged(Editable s) {
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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7428,7 +7428,7 @@ public static Integer getColorOrNull(String key) {
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;
Expand Down Expand Up @@ -7520,14 +7520,14 @@ public static int getColor(String key, boolean[] isDefault, boolean ignoreAnimat
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;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@
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;
Expand Down Expand Up @@ -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;
Expand All @@ -106,10 +112,11 @@ protected static class RecentSearchObject {
}

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 {
Expand Down Expand Up @@ -171,6 +178,8 @@ public DialogsSearchAdapter(Context context, int messagesSearch, int type, int f
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();
Expand All @@ -179,10 +188,13 @@ public void onDataSetChanged(int searchId) {
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
Expand All @@ -191,7 +203,7 @@ public void onSetHashtags(ArrayList<SearchAdapterHelper.HashtagObject> arrayList
searchResultHashtags.add(arrayList.get(a).hashtag);
}
if (delegate != null) {
delegate.searchStateChanged(false);
delegate.searchStateChanged(false, false);
}
notifyDataSetChanged();
}
Expand Down Expand Up @@ -275,9 +287,6 @@ private void searchMessagesInternal(final String query, int searchId) {
}
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) {
Expand All @@ -291,6 +300,7 @@ private void searchMessagesInternal(final String query, int searchId) {
}
AndroidUtilities.runOnUIThread(() -> {
if (currentReqId == lastReqId && (searchId <= 0 || searchId == lastSearchId)) {
waitingResponseCount--;
if (error == null) {
currentMessagesQuery = query;
TLRPC.messages_Messages res = (TLRPC.messages_Messages) response;
Expand Down Expand Up @@ -330,12 +340,13 @@ private void searchMessagesInternal(final String query, int searchId) {
}
}
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);
}
Expand Down Expand Up @@ -555,6 +566,8 @@ private void searchDialogsInternal(final String query, final int searchId) {

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;
}
Expand Down Expand Up @@ -585,11 +598,8 @@ private void updateSearchResults(final ArrayList<TLObject> result, final ArrayLi
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();
}
});
}
Expand All @@ -604,6 +614,8 @@ public void clearRecentHashtags() {
notifyDataSetChanged();
}

int waitingResponseCount;

public void searchDialogs(String text) {
if (text != null && text.equals(lastSearchText)) {
return;
Expand Down Expand Up @@ -634,6 +646,7 @@ public void searchDialogs(String text) {
}
searchWas = false;
lastSearchId = 0;
waitingResponseCount = 0;
searchMessagesInternal(null, 0);
notifyDataSetChanged();
localTipDates.clear();
Expand All @@ -650,22 +663,23 @@ public void searchDialogs(String text) {
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);
Expand All @@ -676,15 +690,24 @@ public void searchDialogs(String text) {
}
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);
}
searchMessagesInternal(text, searchId);
});
}, 300);
}
}

@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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2864,6 +2864,9 @@ private void setMessageContent(MessageObject messageObject, MessageObject.Groupe
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;
Expand Down Expand Up @@ -4401,7 +4404,7 @@ private void setMessageContent(MessageObject messageObject, MessageObject.Groupe
} 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;
Expand Down Expand Up @@ -8725,8 +8728,6 @@ private boolean isOpenChatByShare(MessageObject messageObject) {
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();
}
Expand Down Expand Up @@ -10048,10 +10049,32 @@ public void drawNamesLayout(Canvas canvas, float alpha) {
Theme.chat_adminPaint.setColor(color);
canvas.save();
float ax;
if (!mediaBackground && currentMessageObject.isOutOwner()) {
ax = backgroundDrawableLeft + backgroundDrawableRight - AndroidUtilities.dp(17) - adminLayout.getLineWidth(0);
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 {
ax = backgroundDrawableLeft + backgroundDrawableRight - AndroidUtilities.dp(11) - adminLayout.getLineWidth(0);
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) {
Expand Down Expand Up @@ -12372,7 +12395,11 @@ public boolean performAction(int virtualViewId, int action, Bundle arguments) {
}
} else if (virtualViewId == COMMENT) {
if (delegate != null) {
delegate.didPressCommentButton(ChatMessageCell.this);
if (isRepliesChat) {
delegate.didPressSideButton(ChatMessageCell.this);
} else {
delegate.didPressCommentButton(ChatMessageCell.this);
}
}
}
} else if (action == AccessibilityNodeInfo.ACTION_LONG_CLICK) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ protected void onDraw(Canvas canvas) {

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();
}
Expand Down
Loading

0 comments on commit 99f5637

Please sign in to comment.