Skip to content

Commit

Permalink
Update to 7.4.2 (2227)
Browse files Browse the repository at this point in the history
  • Loading branch information
DrKLO committed Jan 30, 2021
1 parent eb2bbd3 commit 3480f19
Show file tree
Hide file tree
Showing 16 changed files with 146 additions and 75 deletions.
2 changes: 1 addition & 1 deletion TMessagesProj/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ android {
}
}

defaultConfig.versionCode = 2226
defaultConfig.versionCode = 2227

applicationVariants.all { variant ->
variant.outputs.all { output ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ public boolean animateRemove(final RecyclerView.ViewHolder holder, ItemHolderInf
return true;
}


public void setDelayAnimations(boolean value) {
delayAnimations = value;
}
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 = 2226;
public static int BUILD_VERSION = 2227;
public static String BUILD_VERSION_STRING = "7.4.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 @@ -475,6 +475,9 @@ public boolean includesDialog(AccountInstance accountInstance, int lowerId) {
}

public boolean includesDialog(AccountInstance accountInstance, int lowerId, TLRPC.Dialog d) {
if (neverShow.contains(lowerId)) {
return false;
}
if (alwaysShow.contains(lowerId)) {
return true;
}
Expand All @@ -485,8 +488,7 @@ public boolean includesDialog(AccountInstance accountInstance, int lowerId, TLRP
ContactsController contactsController = accountInstance.getContactsController();
boolean skip = false;
if ((flags & DIALOG_FILTER_FLAG_EXCLUDE_MUTED) != 0 && messagesController.isDialogMuted(d.id) && d.unread_mentions_count == 0 ||
(flags & DIALOG_FILTER_FLAG_EXCLUDE_READ) != 0 && d.unread_count == 0 && !d.unread_mark && d.unread_mentions_count == 0 ||
neverShow.contains(lowerId)) {
(flags & DIALOG_FILTER_FLAG_EXCLUDE_READ) != 0 && d.unread_count == 0 && !d.unread_mark && d.unread_mentions_count == 0) {
return false;
}
if (lowerId > 0) {
Expand Down Expand Up @@ -2915,7 +2917,7 @@ private void reloadDialogsReadValue(ArrayList<TLRPC.Dialog> dialogs, long did) {
value = 0;
}
dialogs_read_outbox_max.put(dialog.id, Math.max(dialog.read_outbox_max_id, value));
if (value == 0) {
if (dialog.read_outbox_max_id > value) {
if (dialog.peer.channel_id != 0) {
TLRPC.TL_updateReadChannelOutbox update = new TLRPC.TL_updateReadChannelOutbox();
update.channel_id = dialog.peer.channel_id;
Expand Down Expand Up @@ -3042,7 +3044,7 @@ public void loadFullChat(final int chat_id, final int classGuid, boolean force)
}

dialogs_read_inbox_max.put(dialog_id, Math.max(res.full_chat.read_inbox_max_id, value));
if (value == 0) {
if (res.full_chat.read_inbox_max_id > value) {
ArrayList<TLRPC.Update> arrayList = new ArrayList<>();
TLRPC.TL_updateReadChannelInbox update = new TLRPC.TL_updateReadChannelInbox();
update.channel_id = chat_id;
Expand All @@ -3056,7 +3058,7 @@ public void loadFullChat(final int chat_id, final int classGuid, boolean force)
value = getMessagesStorage().getDialogReadMax(true, dialog_id);
}
dialogs_read_outbox_max.put(dialog_id, Math.max(res.full_chat.read_outbox_max_id, value));
if (value == 0) {
if (res.full_chat.read_outbox_max_id > value) {
ArrayList<TLRPC.Update> arrayList = new ArrayList<>();
TLRPC.TL_updateReadChannelOutbox update = new TLRPC.TL_updateReadChannelOutbox();
update.channel_id = chat_id;
Expand Down Expand Up @@ -11812,6 +11814,9 @@ public boolean processUpdateArray(ArrayList<TLRPC.Update> updates, final ArrayLi
dialogs_read_inbox_max.put(dialog_id, Math.max(value, update.max_id));
} else if (baseUpdate instanceof TLRPC.TL_updateReadChannelOutbox) {
TLRPC.TL_updateReadChannelOutbox update = (TLRPC.TL_updateReadChannelOutbox) baseUpdate;
if (BuildVars.LOGS_ENABLED) {
FileLog.d(baseUpdate + " channelId = " + update.channel_id);
}
long message_id = update.max_id;
message_id |= ((long) update.channel_id) << 32;
long dialog_id = -update.channel_id;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ public void run(TLObject response, TLRPC.TL_error error) {
}
});
}
});
}, ConnectionsManager.RequestFlagFailOnServerErrors);
}

public long getUploadedCount() {
Expand Down Expand Up @@ -237,7 +237,7 @@ public void run(TLObject response, TLRPC.TL_error error) {
}
});
}
});
}, ConnectionsManager.RequestFlagFailOnServerErrors);
}

