1
0
mirror of https://github.com/NekoX-Dev/NekoX.git synced 2024-12-14 19:29:41 +01:00

Merge upstream 7.4.2 (2227)

This commit is contained in:
世界 2021-01-31 08:57:52 +08:00
commit bb0a1720a7
No known key found for this signature in database
GPG Key ID: CD109927C34A63C4
15 changed files with 145 additions and 74 deletions

View File

@ -1,8 +1,8 @@
apply plugin: 'com.android.application' apply plugin: 'com.android.application'
apply plugin: 'kotlin-android' apply plugin: 'kotlin-android'
def verName = "7.4.2-preview-2226" def verName = "7.4.2-preview-2227"
def verCode = 170 def verCode = 171
def serviceAccountCredentialsFile = rootProject.file("service_account_credentials.json") def serviceAccountCredentialsFile = rootProject.file("service_account_credentials.json")

View File

@ -209,6 +209,7 @@ public class DefaultItemAnimator extends SimpleItemAnimator {
return true; return true;
} }
public void setDelayAnimations(boolean value) { public void setDelayAnimations(boolean value) {
delayAnimations = value; delayAnimations = value;
} }

View File

@ -491,6 +491,9 @@ public class MessagesController extends BaseController implements NotificationCe
} }
public boolean includesDialog(AccountInstance accountInstance, int lowerId, TLRPC.Dialog d) { public boolean includesDialog(AccountInstance accountInstance, int lowerId, TLRPC.Dialog d) {
if (neverShow.contains(lowerId)) {
return false;
}
if (alwaysShow.contains(lowerId)) { if (alwaysShow.contains(lowerId)) {
return true; return true;
} }
@ -501,8 +504,7 @@ public class MessagesController extends BaseController implements NotificationCe
ContactsController contactsController = accountInstance.getContactsController(); ContactsController contactsController = accountInstance.getContactsController();
boolean skip = false; boolean skip = false;
if ((flags & DIALOG_FILTER_FLAG_EXCLUDE_MUTED) != 0 && messagesController.isDialogMuted(d.id) && d.unread_mentions_count == 0 || 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 || (flags & DIALOG_FILTER_FLAG_EXCLUDE_READ) != 0 && d.unread_count == 0 && !d.unread_mark && d.unread_mentions_count == 0) {
neverShow.contains(lowerId)) {
return false; return false;
} }
if (lowerId > 0) { if (lowerId > 0) {
@ -3035,7 +3037,7 @@ public class MessagesController extends BaseController implements NotificationCe
value = 0; value = 0;
} }
dialogs_read_outbox_max.put(dialog.id, Math.max(dialog.read_outbox_max_id, value)); 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) { if (dialog.peer.channel_id != 0) {
TLRPC.TL_updateReadChannelOutbox update = new TLRPC.TL_updateReadChannelOutbox(); TLRPC.TL_updateReadChannelOutbox update = new TLRPC.TL_updateReadChannelOutbox();
update.channel_id = dialog.peer.channel_id; update.channel_id = dialog.peer.channel_id;
@ -3162,7 +3164,7 @@ public class MessagesController extends BaseController implements NotificationCe
} }
dialogs_read_inbox_max.put(dialog_id, Math.max(res.full_chat.read_inbox_max_id, value)); 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<>(); ArrayList<TLRPC.Update> arrayList = new ArrayList<>();
TLRPC.TL_updateReadChannelInbox update = new TLRPC.TL_updateReadChannelInbox(); TLRPC.TL_updateReadChannelInbox update = new TLRPC.TL_updateReadChannelInbox();
update.channel_id = chat_id; update.channel_id = chat_id;
@ -3176,7 +3178,7 @@ public class MessagesController extends BaseController implements NotificationCe
value = getMessagesStorage().getDialogReadMax(true, dialog_id); value = getMessagesStorage().getDialogReadMax(true, dialog_id);
} }
dialogs_read_outbox_max.put(dialog_id, Math.max(res.full_chat.read_outbox_max_id, value)); 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<>(); ArrayList<TLRPC.Update> arrayList = new ArrayList<>();
TLRPC.TL_updateReadChannelOutbox update = new TLRPC.TL_updateReadChannelOutbox(); TLRPC.TL_updateReadChannelOutbox update = new TLRPC.TL_updateReadChannelOutbox();
update.channel_id = chat_id; update.channel_id = chat_id;
@ -12016,6 +12018,9 @@ public class MessagesController extends BaseController implements NotificationCe
dialogs_read_inbox_max.put(dialog_id, Math.max(value, update.max_id)); dialogs_read_inbox_max.put(dialog_id, Math.max(value, update.max_id));
} else if (baseUpdate instanceof TLRPC.TL_updateReadChannelOutbox) { } else if (baseUpdate instanceof TLRPC.TL_updateReadChannelOutbox) {
TLRPC.TL_updateReadChannelOutbox update = (TLRPC.TL_updateReadChannelOutbox) baseUpdate; 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; long message_id = update.max_id;
message_id |= ((long) update.channel_id) << 32; message_id |= ((long) update.channel_id) << 32;
long dialog_id = -update.channel_id; long dialog_id = -update.channel_id;

View File

@ -138,7 +138,7 @@ public class SendMessagesHelper extends BaseController implements NotificationCe
} }
}); });
} }
}); }, ConnectionsManager.RequestFlagFailOnServerErrors);
} }
public long getUploadedCount() { public long getUploadedCount() {
@ -235,7 +235,7 @@ public class SendMessagesHelper extends BaseController implements NotificationCe
} }
}); });
} }
}); }, ConnectionsManager.RequestFlagFailOnServerErrors);
} }
private void startImport() { private void startImport() {

View File

@ -51,6 +51,7 @@ class ShortcutRemoteViewsFactory implements RemoteViewsService.RemoteViewsFactor
public ShortcutRemoteViewsFactory(Context context, Intent intent) { public ShortcutRemoteViewsFactory(Context context, Intent intent) {
mContext = context; mContext = context;
Theme.createDialogsResources(context);
appWidgetId = intent.getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID); appWidgetId = intent.getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID);
SharedPreferences preferences = context.getSharedPreferences("shortcut_widget", Activity.MODE_PRIVATE); SharedPreferences preferences = context.getSharedPreferences("shortcut_widget", Activity.MODE_PRIVATE);
int accountId = preferences.getInt("account" + appWidgetId, -1); int accountId = preferences.getInt("account" + appWidgetId, -1);

View File

@ -424,7 +424,7 @@ public class MediaCodecVideoConvertor {
FileLog.e(e); //s20 ultra exception FileLog.e(e); //s20 ultra exception
} }
if (maxBufferSize <= 0) { if (maxBufferSize <= 0) {
maxBufferSize = 16 * 1024; maxBufferSize = 64 * 1024;
} }
audioBuffer = ByteBuffer.allocateDirect(maxBufferSize); audioBuffer = ByteBuffer.allocateDirect(maxBufferSize);
@ -487,10 +487,12 @@ public class MediaCodecVideoConvertor {
} }
} }
} else if (copyAudioBuffer && audioIndex != -1 && index == audioIndex) { } else if (copyAudioBuffer && audioIndex != -1 && index == audioIndex) {
long size = extractor.getSampleSize(); if (Build.VERSION.SDK_INT >= 28) {
if (size > maxBufferSize) { long size = extractor.getSampleSize();
maxBufferSize = (int) (size + 1024); if (size > maxBufferSize) {
audioBuffer = ByteBuffer.allocateDirect(maxBufferSize); maxBufferSize = (int) (size + 1024);
audioBuffer = ByteBuffer.allocateDirect(maxBufferSize);
}
} }
info.size = extractor.readSampleData(audioBuffer, 0); info.size = extractor.readSampleData(audioBuffer, 0);
if (Build.VERSION.SDK_INT < 21) { if (Build.VERSION.SDK_INT < 21) {
@ -834,7 +836,7 @@ public class MediaCodecVideoConvertor {
} }
} }
if (maxBufferSize <= 0) { if (maxBufferSize <= 0) {
maxBufferSize = 16 * 1024; maxBufferSize = 64 * 1024;
} }
ByteBuffer buffer = ByteBuffer.allocateDirect(maxBufferSize); ByteBuffer buffer = ByteBuffer.allocateDirect(maxBufferSize);
if (audioTrackIndex >= 0 || videoTrackIndex >= 0) { if (audioTrackIndex >= 0 || videoTrackIndex >= 0) {
@ -844,10 +846,12 @@ public class MediaCodecVideoConvertor {
checkConversionCanceled(); checkConversionCanceled();
boolean eof = false; boolean eof = false;
int muxerTrackIndex; int muxerTrackIndex;
long size = extractor.getSampleSize(); if (Build.VERSION.SDK_INT >= 28) {
if (size > maxBufferSize) { long size = extractor.getSampleSize();
maxBufferSize = (int) (size + 1024); if (size > maxBufferSize) {
buffer = ByteBuffer.allocateDirect(maxBufferSize); maxBufferSize = (int) (size + 1024);
buffer = ByteBuffer.allocateDirect(maxBufferSize);
}
} }
info.size = extractor.readSampleData(buffer, 0); info.size = extractor.readSampleData(buffer, 0);
int index = extractor.getSampleTrackIndex(); int index = extractor.getSampleTrackIndex();

View File

@ -451,10 +451,15 @@ public class ActionBar extends FrameLayout {
actionMode = null; actionMode = null;
} }
actionModeTag = tag; 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.isActionMode = true;
actionMode.setClickable(true); actionMode.setClickable(true);
actionMode.setBackgroundColor(actionModeColor = Theme.getColor(Theme.key_actionBarActionModeDefault)); actionMode.setBackgroundColor(Theme.getColor(Theme.key_actionBarActionModeDefault));
addView(actionMode, indexOfChild(backButtonImageView)); addView(actionMode, indexOfChild(backButtonImageView));
actionMode.setPadding(0, occupyStatusBar ? AndroidUtilities.statusBarHeight : 0, 0, 0); actionMode.setPadding(0, occupyStatusBar ? AndroidUtilities.statusBarHeight : 0, 0, 0);
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) actionMode.getLayoutParams(); FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) actionMode.getLayoutParams();
@ -685,10 +690,14 @@ public class ActionBar extends FrameLayout {
public void setActionModeColor(int color) { public void setActionModeColor(int color) {
if (actionMode != null) { if (actionMode != null) {
actionMode.setBackgroundColor(actionModeColor = color); actionMode.setBackgroundColor(color);
} }
} }
public void setActionModeOverrideColor(int color) {
actionModeColor = color;
}
@Override @Override
public void setBackgroundColor(int color) { public void setBackgroundColor(int color) {
super.setBackgroundColor(actionBarColor = color); super.setBackgroundColor(actionBarColor = color);

View File

@ -921,14 +921,23 @@ public class ChatUsersActivity extends BaseFragment implements NotificationCente
getMessagesController().putUser(user, false); getMessagesController().putUser(user, false);
if (map.get(user.id) == null) { if (map.get(user.id) == null) {
TLRPC.ChatParticipant participant = new TLRPC.TL_chatParticipant(); if (ChatObject.isChannel(currentChat)) {
participant.inviter_id = getUserConfig().getClientUserId(); TLRPC.TL_channelParticipant channelParticipant1 = new TLRPC.TL_channelParticipant();
participant.user_id = user.id; channelParticipant1.inviter_id = getUserConfig().getClientUserId();
participant.date = getConnectionsManager().getCurrentTime(); 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);
}
array.add(k, participant);
k++;
map.put(user.id, participant);
} }
} }
if (array == participants) { if (array == participants) {

View File

@ -144,6 +144,8 @@ public class AlertsCreator {
showSimpleAlert(fragment, LocaleController.getString("ImportErrorTitle", R.string.ImportErrorTitle), LocaleController.getString("ImportErrorFileLang", R.string.ImportErrorFileLang)); showSimpleAlert(fragment, LocaleController.getString("ImportErrorTitle", R.string.ImportErrorTitle), LocaleController.getString("ImportErrorFileLang", R.string.ImportErrorFileLang));
} else if (error.text.contains("IMPORT_UPLOAD_FAILED")) { } else if (error.text.contains("IMPORT_UPLOAD_FAILED")) {
showSimpleAlert(fragment, LocaleController.getString("ImportErrorTitle", R.string.ImportErrorTitle), LocaleController.getString("ImportFailedToUpload", R.string.ImportFailedToUpload)); 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 { } else {
showSimpleAlert(fragment, LocaleController.getString("ImportErrorTitle", R.string.ImportErrorTitle), LocaleController.getString("ErrorOccurred", R.string.ErrorOccurred) + "\n" + error.text); showSimpleAlert(fragment, LocaleController.getString("ImportErrorTitle", R.string.ImportErrorTitle), LocaleController.getString("ErrorOccurred", R.string.ErrorOccurred) + "\n" + error.text);
} }
@ -175,7 +177,7 @@ public class AlertsCreator {
} }
return null; return null;
} else if (fragment != 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 { } else {
if (error.text.equals("PEER_FLOOD")) { if (error.text.equals("PEER_FLOOD")) {
NotificationCenter.getInstance(currentAccount).postNotificationName(NotificationCenter.needShowAlert, 1); NotificationCenter.getInstance(currentAccount).postNotificationName(NotificationCenter.needShowAlert, 1);
@ -186,18 +188,18 @@ public class AlertsCreator {
fragment.presentFragment(new TooManyCommunitiesActivity(TooManyCommunitiesActivity.TYPE_CREATE)); fragment.presentFragment(new TooManyCommunitiesActivity(TooManyCommunitiesActivity.TYPE_CREATE));
return null; return null;
} else if (error.text.startsWith("FLOOD_WAIT")) { } else if (error.text.startsWith("FLOOD_WAIT")) {
AlertsCreator.showFloodWaitAlert(error.text, fragment); showFloodWaitAlert(error.text, fragment);
} else { } else {
AlertsCreator.showAddUserAlert(error.text, fragment, false, request); showAddUserAlert(error.text, fragment, false, request);
} }
} else if (request instanceof TLRPC.TL_channels_createChannel) { } else if (request instanceof TLRPC.TL_channels_createChannel) {
if (error.text.equals("CHANNELS_TOO_MUCH")) { if (error.text.equals("CHANNELS_TOO_MUCH")) {
fragment.presentFragment(new TooManyCommunitiesActivity(TooManyCommunitiesActivity.TYPE_CREATE)); fragment.presentFragment(new TooManyCommunitiesActivity(TooManyCommunitiesActivity.TYPE_CREATE));
return null; return null;
} else if (error.text.startsWith("FLOOD_WAIT")) { } else if (error.text.startsWith("FLOOD_WAIT")) {
AlertsCreator.showFloodWaitAlert(error.text, fragment); showFloodWaitAlert(error.text, fragment);
} else { } else {
AlertsCreator.showAddUserAlert(error.text, fragment, false, request); showAddUserAlert(error.text, fragment, false, request);
} }
} else if (request instanceof TLRPC.TL_messages_editMessage) { } else if (request instanceof TLRPC.TL_messages_editMessage) {
if (!error.text.equals("MESSAGE_NOT_MODIFIED")) { if (!error.text.equals("MESSAGE_NOT_MODIFIED")) {
@ -488,7 +490,7 @@ public class AlertsCreator {
} }
} }
if (few) { 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; return true;
} }
} }