private void startImport() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ class ShortcutRemoteViewsFactory implements RemoteViewsService.RemoteViewsFactor

public ShortcutRemoteViewsFactory(Context context, Intent intent) {
mContext = context;
Theme.createDialogsResources(context);
appWidgetId = intent.getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID);
SharedPreferences preferences = context.getSharedPreferences("shortcut_widget", Activity.MODE_PRIVATE);
int accountId = preferences.getInt("account" + appWidgetId, -1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ private boolean convertVideoInternal(String videoPath, File cacheFile,
FileLog.e(e); //s20 ultra exception
}
if (maxBufferSize <= 0) {
maxBufferSize = 16 * 1024;
maxBufferSize = 64 * 1024;
}
audioBuffer = ByteBuffer.allocateDirect(maxBufferSize);

Expand Down Expand Up @@ -487,10 +487,12 @@ private boolean convertVideoInternal(String videoPath, File cacheFile,
}
}
} else if (copyAudioBuffer && audioIndex != -1 && index == audioIndex) {
long size = extractor.getSampleSize();
if (size > maxBufferSize) {
maxBufferSize = (int) (size + 1024);
audioBuffer = ByteBuffer.allocateDirect(maxBufferSize);
if (Build.VERSION.SDK_INT >= 28) {
long size = extractor.getSampleSize();
if (size > maxBufferSize) {
maxBufferSize = (int) (size + 1024);
audioBuffer = ByteBuffer.allocateDirect(maxBufferSize);
}
}
info.size = extractor.readSampleData(audioBuffer, 0);
if (Build.VERSION.SDK_INT < 21) {
Expand Down Expand Up @@ -834,7 +836,7 @@ private long readAndWriteTracks(MediaExtractor extractor, MP4Builder mediaMuxer,
}
}
if (maxBufferSize <= 0) {
maxBufferSize = 16 * 1024;
maxBufferSize = 64 * 1024;
}
ByteBuffer buffer = ByteBuffer.allocateDirect(maxBufferSize);
if (audioTrackIndex >= 0 || videoTrackIndex >= 0) {
Expand All @@ -844,10 +846,12 @@ private long readAndWriteTracks(MediaExtractor extractor, MP4Builder mediaMuxer,
checkConversionCanceled();
boolean eof = false;
int muxerTrackIndex;
long size = extractor.getSampleSize();
if (size > maxBufferSize) {
maxBufferSize = (int) (size + 1024);
buffer = ByteBuffer.allocateDirect(maxBufferSize);
if (Build.VERSION.SDK_INT >= 28) {
long size = extractor.getSampleSize();
if (size > maxBufferSize) {
maxBufferSize = (int) (size + 1024);
buffer = ByteBuffer.allocateDirect(maxBufferSize);
}
}
info.size = extractor.readSampleData(buffer, 0);
int index = extractor.getSampleTrackIndex();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -447,10 +447,15 @@ public ActionBarMenu createActionMode(boolean needTop, String tag) {
actionMode = null;
}
actionModeTag = tag;
actionMode = new ActionBarMenu(getContext(), this);
actionMode = new ActionBarMenu(getContext(), this) {
@Override
public void setBackgroundColor(int color) {
super.setBackgroundColor(actionModeColor = color);
}
};
actionMode.isActionMode = true;
actionMode.setClickable(true);
actionMode.setBackgroundColor(actionModeColor = Theme.getColor(Theme.key_actionBarActionModeDefault));
actionMode.setBackgroundColor(Theme.getColor(Theme.key_actionBarActionModeDefault));
addView(actionMode, indexOfChild(backButtonImageView));
actionMode.setPadding(0, occupyStatusBar ? AndroidUtilities.statusBarHeight : 0, 0, 0);
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) actionMode.getLayoutParams();
Expand Down Expand Up @@ -680,10 +685,14 @@ public void setSearchTextColor(int color, boolean placeholder) {

public void setActionModeColor(int color) {
if (actionMode != null) {
actionMode.setBackgroundColor(actionModeColor = color);
actionMode.setBackgroundColor(color);
}
}

public void setActionModeOverrideColor(int color) {
actionModeColor = color;
}

@Override
public void setBackgroundColor(int color) {
super.setBackgroundColor(actionBarColor = color);
Expand Down
25 changes: 17 additions & 8 deletions TMessagesProj/src/main/java/org/telegram/ui/ChatUsersActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -905,14 +905,23 @@ public void didSelectUsers(ArrayList<TLRPC.User> users, int fwdCount) {
getMessagesController().putUser(user, false);

if (map.get(user.id) == null) {
TLRPC.ChatParticipant participant = new TLRPC.TL_chatParticipant();
participant.inviter_id = getUserConfig().getClientUserId();
participant.user_id = user.id;
participant.date = getConnectionsManager().getCurrentTime();

array.add(k, participant);
k++;
map.put(user.id, participant);
if (ChatObject.isChannel(currentChat)) {
TLRPC.TL_channelParticipant channelParticipant1 = new TLRPC.TL_channelParticipant();
channelParticipant1.inviter_id = getUserConfig().getClientUserId();
channelParticipant1.user_id = user.id;
channelParticipant1.date = getConnectionsManager().getCurrentTime();
array.add(k, channelParticipant1);
k++;
map.put(user.id, channelParticipant1);
} else {
TLRPC.ChatParticipant participant = new TLRPC.TL_chatParticipant();
participant.user_id = user.id;
participant.inviter_id = getUserConfig().getClientUserId();
array.add(k, participant);
k++;
map.put(user.id, participant);
}

}
}
if (array == participants) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,8 @@ public static Dialog processError(int currentAccount, TLRPC.TL_error error, Base
showSimpleAlert(fragment, LocaleController.getString("ImportErrorTitle", R.string.ImportErrorTitle), LocaleController.getString("ImportErrorFileLang", R.string.ImportErrorFileLang));
} else if (error.text.contains("IMPORT_UPLOAD_FAILED")) {
showSimpleAlert(fragment, LocaleController.getString("ImportErrorTitle", R.string.ImportErrorTitle), LocaleController.getString("ImportFailedToUpload", R.string.ImportFailedToUpload));
} else if (error.text.startsWith("FLOOD_WAIT")) {
showFloodWaitAlert(error.text, fragment);
} else {
showSimpleAlert(fragment, LocaleController.getString("ImportErrorTitle", R.string.ImportErrorTitle), LocaleController.getString("ErrorOccurred", R.string.ErrorOccurred) + "\n" + error.text);
}
Expand Down Expand Up @@ -171,7 +173,7 @@ public static Dialog processError(int currentAccount, TLRPC.TL_error error, Base
}
return null;
} else if (fragment != null) {
AlertsCreator.showAddUserAlert(error.text, fragment, args != null && args.length > 0 ? (Boolean) args[0] : false, request);
showAddUserAlert(error.text, fragment, args != null && args.length > 0 ? (Boolean) args[0] : false, request);
} else {
if (error.text.equals("PEER_FLOOD")) {
NotificationCenter.getInstance(currentAccount).postNotificationName(NotificationCenter.needShowAlert, 1);
Expand All @@ -182,18 +184,18 @@ public static Dialog processError(int currentAccount, TLRPC.TL_error error, Base
fragment.presentFragment(new TooManyCommunitiesActivity(TooManyCommunitiesActivity.TYPE_CREATE));
return null;
} else if (error.text.startsWith("FLOOD_WAIT")) {
AlertsCreator.showFloodWaitAlert(error.text, fragment);
showFloodWaitAlert(error.text, fragment);
} else {
AlertsCreator.showAddUserAlert(error.text, fragment, false, request);
showAddUserAlert(error.text, fragment, false, request);
}
} else if (request instanceof TLRPC.TL_channels_createChannel) {
if (error.text.equals("CHANNELS_TOO_MUCH")) {
fragment.presentFragment(new TooManyCommunitiesActivity(TooManyCommunitiesActivity.TYPE_CREATE));
return null;
} else if (error.text.startsWith("FLOOD_WAIT")) {
AlertsCreator.showFloodWaitAlert(error.text, fragment);
showFloodWaitAlert(error.text, fragment);
} else {
AlertsCreator.showAddUserAlert(error.text, fragment, false, request);
showAddUserAlert(error.text, fragment, false, request);
}
} else if (request instanceof TLRPC.TL_messages_editMessage) {
if (!error.text.equals("MESSAGE_NOT_MODIFIED")) {
Expand Down Expand Up @@ -484,7 +486,7 @@ public static boolean checkSlowMode(Context context, int currentAccount, long di
}
}
if (few) {
AlertsCreator.createSimpleAlert(context, chat.title, LocaleController.getString("SlowmodeSendError", R.string.SlowmodeSendError)).show();
createSimpleAlert(context, chat.title, LocaleController.getString("SlowmodeSendError", R.string.SlowmodeSendError)).show();
return true;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -580,6 +580,17 @@ public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
info.addAction(AccessibilityNodeInfo.ACTION_LONG_CLICK);
}
}

public void clearTransitionParams() {
animateChange = false;
animateTabCounter = false;
animateCounterChange = false;
animateTextChange = false;
animateTextX = false;
animateTabWidth = false;
changeAnimator = null;
invalidate();
}
}

private TextPaint textPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG);
Expand Down Expand Up @@ -814,14 +825,7 @@ protected void animateMoveImpl(RecyclerView.ViewHolder holder, MoveInfo moveInfo
valueAnimator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
tabView.animateChange = false;
tabView.animateTabCounter = false;
tabView.animateCounterChange = false;
tabView.animateTextChange = false;
tabView.animateTextX = false;
tabView.animateTabWidth = false;
tabView.changeAnimator = null;
tabView.invalidate();
tabView.clearTransitionParams();
}
});
tabView.changeAnimator = valueAnimator;
Expand All @@ -835,6 +839,18 @@ public void onAnimationEnd(Animator animation) {
public void onMoveFinished(RecyclerView.ViewHolder item) {
super.onMoveFinished(item);
item.itemView.setTranslationX(0);
if (item.itemView instanceof TabView) {
((TabView) item.itemView).clearTransitionParams();
}
}

@Override
public void endAnimation(RecyclerView.ViewHolder item) {
super.endAnimation(item);
item.itemView.setTranslationX(0);
if (item.itemView instanceof TabView) {
((TabView) item.itemView).clearTransitionParams();
}
}
};
itemAnimator.setDelayAnimations(false);
Expand Down
Loading

2 comments on commit 3480f19

@AlexandrKozlovskiy
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@DrKLO Please,fix accessibility issue,when talkback not announce number of comments on button,connected with comments to message in channel. As i understood watching your code,you set contentDescription for virtual view (button),connected with number of comments ,using text from staticLayout,but in some cases text in staticLayout use strings with key CommentsNoNumber,so you should set contentDescription of virtual view not using text of staticLayout in chatMessageCell.

@sanam3155
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Telegram leaking my data and people are blackmailing me
telegram please take notice
if you need proof please contact me [email protected]

Please sign in to comment.