View File

@ -596,6 +596,17 @@ public class FilterTabsView extends FrameLayout {
info.addAction(AccessibilityNodeInfo.ACTION_LONG_CLICK); 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); private TextPaint textPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG);
@ -830,14 +841,7 @@ public class FilterTabsView extends FrameLayout {
valueAnimator.addListener(new AnimatorListenerAdapter() { valueAnimator.addListener(new AnimatorListenerAdapter() {
@Override @Override
public void onAnimationEnd(Animator animation) { public void onAnimationEnd(Animator animation) {
tabView.animateChange = false; tabView.clearTransitionParams();
tabView.animateTabCounter = false;
tabView.animateCounterChange = false;
tabView.animateTextChange = false;
tabView.animateTextX = false;
tabView.animateTabWidth = false;
tabView.changeAnimator = null;
tabView.invalidate();
} }
}); });
tabView.changeAnimator = valueAnimator; tabView.changeAnimator = valueAnimator;
@ -851,6 +855,18 @@ public class FilterTabsView extends FrameLayout {
public void onMoveFinished(RecyclerView.ViewHolder item) { public void onMoveFinished(RecyclerView.ViewHolder item) {
super.onMoveFinished(item); super.onMoveFinished(item);
item.itemView.setTranslationX(0); 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); itemAnimator.setDelayAnimations(false);

View File

@ -479,7 +479,7 @@ public class ContentPreviewViewer {
clearsInputField = stickerCell.isClearsInputField(); clearsInputField = stickerCell.isClearsInputField();
} else if (currentPreviewCell instanceof ContextLinkCell) { } else if (currentPreviewCell instanceof ContextLinkCell) {
ContextLinkCell contextLinkCell = (ContextLinkCell) currentPreviewCell; ContextLinkCell contextLinkCell = (ContextLinkCell) currentPreviewCell;
open(contextLinkCell.getDocument(), delegate != null ? delegate.getQuery(true) : null, contextLinkCell.getBotInlineResult(), contentType, false, contextLinkCell.getInlineBot()); open(contextLinkCell.getDocument(), delegate != null ? delegate.getQuery(true) : null, contextLinkCell.getBotInlineResult(), contentType, false, contextLinkCell.getBotInlineResult() != null ? contextLinkCell.getInlineBot() : contextLinkCell.getParentObject());
if (contentType != CONTENT_TYPE_GIF) { if (contentType != CONTENT_TYPE_GIF) {
contextLinkCell.setScaled(true); contextLinkCell.setScaled(true);
} }
@ -576,7 +576,7 @@ public class ContentPreviewViewer {
clearsInputField = stickerCell.isClearsInputField(); clearsInputField = stickerCell.isClearsInputField();
} else if (currentPreviewCell instanceof ContextLinkCell) { } else if (currentPreviewCell instanceof ContextLinkCell) {
ContextLinkCell contextLinkCell = (ContextLinkCell) currentPreviewCell; ContextLinkCell contextLinkCell = (ContextLinkCell) currentPreviewCell;
open(contextLinkCell.getDocument(), delegate != null ? delegate.getQuery(true) : null, contextLinkCell.getBotInlineResult(), contentTypeFinal, false, contextLinkCell.getInlineBot()); open(contextLinkCell.getDocument(), delegate != null ? delegate.getQuery(true) : null, contextLinkCell.getBotInlineResult(), contentTypeFinal, false, contextLinkCell.getBotInlineResult() != null ? contextLinkCell.getInlineBot() : contextLinkCell.getParentObject());
if (contentTypeFinal != CONTENT_TYPE_GIF) { if (contentTypeFinal != CONTENT_TYPE_GIF) {
contextLinkCell.setScaled(true); contextLinkCell.setScaled(true);
} }

View File

@ -1121,20 +1121,12 @@ private int lastMeasuredTopPadding;
public void addView(View child, int index, ViewGroup.LayoutParams params) { public void addView(View child, int index, ViewGroup.LayoutParams params) {
super.addView(child, index, params); super.addView(child, index, params);
child.setTranslationY(viewOffset); child.setTranslationY(viewOffset);
int position = getChildAdapterPosition(child);
Float alpha = listAlphaItems.get(position);
if (alpha != null) {
child.setAlpha(alpha);
} else {
child.setAlpha(1f);
}
} }
@Override @Override
public void removeView(View view) { public void removeView(View view) {
super.removeView(view); super.removeView(view);
view.setTranslationY(0); view.setTranslationY(0);
view.setAlpha(1f);
} }
@Override @Override
@ -1156,6 +1148,16 @@ private int lastMeasuredTopPadding;
@Override @Override
protected void dispatchDraw(Canvas canvas) { protected void dispatchDraw(Canvas canvas) {
for (int i = 0; i < getChildCount(); i++) {
View child = getChildAt(i);
int position = getChildAdapterPosition(child);
Float alpha = listAlphaItems.get(position, null);
if (alpha == null) {
child.setAlpha(1f);
} else {
child.setAlpha(alpha);
}
}
super.dispatchDraw(canvas); super.dispatchDraw(canvas);
if (slidingView != null && pacmanAnimation != null) { if (slidingView != null && pacmanAnimation != null) {
pacmanAnimation.draw(canvas, slidingView.getTop() + slidingView.getMeasuredHeight() / 2); pacmanAnimation.draw(canvas, slidingView.getTop() + slidingView.getMeasuredHeight() / 2);
@ -5478,6 +5480,7 @@ private int lastMeasuredTopPadding;
updateAnimated = true; updateAnimated = true;
} else { } else {
createActionMode(); createActionMode();
actionBar.setActionModeOverrideColor(Theme.getColor(Theme.key_windowBackgroundWhite));
actionBar.showActionMode(); actionBar.showActionMode();
resetScroll(); resetScroll();
if (menuDrawable != null) { if (menuDrawable != null) {
@ -6007,7 +6010,6 @@ private int lastMeasuredTopPadding;
listView.getViewTreeObserver().removeOnPreDrawListener(this); listView.getViewTreeObserver().removeOnPreDrawListener(this);
int n = listView.getChildCount(); int n = listView.getChildCount();
AnimatorSet animatorSet = new AnimatorSet(); AnimatorSet animatorSet = new AnimatorSet();
boolean animated = false;
for (int i = 0; i < n; i++) { for (int i = 0; i < n; i++) {
View child = listView.getChildAt(i); View child = listView.getChildAt(i);
int position = listView.getChildAdapterPosition(child); int position = listView.getChildAdapterPosition(child);
@ -6020,29 +6022,13 @@ private int lastMeasuredTopPadding;
a.addUpdateListener(valueAnimator -> { a.addUpdateListener(valueAnimator -> {
Float alpha = (Float) valueAnimator.getAnimatedValue(); Float alpha = (Float) valueAnimator.getAnimatedValue();
listAlphaItems.put(position, alpha); listAlphaItems.put(position, alpha);
if (listView.getChildAdapterPosition(child) == position) { listView.invalidate();
child.setAlpha(alpha);
} else {
RecyclerView.ViewHolder vh = listView.findViewHolderForAdapterPosition(position);
if (vh != null) {
vh.itemView.setAlpha(1f);
}
}
}); });
a.addListener(new AnimatorListenerAdapter() { a.addListener(new AnimatorListenerAdapter() {
@Override @Override
public void onAnimationEnd(Animator animation) { public void onAnimationEnd(Animator animation) {
listAlphaItems.remove(position); listAlphaItems.remove(position);
if (listAlphaItems.size() == 0) { listView.invalidate();
for (int i = 0; i < listView.getChildCount(); i++) {
listView.getChildAt(i).setAlpha(1f);
}
} else {
RecyclerView.ViewHolder vh = listView.findViewHolderForAdapterPosition(position);
if (vh != null) {
vh.itemView.setAlpha(1f);
}
}
} }
}); });
a.setStartDelay(delay); a.setStartDelay(delay);

View File

@ -4054,6 +4054,9 @@ public class LaunchActivity extends Activity implements ActionBarLayout.ActionBa
@Override @Override
protected void onResume() { protected void onResume() {
super.onResume(); super.onResume();
if (Theme.selectedAutoNightType == Theme.AUTO_NIGHT_TYPE_SYSTEM) {
Theme.checkAutoNightThemeConditions();
}
//FileLog.d("UI resume time = " + (SystemClock.elapsedRealtime() - ApplicationLoader.startTime)); //FileLog.d("UI resume time = " + (SystemClock.elapsedRealtime() - ApplicationLoader.startTime));
NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.startAllHeavyOperations, 4096); NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.startAllHeavyOperations, 4096);
MediaController.getInstance().setFeedbackView(actionBarLayout, true); MediaController.getInstance().setFeedbackView(actionBarLayout, true);

View File

@ -1977,6 +1977,11 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
groupedPhotosHeight = 0; groupedPhotosHeight = 0;
} }
if (videoPlayerControlFrameLayout != null) {
videoPlayerControlFrameLayout.parentWidth = widthSize;
videoPlayerControlFrameLayout.parentHeight = heightSize;
}
widthSize -= (getPaddingRight() + getPaddingLeft()); widthSize -= (getPaddingRight() + getPaddingLeft());
heightSize -= getPaddingBottom(); heightSize -= getPaddingBottom();
@ -2275,6 +2280,9 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
private float progress = 1f; private float progress = 1f;
private boolean seekBarTransitionEnabled; private boolean seekBarTransitionEnabled;
private boolean translationYAnimationEnabled = true; private boolean translationYAnimationEnabled = true;
private boolean ignoreLayout;
private int parentWidth;
private int parentHeight;
public VideoPlayerControlFrameLayout(@NonNull Context context) { public VideoPlayerControlFrameLayout(@NonNull Context context) {
super(context); super(context);
@ -2294,11 +2302,20 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
return true; return true;
} }
@Override
public void requestLayout() {
if (ignoreLayout) {
return;
}
super.requestLayout();
}
@Override @Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
int extraWidth; int extraWidth;
ignoreLayout = true;
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) videoPlayerTime.getLayoutParams(); FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) videoPlayerTime.getLayoutParams();
if (containerView.getMeasuredWidth() > containerView.getMeasuredHeight()) { if (parentWidth > parentHeight) {
if (exitFullscreenButton.getVisibility() != VISIBLE) { if (exitFullscreenButton.getVisibility() != VISIBLE) {
exitFullscreenButton.setVisibility(VISIBLE); exitFullscreenButton.setVisibility(VISIBLE);
} }
@ -2311,6 +2328,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
extraWidth = 0; extraWidth = 0;
layoutParams.rightMargin = AndroidUtilities.dp(12); layoutParams.rightMargin = AndroidUtilities.dp(12);
} }
ignoreLayout = false;
super.onMeasure(widthMeasureSpec, heightMeasureSpec); super.onMeasure(widthMeasureSpec, heightMeasureSpec);
long duration; long duration;
if (videoPlayer != null) { if (videoPlayer != null) {
@ -7100,7 +7118,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
break; break;
} }
} }
if (containerView.getMeasuredHeight() > containerView.getMeasuredWidth() && !(videoTextureView instanceof VideoEditTextureView) && w > h) { if (AndroidUtilities.displaySize.y > AndroidUtilities.displaySize.x && !(videoTextureView instanceof VideoEditTextureView) && w > h) {
if (fullscreenButton[b].getVisibility() != View.VISIBLE) { if (fullscreenButton[b].getVisibility() != View.VISIBLE) {
fullscreenButton[b].setVisibility(View.VISIBLE); fullscreenButton[b].setVisibility(View.VISIBLE);
} }
@ -7113,6 +7131,22 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
fullscreenButton[b].setVisibility(View.INVISIBLE); fullscreenButton[b].setVisibility(View.INVISIBLE);
} }
} }
float currentTranslationX;
if (imageMoveAnimation != null) {
currentTranslationX = translationX + (animateToX - translationX) * animationValue;
} else {
currentTranslationX = translationX;
}
float offsetX;
if (b == 1) {
offsetX = 0;
} else if (b == 2) {
offsetX = -AndroidUtilities.displaySize.x - AndroidUtilities.dp(15) + (currentTranslationX - maxX);
} else {
offsetX = currentTranslationX < minX ? (currentTranslationX - minX) : 0;
}
fullscreenButton[b].setTranslationX(offsetX + AndroidUtilities.displaySize.x - AndroidUtilities.dp(48));
} }
} }

View File

@ -160,6 +160,7 @@ public class PopupNotificationActivity extends Activity implements NotificationC
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
Theme.createDialogsResources(this);
Theme.createChatResources(this, false); Theme.createChatResources(this, false);
AndroidUtilities.fillStatusBarHeight(this); AndroidUtilities.fillStatusBarHeight(this);