1
0
mirror of https://github.com/MGislv/NekoX.git synced 2024-07-04 11:13:36 +00:00

Merge official 8.5.4

This commit is contained in:
luvletter2333 2022-02-18 15:23:22 +08:00
commit 32066ecf1f
No known key found for this signature in database
GPG Key ID: A26A8880836E1978
13 changed files with 583 additions and 237 deletions

View File

@ -3,15 +3,15 @@ import cn.hutool.core.util.RuntimeUtil
apply plugin: "com.android.application" apply plugin: "com.android.application"
apply plugin: "kotlin-android" apply plugin: "kotlin-android"
def verName = "8.5.2-rc01" def verName = "8.5.4-preview01"
def verCode = 575 def verCode = 580
if (System.getenv("DEBUG_BUILD") == "true") { if (System.getenv("DEBUG_BUILD") == "true") {
verName += "-" + RuntimeUtil.execForStr("git log --pretty=format:'%h' -n 1").trim() verName += "-" + RuntimeUtil.execForStr("git log --pretty=format:'%h' -n 1").trim()
} }
def officialVer = "8.5.2" def officialVer = "8.5.4"
def officialCode = 2563 def officialCode = 2566
def serviceAccountCredentialsFile = rootProject.file("service_account_credentials.json") def serviceAccountCredentialsFile = rootProject.file("service_account_credentials.json")

View File

@ -31,6 +31,7 @@ import android.database.Cursor;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.graphics.BitmapFactory; import android.graphics.BitmapFactory;
import android.graphics.Color; import android.graphics.Color;
import android.graphics.ColorMatrix;
import android.graphics.Matrix; import android.graphics.Matrix;
import android.graphics.Paint; import android.graphics.Paint;
import android.graphics.Point; import android.graphics.Point;
@ -759,6 +760,17 @@ public class AndroidUtilities {
return new int[]{(int) (r * 255), (int) (g * 255), (int) (b * 255)}; return new int[]{(int) (r * 255), (int) (g * 255), (int) (b * 255)};
} }
public static void lightColorMatrix(ColorMatrix colorMatrix, float addLightness) {
if (colorMatrix == null) {
return;
}
float[] matrix = colorMatrix.getArray();
matrix[4] += addLightness;
matrix[9] += addLightness;
matrix[14] += addLightness;
colorMatrix.set(matrix);
}
public static void requestAdjustResize(Activity activity, int classGuid) { public static void requestAdjustResize(Activity activity, int classGuid) {
if (activity == null || isTablet()) { if (activity == null || isTablet()) {
return; return;

View File

@ -394,6 +394,7 @@ public class MediaDataController extends BaseController {
getMessagesStorage().getStorageQueue().postRunnable(() -> { getMessagesStorage().getStorageQueue().postRunnable(() -> {
try { try {
if (reactionsFinal != null) { if (reactionsFinal != null) {
getMessagesStorage().getDatabase().executeFast("DELETE FROM reactions").stepThis().dispose();
SQLitePreparedStatement state = getMessagesStorage().getDatabase().executeFast("REPLACE INTO reactions VALUES(?, ?, ?)"); SQLitePreparedStatement state = getMessagesStorage().getDatabase().executeFast("REPLACE INTO reactions VALUES(?, ?, ?)");
state.requery(); state.requery();
int size = 4; // Integer.BYTES int size = 4; // Integer.BYTES

View File

@ -48,6 +48,7 @@ import org.telegram.messenger.FileLog;
import org.telegram.messenger.MessagesController; import org.telegram.messenger.MessagesController;
import org.telegram.messenger.R; import org.telegram.messenger.R;
import org.telegram.messenger.SharedConfig; import org.telegram.messenger.SharedConfig;
import org.telegram.ui.Components.BackButtonMenu;
import org.telegram.ui.Components.Bulletin; import org.telegram.ui.Components.Bulletin;
import org.telegram.ui.Components.CubicBezierInterpolator; import org.telegram.ui.Components.CubicBezierInterpolator;
import org.telegram.ui.Components.GroupCallPip; import org.telegram.ui.Components.GroupCallPip;
@ -328,6 +329,7 @@ public class ActionBarLayout extends FrameLayout {
protected Activity parentActivity; protected Activity parentActivity;
public ArrayList<BaseFragment> fragmentsStack; public ArrayList<BaseFragment> fragmentsStack;
public ArrayList<BackButtonMenu.PulledDialog> pulledDialogs;
private Rect rect = new Rect(); private Rect rect = new Rect();
private boolean delayedAnimationResumed; private boolean delayedAnimationResumed;

View File

@ -55,6 +55,7 @@ import android.os.SystemClock;
import android.text.TextPaint; import android.text.TextPaint;
import android.text.TextUtils; import android.text.TextUtils;
import android.util.Base64; import android.util.Base64;
import android.util.Log;
import android.util.LongSparseArray; import android.util.LongSparseArray;
import android.util.SparseArray; import android.util.SparseArray;
import android.util.SparseBooleanArray; import android.util.SparseBooleanArray;
@ -1529,56 +1530,57 @@ public class Theme {
} }
if (!isDarkTheme) { if (!isDarkTheme) {
int outBubble; currentColors.remove(key_chat_selectedBackground);
if (isDarkTheme) { // int outBubble;
outBubble = averageColor(currentColors, key_chat_outBubbleGradient1, key_chat_outBubbleGradient2, key_chat_outBubbleGradient3); // if (isDarkTheme) {
} else if (currentColors.containsKey(key_chat_outBubble)) { // outBubble = averageColor(currentColors, key_chat_outBubbleGradient1, key_chat_outBubbleGradient2, key_chat_outBubbleGradient3);
outBubble = currentColors.get(key_chat_outBubble); // } else if (currentColors.containsKey(key_chat_outBubble)) {
} else { // outBubble = currentColors.get(key_chat_outBubble);
outBubble = getColor(key_chat_outBubble); // } else {
} // outBubble = getColor(key_chat_outBubble);
int inBubbleSelected; // }
if (currentColors.containsKey(key_chat_inBubbleSelected)) { // int inBubbleSelected;
inBubbleSelected = currentColors.get(key_chat_inBubbleSelected); // if (currentColors.containsKey(key_chat_inBubbleSelected)) {
} else { // inBubbleSelected = currentColors.get(key_chat_inBubbleSelected);
inBubbleSelected = getColor(key_chat_inBubbleSelected); // } else {
} // inBubbleSelected = getColor(key_chat_inBubbleSelected);
int gradientAverageColor = 0; // }
if (isDarkTheme) { // int gradientAverageColor = 0;
gradientAverageColor = outBubble; // if (isDarkTheme) {
} // gradientAverageColor = outBubble;
if (gradientAverageColor == 0) { // }
gradientAverageColor = averageColor(currentColors, key_chat_wallpaper_gradient_to1, key_chat_wallpaper_gradient_to2, key_chat_wallpaper_gradient_to3); // if (gradientAverageColor == 0) {
} // gradientAverageColor = averageColor(currentColors, key_chat_wallpaper_gradient_to1, key_chat_wallpaper_gradient_to2, key_chat_wallpaper_gradient_to3);
if (gradientAverageColor == 0) { // }
gradientAverageColor = averageColor(currentColors, key_chat_wallpaper); // if (gradientAverageColor == 0) {
} // gradientAverageColor = averageColor(currentColors, key_chat_wallpaper);
int selectedBackground = currentColors.containsKey(key_chat_selectedBackground) ? currentColors.get(key_chat_selectedBackground) : getColor(key_chat_selectedBackground); // }
selectedBackground = applyHue(selectedBackground, gradientAverageColor); // int selectedBackground = currentColors.containsKey(key_chat_selectedBackground) ? currentColors.get(key_chat_selectedBackground) : getColor(key_chat_selectedBackground);
selectedBackground = darkenColor(selectedBackground, .1f); // selectedBackground = applyHue(selectedBackground, gradientAverageColor);
selectedBackground = Color.argb((int) (Color.alpha(selectedBackground) * 0.8f), Color.red(selectedBackground), Color.green(selectedBackground), Color.blue(selectedBackground)); // selectedBackground = darkenColor(selectedBackground, .1f);
currentColors.put(key_chat_selectedBackground, selectedBackground); // selectedBackground = Color.argb((int) (Color.alpha(selectedBackground) * 0.8f), Color.red(selectedBackground), Color.green(selectedBackground), Color.blue(selectedBackground));
int outBubbleOverlay = bubbleSelectedOverlay(outBubble); // currentColors.put(key_chat_selectedBackground, selectedBackground);
currentColors.put(key_chat_outBubbleGradientSelectedOverlay, outBubbleOverlay); // int outBubbleOverlay = bubbleSelectedOverlay(outBubble);
// currentColors.put(key_chat_outBubbleGradientSelectedOverlay, outBubbleOverlay);
inBubbleSelected = applyHue(inBubbleSelected, gradientAverageColor); //
inBubbleSelected = shiftHSV(inBubbleSelected, 0, .04f, 0); // inBubbleSelected = applyHue(inBubbleSelected, gradientAverageColor);
currentColors.put(key_chat_inBubbleSelected, inBubbleSelected); // inBubbleSelected = shiftHSV(inBubbleSelected, 0, .04f, 0);
// currentColors.put(key_chat_inBubbleSelected, inBubbleSelected);
final String[] inTextSelectedKeys = new String[] { //
key_chat_inTimeSelectedText, key_chat_inAdminSelectedText, key_chat_inAudioDurationSelectedText, // final String[] inTextSelectedKeys = new String[] {
key_chat_inAudioPerformerSelectedText, key_chat_inFileInfoSelectedText, key_chat_inContactPhoneSelectedText, // key_chat_inTimeSelectedText, key_chat_inAdminSelectedText, key_chat_inAudioDurationSelectedText,
key_chat_inPreviewInstantSelectedText, key_chat_inVenueInfoSelectedText, key_chat_inReplyMediaMessageSelectedText // key_chat_inAudioPerformerSelectedText, key_chat_inFileInfoSelectedText, key_chat_inContactPhoneSelectedText,
}; // key_chat_inPreviewInstantSelectedText, key_chat_inVenueInfoSelectedText, key_chat_inReplyMediaMessageSelectedText
for (String inTextSelectedKey : inTextSelectedKeys) { // };
int color = currentColors.containsKey(inTextSelectedKey) ? currentColors.get(inTextSelectedKey) : getColor(inTextSelectedKey); // for (String inTextSelectedKey : inTextSelectedKeys) {
currentColors.put(inTextSelectedKey, applyHue(color, gradientAverageColor)); // int color = currentColors.containsKey(inTextSelectedKey) ? currentColors.get(inTextSelectedKey) : getColor(inTextSelectedKey);
} // currentColors.put(inTextSelectedKey, applyHue(color, gradientAverageColor));
// }
int outTimeSelected = currentColors.containsKey(key_chat_outTimeSelectedText) ? currentColors.get(key_chat_outTimeSelectedText) : getColor(key_chat_outTimeSelectedText); //
double contrast = ColorUtils.calculateContrast(outTimeSelected, mix(outBubble, outBubbleOverlay)); // int outTimeSelected = currentColors.containsKey(key_chat_outTimeSelectedText) ? currentColors.get(key_chat_outTimeSelectedText) : getColor(key_chat_outTimeSelectedText);
currentColors.put(key_chat_outTimeSelectedText, shiftHSV(outTimeSelected, .02f, .01f, contrast < 1.9d ? -.1f : 0f)); // double contrast = ColorUtils.calculateContrast(outTimeSelected, mix(outBubble, outBubbleOverlay));
// currentColors.put(key_chat_outTimeSelectedText, applyHue(outTimeSelected, gradientAverageColor)); // currentColors.put(key_chat_outTimeSelectedText, shiftHSV(outTimeSelected, .02f, .01f, contrast < 1.9d ? -.1f : 0f));
//// currentColors.put(key_chat_outTimeSelectedText, applyHue(outTimeSelected, gradientAverageColor));
} }
return !isMyMessagesGradientColorsNear; return !isMyMessagesGradientColorsNear;
@ -3876,6 +3878,7 @@ public class Theme {
public static final String key_paint_chatActionBackground = "paintChatActionBackground"; public static final String key_paint_chatActionBackground = "paintChatActionBackground";
public static final String key_paint_chatActionBackgroundSelected = "paintChatActionBackgroundSelected"; public static final String key_paint_chatActionBackgroundSelected = "paintChatActionBackgroundSelected";
public static final String key_paint_chatMessageBackgroundSelected = "paintChatMessageBackgroundSelected";
public static final String key_paint_chatActionText = "paintChatActionText"; public static final String key_paint_chatActionText = "paintChatActionText";
public static final String key_paint_chatBotButton = "paintChatBotButton"; public static final String key_paint_chatBotButton = "paintChatBotButton";
public static final String key_paint_chatComposeBackground = "paintChatComposeBackground"; public static final String key_paint_chatComposeBackground = "paintChatComposeBackground";
@ -9212,12 +9215,12 @@ public class Theme {
if (serviceBitmapShader != null && (currentColors.get(key_chat_serviceBackground) == null || drawable instanceof MotionBackgroundDrawable)) { if (serviceBitmapShader != null && (currentColors.get(key_chat_serviceBackground) == null || drawable instanceof MotionBackgroundDrawable)) {
chat_actionBackgroundPaint.setShader(serviceBitmapShader); chat_actionBackgroundPaint.setShader(serviceBitmapShader);
chat_actionBackgroundSelectedPaint.setShader(serviceBitmapShader);
ColorMatrix colorMatrix = new ColorMatrix(); ColorMatrix colorMatrix = new ColorMatrix();
colorMatrix.setSaturation(((MotionBackgroundDrawable) drawable).getIntensity() >= 0 ? 1.8f : 0.5f); colorMatrix.setSaturation(((MotionBackgroundDrawable) drawable).getIntensity() >= 0 ? 1.8f : 0.5f);
chat_actionBackgroundPaint.setColorFilter(new ColorMatrixColorFilter(colorMatrix)); chat_actionBackgroundPaint.setColorFilter(new ColorMatrixColorFilter(colorMatrix));
chat_actionBackgroundPaint.setAlpha(127); chat_actionBackgroundPaint.setAlpha(127);
chat_actionBackgroundSelectedPaint.setShader(serviceBitmapShader);
chat_actionBackgroundSelectedPaint.setColorFilter(new ColorMatrixColorFilter(colorMatrix)); chat_actionBackgroundSelectedPaint.setColorFilter(new ColorMatrixColorFilter(colorMatrix));
chat_actionBackgroundSelectedPaint.setAlpha(200); chat_actionBackgroundSelectedPaint.setAlpha(200);
} else { } else {

View File

@ -271,6 +271,7 @@ public class ThemeDescription {
Drawable background = viewToInvalidate.getBackground(); Drawable background = viewToInvalidate.getBackground();
if (background instanceof MessageBackgroundDrawable) { if (background instanceof MessageBackgroundDrawable) {
((MessageBackgroundDrawable) background).setColor(color); ((MessageBackgroundDrawable) background).setColor(color);
((MessageBackgroundDrawable) background).setCustomPaint(null);
} else { } else {
viewToInvalidate.setBackgroundColor(color); viewToInvalidate.setBackgroundColor(color);
} }
@ -589,6 +590,7 @@ public class ThemeDescription {
Drawable background = view.getBackground(); Drawable background = view.getBackground();
if (background instanceof MessageBackgroundDrawable) { if (background instanceof MessageBackgroundDrawable) {
((MessageBackgroundDrawable) background).setColor(color); ((MessageBackgroundDrawable) background).setColor(color);
((MessageBackgroundDrawable) background).setCustomPaint(null);
} else { } else {
view.setBackgroundColor(color); view.setBackgroundColor(color);
} }

View File

@ -608,6 +608,9 @@ public class CacheControlActivity extends BaseFragment {
SQLiteDatabase database = MessagesStorage.getInstance(currentAccount).getDatabase(); SQLiteDatabase database = MessagesStorage.getInstance(currentAccount).getDatabase();
ArrayList<Long> dialogsToCleanup = new ArrayList<>(); ArrayList<Long> dialogsToCleanup = new ArrayList<>();
database.executeFast("DELETE FROM reaction_mentions").stepThis().dispose();
database.executeFast("DELETE FROM reaction_mentions").stepThis().dispose();
SQLiteCursor cursor = database.queryFinalized("SELECT did FROM dialogs WHERE 1"); SQLiteCursor cursor = database.queryFinalized("SELECT did FROM dialogs WHERE 1");
StringBuilder ids = new StringBuilder(); StringBuilder ids = new StringBuilder();
while (cursor.next()) { while (cursor.next()) {

View File

@ -896,7 +896,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
private int lastRepliesCount; private int lastRepliesCount;
private float selectedBackgroundProgress; private float selectedBackgroundProgress;
private float viewTop; public float viewTop;
private int backgroundHeight; private int backgroundHeight;
private boolean scheduledInvalidate; private boolean scheduledInvalidate;

View File

@ -269,6 +269,7 @@ import java.io.ByteArrayOutputStream;
import java.io.File; import java.io.File;
import java.io.FileOutputStream; import java.io.FileOutputStream;
import java.io.FileWriter; import java.io.FileWriter;
import java.io.InputStream;
import java.net.URLDecoder; import java.net.URLDecoder;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
@ -2160,8 +2161,10 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
pinchToZoomHelper.clear(); pinchToZoomHelper.clear();
} }
chatThemeBottomSheet = null; chatThemeBottomSheet = null;
ActionBarLayout parentLayout = getParentLayout();
if (parentLayout != null && parentLayout.fragmentsStack != null) { if (parentLayout != null && parentLayout.fragmentsStack != null) {
BackButtonMenu.clearPulledDialogs(currentAccount, parentLayout.fragmentsStack.indexOf(this) - (replacingChatActivity ? 0 : 1)); BackButtonMenu.clearPulledDialogs(this, parentLayout.fragmentsStack.indexOf(this) - (replacingChatActivity ? 0 : 1));
} }
replacingChatActivity = false; replacingChatActivity = false;
} }
@ -4730,38 +4733,32 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
} else if (child instanceof ChatMessageCell) { } else if (child instanceof ChatMessageCell) {
ChatMessageCell cell = (ChatMessageCell) child; ChatMessageCell cell = (ChatMessageCell) child;
MessageObject.GroupedMessages group = cell.getCurrentMessagesGroup(); MessageObject.GroupedMessages group = cell.getCurrentMessagesGroup();
if (scrimView != cell && group == null && cell.drawBackgroundInParent()) { if (group == null || group != lastDrawnGroup) {
canvas.save();
canvas.translate(cell.getX(), cell.getY());
if (cell.getScaleX() != 1f) {
canvas.scale(
cell.getScaleX(), cell.getScaleY(),
cell.getPivotX(), (cell.getHeight() >> 1)
);
}
cell.drawBackgroundInternal(canvas, true);
canvas.restore();
}
if (group != null && group == lastDrawnGroup) {
continue;
}
lastDrawnGroup = group; lastDrawnGroup = group;
MessageObject.GroupedMessagePosition position = cell.getCurrentPosition(); MessageObject.GroupedMessagePosition position = cell.getCurrentPosition();
MessageBackgroundDrawable backgroundDrawable = cell.getBackgroundDrawable(); MessageBackgroundDrawable backgroundDrawable = cell.getBackgroundDrawable();
if ((backgroundDrawable.isAnimationInProgress() || cell.isDrawingSelectionBackground()) && (position == null || (position.flags & MessageObject.POSITION_FLAG_RIGHT) != 0)) { if ((backgroundDrawable.isAnimationInProgress() || cell.isDrawingSelectionBackground()) && (position == null || (position.flags & MessageObject.POSITION_FLAG_RIGHT) != 0)) {
if (cell.isHighlighted() || cell.isHighlightedAnimated()) { if (cell.isHighlighted() || cell.isHighlightedAnimated()) {
if (position == null) { if (position == null) {
int color = getThemedColor(Theme.key_chat_selectedBackground); Paint backgroundPaint = getThemedPaint(Theme.key_paint_chatMessageBackgroundSelected);
int alpha = Color.alpha(color); if (themeDelegate.isDark || backgroundPaint == null) {
backgroundPaint = Theme.chat_replyLinePaint;
backgroundPaint.setColor(getThemedColor(Theme.key_chat_selectedBackground));
}
canvas.save(); canvas.save();
canvas.translate(0, cell.getTranslationY()); canvas.translate(0, cell.getTranslationY());
Theme.chat_replyLinePaint.setColor(getThemedColor(Theme.key_chat_selectedBackground)); int wasAlpha = backgroundPaint.getAlpha();
Theme.chat_replyLinePaint.setAlpha((int) (alpha * cell.getHightlightAlpha() * cell.getAlpha())); backgroundPaint.setAlpha((int) (wasAlpha * cell.getHightlightAlpha() * cell.getAlpha()));
canvas.drawRect(0, cell.getTop(), getMeasuredWidth(), cell.getBottom(), Theme.chat_replyLinePaint); if (themeDelegate != null) {
themeDelegate.applyServiceShaderMatrix(getMeasuredWidth(), cell.getHeight(), 0, cell.getTop());
} else {
Theme.applyServiceShaderMatrix(getMeasuredWidth(), cell.getHeight(), 0, cell.getTop());
}
canvas.drawRect(0, cell.getTop(), getMeasuredWidth(), cell.getBottom(), backgroundPaint);
backgroundPaint.setAlpha(wasAlpha);
canvas.restore(); canvas.restore();
} }
} else { } else {
backgroundDrawable.setColor(getThemedColor(Theme.key_chat_selectedBackground));
int y = (int) cell.getY(); int y = (int) cell.getY();
int height; int height;
canvas.save(); canvas.save();
@ -4794,12 +4791,36 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
height -= y; height -= y;
} }
canvas.clipRect(0, y, getMeasuredWidth(), y + height); canvas.clipRect(0, y, getMeasuredWidth(), y + height);
canvas.translate(0, y); Paint selectedBackgroundPaint = getThemedPaint(Theme.key_paint_chatMessageBackgroundSelected);
backgroundDrawable.setBounds(0, 0, getMeasuredWidth(), height); if (!themeDelegate.isDark && selectedBackgroundPaint != null) {
backgroundDrawable.setCustomPaint(selectedBackgroundPaint);
if (themeDelegate != null) {
themeDelegate.applyServiceShaderMatrix(getMeasuredWidth(), height, 0, 0);
} else {
Theme.applyServiceShaderMatrix(getMeasuredWidth(), height, 0, 0);
}
} else {
backgroundDrawable.setCustomPaint(null);
backgroundDrawable.setColor(getThemedColor(Theme.key_chat_selectedBackground));
}
backgroundDrawable.setBounds(0, y, getMeasuredWidth(), y + height);
backgroundDrawable.draw(canvas); backgroundDrawable.draw(canvas);
canvas.restore(); canvas.restore();
} }
} }
}
if (scrimView != cell && group == null && cell.drawBackgroundInParent()) {
canvas.save();
canvas.translate(cell.getX(), cell.getY());
if (cell.getScaleX() != 1f) {
canvas.scale(
cell.getScaleX(), cell.getScaleY(),
cell.getPivotX(), (cell.getHeight() >> 1)
);
}
cell.drawBackgroundInternal(canvas, true);
canvas.restore();
}
} else if (child instanceof ChatActionCell) { } else if (child instanceof ChatActionCell) {
ChatActionCell cell = (ChatActionCell) child; ChatActionCell cell = (ChatActionCell) child;
if (cell.hasGradientService()) { if (cell.hasGradientService()) {
@ -9049,12 +9070,18 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
} }
private void addToPulledDialogsMyself() { private void addToPulledDialogsMyself() {
if (getParentLayout() == null) {
return;
}
int stackIndex = getParentLayout().fragmentsStack.indexOf(this); int stackIndex = getParentLayout().fragmentsStack.indexOf(this);
BackButtonMenu.addToPulledDialogs(currentAccount, stackIndex, currentChat, currentUser, dialog_id, dialogFilterId, dialogFolderId); BackButtonMenu.addToPulledDialogs(this, stackIndex, currentChat, currentUser, dialog_id, dialogFilterId, dialogFolderId);
} }
private void addToPulledDialogs(TLRPC.Chat chat, long dialogId, int folderId, int filterId) { private void addToPulledDialogs(TLRPC.Chat chat, long dialogId, int folderId, int filterId) {
if (getParentLayout() == null) {
return;
}
int stackIndex = getParentLayout().fragmentsStack.indexOf(this); int stackIndex = getParentLayout().fragmentsStack.indexOf(this);
BackButtonMenu.addToPulledDialogs(currentAccount, stackIndex, chat, null, dialogId, folderId, filterId); BackButtonMenu.addToPulledDialogs(this, stackIndex, chat, null, dialogId, folderId, filterId);
} }
private void setPullingDownTransition(boolean fromPullingDownTransition) { private void setPullingDownTransition(boolean fromPullingDownTransition) {
@ -14227,7 +14254,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
MediaController.PhotoEntry entry = new MediaController.PhotoEntry(0, 0, 0, videoPath, 0, true, 0, 0, 0); MediaController.PhotoEntry entry = new MediaController.PhotoEntry(0, 0, 0, videoPath, 0, true, 0, 0, 0);
entry.caption = caption; entry.caption = caption;
cameraPhoto.add(entry); cameraPhoto.add(entry);
PhotoViewer.getInstance().openPhotoForSelect(cameraPhoto, 0, 2, false, new PhotoViewer.EmptyPhotoViewerProvider() { PhotoViewer.getInstance().openPhotoForSelect(cameraPhoto, 0, 0, false, new PhotoViewer.EmptyPhotoViewerProvider() {
@Override @Override
public ImageReceiver.BitmapHolder getThumbForPhoto(MessageObject messageObject, TLRPC.FileLocation fileLocation, int index) { public ImageReceiver.BitmapHolder getThumbForPhoto(MessageObject messageObject, TLRPC.FileLocation fileLocation, int index) {
return new ImageReceiver.BitmapHolder(thumb, null, 0); return new ImageReceiver.BitmapHolder(thumb, null, 0);
@ -14259,6 +14286,23 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
path = photoInfo.path; path = photoInfo.path;
} else if (photoInfo.uri != null) { } else if (photoInfo.uri != null) {
path = AndroidUtilities.getPath(photoInfo.uri); path = AndroidUtilities.getPath(photoInfo.uri);
if (path == null) {
try {
BitmapFactory.Options bmOptions = new BitmapFactory.Options();
InputStream inputStream = ApplicationLoader.applicationContext.getContentResolver().openInputStream(photoInfo.uri);
Bitmap b = BitmapFactory.decodeStream(inputStream, null, bmOptions);
String fileName = Integer.MIN_VALUE + "_" + SharedConfig.getLastLocalId() + ".webp";
File fileDir = FileLoader.getDirectory(FileLoader.MEDIA_DIR_CACHE);
final File cacheFile = new File(fileDir, fileName);
FileOutputStream stream = new FileOutputStream(cacheFile);
b.compress(Bitmap.CompressFormat.WEBP, 100, stream);
SharedConfig.saveConfig();
path = cacheFile.getPath();
// path = Uri.fromFile(cacheFile);
} catch (Exception e) {
continue;
}
}
} else { } else {
continue; continue;
} }
@ -14280,18 +14324,20 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
} catch (Exception e) { } catch (Exception e) {
FileLog.e(e); FileLog.e(e);
} }
MediaController.PhotoEntry entry = new MediaController.PhotoEntry(0, 0, 0, path, orientation, false, 0, 0, 0); MediaController.PhotoEntry entry = new MediaController.PhotoEntry(0, 0, 0, path, orientation, photoInfo.isVideo, 0, 0, 0);
if (a == photoPathes.size() - 1 && caption != null) { if (a == photoPathes.size() - 1 && caption != null) {
entry.caption = caption; entry.caption = caption;
} }
entries.add(entry); entries.add(entry);
} }
if (!entries.isEmpty()) { if (entries.isEmpty()) {
return false;
}
if (getParentActivity() != null) { if (getParentActivity() != null) {
final boolean[] checked = new boolean[entries.size()]; final boolean[] checked = new boolean[entries.size()];
Arrays.fill(checked, true); Arrays.fill(checked, true);
PhotoViewer.getInstance().setParentActivity(getParentActivity(), themeDelegate); PhotoViewer.getInstance().setParentActivity(getParentActivity(), themeDelegate);
PhotoViewer.getInstance().openPhotoForSelect(new ArrayList<>(entries), entries.size() - 1, 0, false, new PhotoViewer.EmptyPhotoViewerProvider() { PhotoViewer.getInstance().openPhotoForSelect(new ArrayList<>(entries), entries.size() - 1, 2, false, new PhotoViewer.EmptyPhotoViewerProvider() {
@Override @Override
public ImageReceiver.BitmapHolder getThumbForPhoto(MessageObject messageObject, TLRPC.FileLocation fileLocation, int index) { public ImageReceiver.BitmapHolder getThumbForPhoto(MessageObject messageObject, TLRPC.FileLocation fileLocation, int index) {
return null; return null;
@ -14328,9 +14374,6 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
afterMessageSend(); afterMessageSend();
} }
return true; return true;
} else {
return false;
}
} }
private void sendPhotosGroup(ArrayList<MediaController.PhotoEntry> entries, boolean notify, int scheduleDate, boolean forceDocument) { private void sendPhotosGroup(ArrayList<MediaController.PhotoEntry> entries, boolean notify, int scheduleDate, boolean forceDocument) {
if (!entries.isEmpty()) { if (!entries.isEmpty()) {
@ -28389,6 +28432,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
startServiceBitmap = ((MotionBackgroundDrawable) backgroundDrawable).getBitmap(); startServiceBitmap = ((MotionBackgroundDrawable) backgroundDrawable).getBitmap();
} }
startServiceColor = currentServiceColor; startServiceColor = currentServiceColor;
startSelectedBackgroundColor = currentSelectedBackgroundColor;
startServiceTextColor = drawServiceGradient ? 0xffffffff : getCurrentColorOrDefault(Theme.key_chat_serviceText, true); startServiceTextColor = drawServiceGradient ? 0xffffffff : getCurrentColorOrDefault(Theme.key_chat_serviceText, true);
startServiceLinkColor = drawServiceGradient ? 0xffffffff : getCurrentColorOrDefault(Theme.key_chat_serviceLink, true); startServiceLinkColor = drawServiceGradient ? 0xffffffff : getCurrentColorOrDefault(Theme.key_chat_serviceLink, true);
startServiceButtonColor = drawServiceGradient ? 0xffffffff : getCurrentColorOrDefault(Theme.key_chat_serviceLink, true); startServiceButtonColor = drawServiceGradient ? 0xffffffff : getCurrentColorOrDefault(Theme.key_chat_serviceLink, true);
@ -28621,9 +28665,11 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
int startServiceButtonColor; int startServiceButtonColor;
int startServiceIconColor; int startServiceIconColor;
int startServiceColor; int startServiceColor;
int startSelectedBackgroundColor;
Bitmap startServiceBitmap; Bitmap startServiceBitmap;
int currentServiceColor; int currentServiceColor;
int currentSelectedBackgroundColor;
boolean drawServiceGradient; boolean drawServiceGradient;
private void initServiceMessageColors(Drawable backgroundDrawable) { private void initServiceMessageColors(Drawable backgroundDrawable) {
@ -28631,11 +28677,16 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
int currentServiceMessageColor = result[0]; int currentServiceMessageColor = result[0];
Integer serviceColor = getCurrentColor(Theme.key_chat_serviceBackground); Integer serviceColor = getCurrentColor(Theme.key_chat_serviceBackground);
Integer selectedBackgroundColor = getCurrentColor(Theme.key_chat_selectedBackground);
Integer serviceColor2 = serviceColor; Integer serviceColor2 = serviceColor;
if (serviceColor == null) { if (serviceColor == null) {
serviceColor = currentServiceMessageColor; serviceColor = currentServiceMessageColor;
} }
if (selectedBackgroundColor == null) {
selectedBackgroundColor = currentServiceMessageColor;
}
currentServiceColor = serviceColor; currentServiceColor = serviceColor;
currentSelectedBackgroundColor = selectedBackgroundColor;
drawServiceGradient = backgroundDrawable instanceof MotionBackgroundDrawable && SharedConfig.getDevicePerformanceClass() != SharedConfig.PERFORMANCE_CLASS_LOW; drawServiceGradient = backgroundDrawable instanceof MotionBackgroundDrawable && SharedConfig.getDevicePerformanceClass() != SharedConfig.PERFORMANCE_CLASS_LOW;
@ -28654,22 +28705,40 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
Paint actionBackgroundPaint = getPaint(Theme.key_paint_chatActionBackground); Paint actionBackgroundPaint = getPaint(Theme.key_paint_chatActionBackground);
Paint actionBackgroundSelectedPaint = getPaint(Theme.key_paint_chatActionBackgroundSelected); Paint actionBackgroundSelectedPaint = getPaint(Theme.key_paint_chatActionBackgroundSelected);
Paint msgBackgroundSelectedPaint = getPaint(Theme.key_paint_chatMessageBackgroundSelected);
if (actionBackgroundPaint != null) { if (actionBackgroundPaint != null) {
if (drawServiceGradient) { if (drawServiceGradient) {
ColorMatrix colorMatrix = new ColorMatrix(); ColorMatrix colorMatrix = new ColorMatrix();
colorMatrix.setSaturation(((MotionBackgroundDrawable) backgroundDrawable).getIntensity() >= 0 ? 1.8f : 0.5f); colorMatrix.setSaturation(((MotionBackgroundDrawable) backgroundDrawable).getIntensity() >= 0 ? 1.8f : 0.5f);
actionBackgroundPaint.setAlpha(127); actionBackgroundPaint.setAlpha(127);
actionBackgroundPaint.setColorFilter(new ColorMatrixColorFilter(colorMatrix)); actionBackgroundPaint.setColorFilter(new ColorMatrixColorFilter(colorMatrix));
actionBackgroundPaint.setShader(serviceShaderSource); actionBackgroundPaint.setShader(serviceShaderSource);
actionBackgroundSelectedPaint.setAlpha(127); actionBackgroundSelectedPaint.setAlpha(127);
actionBackgroundSelectedPaint.setColorFilter(new ColorMatrixColorFilter(colorMatrix)); actionBackgroundSelectedPaint.setColorFilter(new ColorMatrixColorFilter(colorMatrix));
actionBackgroundSelectedPaint.setShader(serviceShaderSource); actionBackgroundSelectedPaint.setShader(serviceShaderSource);
if (msgBackgroundSelectedPaint == null) {
msgBackgroundSelectedPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
currentPaints.put(Theme.key_paint_chatMessageBackgroundSelected, msgBackgroundSelectedPaint);
}
ColorMatrix colorMatrix2 = new ColorMatrix();
colorMatrix2.setSaturation(0.98f);
AndroidUtilities.lightColorMatrix(colorMatrix2, -60);
msgBackgroundSelectedPaint.setAlpha(90);
msgBackgroundSelectedPaint.setColorFilter(new ColorMatrixColorFilter(colorMatrix2));
msgBackgroundSelectedPaint.setShader(serviceShaderSource);
} else { } else {
actionBackgroundPaint.setColorFilter(null); actionBackgroundPaint.setColorFilter(null);
actionBackgroundPaint.setShader(null); actionBackgroundPaint.setShader(null);
actionBackgroundSelectedPaint.setColorFilter(null); actionBackgroundSelectedPaint.setColorFilter(null);
actionBackgroundSelectedPaint.setShader(null); actionBackgroundSelectedPaint.setShader(null);
if (msgBackgroundSelectedPaint != null) {
msgBackgroundSelectedPaint.setColorFilter(null);
msgBackgroundSelectedPaint.setShader(null);
}
} }
} }
} }
@ -28680,6 +28749,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
} }
Paint actionBackgroundPaint = getPaint(Theme.key_paint_chatActionBackground); Paint actionBackgroundPaint = getPaint(Theme.key_paint_chatActionBackground);
Paint actionBackgroundSelectedPaint = getPaint(Theme.key_paint_chatActionBackgroundSelected); Paint actionBackgroundSelectedPaint = getPaint(Theme.key_paint_chatActionBackgroundSelected);
Paint msgBackgroundSelectedPaint = getPaint(Theme.key_paint_chatMessageBackgroundSelected);
int serviceColor = currentServiceColor; int serviceColor = currentServiceColor;
int serviceTextColor = drawServiceGradient ? 0xffffffff : getCurrentColorOrDefault(Theme.key_chat_serviceText, true); int serviceTextColor = drawServiceGradient ? 0xffffffff : getCurrentColorOrDefault(Theme.key_chat_serviceText, true);
@ -28731,6 +28801,9 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
actionBackgroundPaint.setShader(serviceShader); actionBackgroundPaint.setShader(serviceShader);
actionBackgroundSelectedPaint.setShader(serviceShader); actionBackgroundSelectedPaint.setShader(serviceShader);
} }
if (msgBackgroundSelectedPaint != null) {
msgBackgroundSelectedPaint.setShader(serviceShader);
}
} else { } else {
useSourceShader = true; useSourceShader = true;
serviceCanvas.drawBitmap(serviceBitmapSource, 0, 0, null); serviceCanvas.drawBitmap(serviceBitmapSource, 0, 0, null);
@ -28738,7 +28811,9 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
actionBackgroundPaint.setShader(serviceShaderSource); actionBackgroundPaint.setShader(serviceShaderSource);
actionBackgroundSelectedPaint.setShader(serviceShaderSource); actionBackgroundSelectedPaint.setShader(serviceShaderSource);
} }
if (msgBackgroundSelectedPaint != null) {
msgBackgroundSelectedPaint.setShader(serviceShaderSource);
}
} }
} }
} }

View File

@ -41,22 +41,25 @@ public class BackButtonMenu {
int folderId; int folderId;
int filterId; int filterId;
} }
private static HashMap<Integer, ArrayList<PulledDialog>> pulledDialogs;
public static ActionBarPopupWindow show(BaseFragment fragment, View backButton, long currentDialogId) { public static ActionBarPopupWindow show(BaseFragment thisFragment, View backButton, long currentDialogId) {
if (fragment == null) { if (thisFragment == null) {
return null; return null;
} }
final ActionBarLayout parentLayout = fragment.getParentLayout(); final ActionBarLayout parentLayout = thisFragment.getParentLayout();
ArrayList<PulledDialog> dialogs = getStackedHistoryDialogs(fragment.getCurrentAccount(), parentLayout == null ? null : parentLayout.fragmentsStack, currentDialogId); final Context context = thisFragment.getParentActivity();
final View fragmentView = thisFragment.getFragmentView();
if (parentLayout == null || context == null || fragmentView == null) {
return null;
}
ArrayList<PulledDialog> dialogs = getStackedHistoryDialogs(thisFragment, currentDialogId);
if (dialogs.size() <= 0) { if (dialogs.size() <= 0) {
return null; return null;
} }
Context context = fragment.getParentActivity();
ActionBarPopupWindow.ActionBarPopupWindowLayout layout = new ActionBarPopupWindow.ActionBarPopupWindowLayout(context); ActionBarPopupWindow.ActionBarPopupWindowLayout layout = new ActionBarPopupWindow.ActionBarPopupWindowLayout(context);
android.graphics.Rect backgroundPaddings = new Rect(); android.graphics.Rect backgroundPaddings = new Rect();
Drawable shadowDrawable = fragment.getParentActivity().getResources().getDrawable(R.drawable.popup_fixed_alert).mutate(); Drawable shadowDrawable = thisFragment.getParentActivity().getResources().getDrawable(R.drawable.popup_fixed_alert).mutate();
shadowDrawable.getPadding(backgroundPaddings); shadowDrawable.getPadding(backgroundPaddings);
layout.setBackgroundColor(Theme.getColor(Theme.key_actionBarDefaultSubmenuBackground)); layout.setBackgroundColor(Theme.getColor(Theme.key_actionBarDefaultSubmenuBackground));
@ -144,7 +147,7 @@ public class BackButtonMenu {
} }
} }
} }
goToPulledDialog(fragment, pDialog); goToPulledDialog(thisFragment, pDialog);
}); });
layout.addView(cell, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, 48)); layout.addView(cell, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, 48));
} }
@ -163,8 +166,6 @@ public class BackButtonMenu {
scrimPopupWindow.getContentView().setFocusableInTouchMode(true); scrimPopupWindow.getContentView().setFocusableInTouchMode(true);
layout.setFitItems(true); layout.setFitItems(true);
View fragmentView = fragment.getFragmentView();
if (fragmentView != null) {
int popupX = AndroidUtilities.dp(8) - backgroundPaddings.left; int popupX = AndroidUtilities.dp(8) - backgroundPaddings.left;
if (AndroidUtilities.isTablet()) { if (AndroidUtilities.isTablet()) {
int[] location = new int[2]; int[] location = new int[2];
@ -177,7 +178,6 @@ public class BackButtonMenu {
try { try {
fragmentView.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); fragmentView.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
} catch (Exception ignore) {} } catch (Exception ignore) {}
}
return scrimPopupWindow; return scrimPopupWindow;
} }
@ -203,8 +203,15 @@ public class BackButtonMenu {
} }
} }
public static ArrayList<PulledDialog> getStackedHistoryDialogs(int account, ArrayList<BaseFragment> fragmentsStack, long ignoreDialogId) { public static ArrayList<PulledDialog> getStackedHistoryDialogs(BaseFragment thisFragment, long ignoreDialogId) {
ArrayList<PulledDialog> dialogs = new ArrayList<>(); ArrayList<PulledDialog> dialogs = new ArrayList<>();
if (thisFragment == null)
return dialogs;
final ActionBarLayout parentLayout = thisFragment.getParentLayout();
if (parentLayout == null)
return dialogs;
ArrayList<BaseFragment> fragmentsStack = parentLayout.fragmentsStack;
ArrayList<PulledDialog> pulledDialogs = parentLayout.pulledDialogs;
if (fragmentsStack != null) { if (fragmentsStack != null) {
final int count = fragmentsStack.size(); final int count = fragmentsStack.size();
for (int i = 0; i < count; ++i) { for (int i = 0; i < count; ++i) {
@ -263,9 +270,7 @@ public class BackButtonMenu {
} }
} }
if (pulledDialogs != null) { if (pulledDialogs != null) {
ArrayList<PulledDialog> pulledDialogsAccount = pulledDialogs.get(account); for (PulledDialog pulledDialog : pulledDialogs) {
if (pulledDialogsAccount != null) {
for (PulledDialog pulledDialog : pulledDialogsAccount) {
if (pulledDialog.dialogId == ignoreDialogId) { if (pulledDialog.dialogId == ignoreDialogId) {
continue; continue;
} }
@ -281,28 +286,26 @@ public class BackButtonMenu {
} }
} }
} }
}
Collections.sort(dialogs, (d1, d2) -> d2.stackIndex - d1.stackIndex); Collections.sort(dialogs, (d1, d2) -> d2.stackIndex - d1.stackIndex);
return dialogs; return dialogs;
} }
public static void addToPulledDialogs(int account, int stackIndex, TLRPC.Chat chat, TLRPC.User user, long dialogId, int folderId, int filterId) { public static void addToPulledDialogs(BaseFragment thisFragment, int stackIndex, TLRPC.Chat chat, TLRPC.User user, long dialogId, int folderId, int filterId) {
if (chat == null && user == null) { if (chat == null && user == null) {
return; return;
} }
if (pulledDialogs == null) { if (thisFragment == null) {
pulledDialogs = new HashMap<>(); return;
} }
ArrayList<PulledDialog> dialogs = null; final ActionBarLayout parentLayout = thisFragment.getParentLayout();
if (pulledDialogs.containsKey(account)) { if (parentLayout == null) {
dialogs = pulledDialogs.get(account); return;
} }
if (dialogs == null) { if (parentLayout.pulledDialogs == null) {
pulledDialogs.put(account, dialogs = new ArrayList<>()); parentLayout.pulledDialogs = new ArrayList<>();
} }
boolean alreadyAdded = false; boolean alreadyAdded = false;
for (PulledDialog d : dialogs) { for (PulledDialog d : parentLayout.pulledDialogs) {
if (d.dialogId == dialogId) { if (d.dialogId == dialogId) {
alreadyAdded = true; alreadyAdded = true;
break; break;
@ -318,20 +321,24 @@ public class BackButtonMenu {
d.folderId = folderId; d.folderId = folderId;
d.chat = chat; d.chat = chat;
d.user = user; d.user = user;
dialogs.add(d); parentLayout.pulledDialogs.add(d);
} }
} }
public static void clearPulledDialogs(int account, int fromIndex) { public static void clearPulledDialogs(BaseFragment thisFragment, int fromIndex) {
if (pulledDialogs != null && pulledDialogs.containsKey(account)) { if (thisFragment == null) {
ArrayList<PulledDialog> dialogs = pulledDialogs.get(account); return;
if (dialogs != null) { }
for (int i = 0; i < dialogs.size(); ++i) { final ActionBarLayout parentLayout = thisFragment.getParentLayout();
if (dialogs.get(i).stackIndex > fromIndex) { if (parentLayout == null) {
dialogs.remove(i); return;
}
if (parentLayout.pulledDialogs != null) {
for (int i = 0; i < parentLayout.pulledDialogs.size(); ++i) {
if (parentLayout.pulledDialogs.get(i).stackIndex > fromIndex) {
parentLayout.pulledDialogs.remove(i);
i--; i--;
} }
} }
} }
} }
}
} }

View File

@ -13,6 +13,7 @@ import android.view.ViewGroup;
public class MessageBackgroundDrawable extends Drawable { public class MessageBackgroundDrawable extends Drawable {
private Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG); private Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
private Paint customPaint = null;
private long lastAnimationTime; private long lastAnimationTime;
private float currentAnimationProgress; private float currentAnimationProgress;
private boolean isSelected; private boolean isSelected;
@ -33,6 +34,10 @@ public class MessageBackgroundDrawable extends Drawable {
paint.setColor(color); paint.setColor(color);
} }
public void setCustomPaint(Paint paint) {
this.customPaint = paint;
}
public void setSelected(boolean selected, boolean animated) { public void setSelected(boolean selected, boolean animated) {
if (isSelected == selected) { if (isSelected == selected) {
if (animationInProgress != animated && !animated) { if (animationInProgress != animated && !animated) {
@ -125,7 +130,7 @@ public class MessageBackgroundDrawable extends Drawable {
@Override @Override
public void draw(Canvas canvas) { public void draw(Canvas canvas) {
if (currentAnimationProgress == 1.0f) { if (currentAnimationProgress == 1.0f) {
canvas.drawRect(getBounds(), paint); canvas.drawRect(getBounds(), customPaint != null ? customPaint : paint);
} else if (currentAnimationProgress != 0.0f) { } else if (currentAnimationProgress != 0.0f) {
float interpolatedProgress; float interpolatedProgress;
if (isSelected) { if (isSelected) {
@ -150,7 +155,7 @@ public class MessageBackgroundDrawable extends Drawable {
} }
x1 = centerX + (1.0f - interpolatedProgress) * (x1 - centerX); x1 = centerX + (1.0f - interpolatedProgress) * (x1 - centerX);
y1 = centerY + (1.0f - interpolatedProgress) * (y1 - centerY); y1 = centerY + (1.0f - interpolatedProgress) * (y1 - centerY);
canvas.drawCircle(x1, y1, finalRadius * interpolatedProgress, paint); canvas.drawCircle(x1, y1, finalRadius * interpolatedProgress, customPaint != null ? customPaint : paint);
} }
if (animationInProgress) { if (animationInProgress) {
long newTime = SystemClock.elapsedRealtime(); long newTime = SystemClock.elapsedRealtime();

View File

@ -42,6 +42,8 @@ import android.graphics.drawable.Drawable;
import android.net.Uri; import android.net.Uri;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.os.Vibrator;
import android.text.TextPaint;
import android.text.TextUtils; import android.text.TextUtils;
import android.util.Property; import android.util.Property;
import android.util.SparseArray; import android.util.SparseArray;
@ -59,9 +61,11 @@ import android.view.ViewOutlineProvider;
import android.view.ViewParent; import android.view.ViewParent;
import android.view.ViewTreeObserver; import android.view.ViewTreeObserver;
import android.view.WindowManager; import android.view.WindowManager;
import android.view.accessibility.AccessibilityNodeInfo;
import android.view.animation.AccelerateDecelerateInterpolator; import android.view.animation.AccelerateDecelerateInterpolator;
import android.view.animation.DecelerateInterpolator; import android.view.animation.DecelerateInterpolator;
import android.view.animation.Interpolator; import android.view.animation.Interpolator;
import android.widget.Button;
import android.widget.EditText; import android.widget.EditText;
import android.widget.FrameLayout; import android.widget.FrameLayout;
import android.widget.ImageView; import android.widget.ImageView;
@ -301,8 +305,15 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
private RecyclerView sideMenu; private RecyclerView sideMenu;
private ChatActivityEnterView commentView; private ChatActivityEnterView commentView;
private ImageView[] writeButton;
private FrameLayout writeButtonContainer;
private View selectedCountView;
private ActionBarMenuItem switchItem; private ActionBarMenuItem switchItem;
private RectF rect = new RectF();
private Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
private TextPaint textPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG);
private FragmentContextView fragmentLocationContextView; private FragmentContextView fragmentLocationContextView;
private FragmentContextView fragmentContextView; private FragmentContextView fragmentContextView;
@ -359,6 +370,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
private DialogsActivityDelegate delegate; private DialogsActivityDelegate delegate;
private ArrayList<Long> selectedDialogs = new ArrayList<>(); private ArrayList<Long> selectedDialogs = new ArrayList<>();
public boolean notify = true;
private int canReadCount; private int canReadCount;
private int canPinCount; private int canPinCount;
@ -3293,6 +3305,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
commentView.setAllowStickersAndGifs(false, false); commentView.setAllowStickersAndGifs(false, false);
commentView.setForceShowSendButton(true, false); commentView.setForceShowSendButton(true, false);
commentView.setVisibility(View.GONE); commentView.setVisibility(View.GONE);
commentView.getSendButton().setAlpha(0);
contentView.addView(commentView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.LEFT | Gravity.BOTTOM)); contentView.addView(commentView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.LEFT | Gravity.BOTTOM));
commentView.setDelegate(new ChatActivityEnterView.ChatActivityEnterViewDelegate() { commentView.setDelegate(new ChatActivityEnterView.ChatActivityEnterViewDelegate() {
@Override @Override
@ -3403,6 +3416,99 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
} }
}); });
writeButtonContainer = new FrameLayout(context) {
@Override
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
super.onInitializeAccessibilityNodeInfo(info);
info.setText(LocaleController.formatPluralString("AccDescrShareInChats", selectedDialogs.size()));
info.setClassName(Button.class.getName());
info.setLongClickable(true);
info.setClickable(true);
}
};
writeButtonContainer.setFocusable(true);
writeButtonContainer.setFocusableInTouchMode(true);
writeButtonContainer.setVisibility(View.INVISIBLE);
writeButtonContainer.setScaleX(0.2f);
writeButtonContainer.setScaleY(0.2f);
writeButtonContainer.setAlpha(0.0f);
contentView.addView(writeButtonContainer, LayoutHelper.createFrame(60, 60, Gravity.RIGHT | Gravity.BOTTOM, 0, 0, 6, 10));
textPaint.setTextSize(AndroidUtilities.dp(12));
textPaint.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
selectedCountView = new View(context) {
@Override
protected void onDraw(Canvas canvas) {
String text = String.format("%d", Math.max(1, selectedDialogs.size()));
int textSize = (int) Math.ceil(textPaint.measureText(text));
int size = Math.max(AndroidUtilities.dp(16) + textSize, AndroidUtilities.dp(24));
int cx = getMeasuredWidth() / 2;
int cy = getMeasuredHeight() / 2;
textPaint.setColor(getThemedColor(Theme.key_dialogRoundCheckBoxCheck));
paint.setColor(getThemedColor(Theme.isCurrentThemeDark() ? Theme.key_voipgroup_inviteMembersBackground : Theme.key_dialogBackground));
rect.set(cx - size / 2, 0, cx + size / 2, getMeasuredHeight());
canvas.drawRoundRect(rect, AndroidUtilities.dp(12), AndroidUtilities.dp(12), paint);
paint.setColor(getThemedColor(Theme.key_dialogRoundCheckBox));
rect.set(cx - size / 2 + AndroidUtilities.dp(2), AndroidUtilities.dp(2), cx + size / 2 - AndroidUtilities.dp(2), getMeasuredHeight() - AndroidUtilities.dp(2));
canvas.drawRoundRect(rect, AndroidUtilities.dp(10), AndroidUtilities.dp(10), paint);
canvas.drawText(text, cx - textSize / 2, AndroidUtilities.dp(16.2f), textPaint);
}
};
selectedCountView.setAlpha(0.0f);
selectedCountView.setScaleX(0.2f);
selectedCountView.setScaleY(0.2f);
contentView.addView(selectedCountView, LayoutHelper.createFrame(42, 24, Gravity.RIGHT | Gravity.BOTTOM, 0, 0, -8, 9));
FrameLayout writeButtonBackground = new FrameLayout(context);
Drawable writeButtonDrawable = Theme.createSimpleSelectorCircleDrawable(AndroidUtilities.dp(56), getThemedColor(Theme.key_dialogFloatingButton), getThemedColor(Build.VERSION.SDK_INT >= 21 ? Theme.key_dialogFloatingButtonPressed : Theme.key_dialogFloatingButton));
if (Build.VERSION.SDK_INT < 21) {
Drawable shadowDrawable = context.getResources().getDrawable(R.drawable.floating_shadow_profile).mutate();
shadowDrawable.setColorFilter(new PorterDuffColorFilter(0xff000000, PorterDuff.Mode.MULTIPLY));
CombinedDrawable combinedDrawable = new CombinedDrawable(shadowDrawable, drawable, 0, 0);
combinedDrawable.setIconSize(AndroidUtilities.dp(56), AndroidUtilities.dp(56));
writeButtonDrawable = combinedDrawable;
}
writeButtonBackground.setBackgroundDrawable(writeButtonDrawable);
writeButtonBackground.setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_NO);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
writeButtonBackground.setOutlineProvider(new ViewOutlineProvider() {
@SuppressLint("NewApi")
@Override
public void getOutline(View view, Outline outline) {
outline.setOval(0, 0, AndroidUtilities.dp(56), AndroidUtilities.dp(56));
}
});
}
writeButtonBackground.setOnClickListener(v -> {
if (delegate == null || selectedDialogs.isEmpty()) {
return;
}
delegate.didSelectDialogs(DialogsActivity.this, selectedDialogs, commentView.getFieldText(), false);
});
writeButtonBackground.setOnLongClickListener(v -> {
if (isNextButton) {
return false;
}
onSendLongClick(writeButtonBackground);
return true;
});
writeButton = new ImageView[2];
for (int a = 0; a < 2; ++a) {
writeButton[a] = new ImageView(context);
writeButton[a].setImageResource(a == 1 ? R.drawable.actionbtn_next : R.drawable.attach_send);
writeButton[a].setColorFilter(new PorterDuffColorFilter(getThemedColor(Theme.key_dialogFloatingIcon), PorterDuff.Mode.MULTIPLY));
writeButton[a].setScaleType(ImageView.ScaleType.CENTER);
writeButtonBackground.addView(writeButton[a], LayoutHelper.createFrame(Build.VERSION.SDK_INT >= 21 ? 56 : 60, Build.VERSION.SDK_INT >= 21 ? 56 : 60, Gravity.CENTER));
}
AndroidUtilities.updateViewVisibilityAnimated(writeButton[0], true, 0.5f, false);
AndroidUtilities.updateViewVisibilityAnimated(writeButton[1], false, 0.5f, false);
writeButtonContainer.addView(writeButtonBackground, LayoutHelper.createFrame(Build.VERSION.SDK_INT >= 21 ? 56 : 60, Build.VERSION.SDK_INT >= 21 ? 56 : 60, Gravity.LEFT | Gravity.TOP, Build.VERSION.SDK_INT >= 21 ? 2 : 0, 0, 0, 0));
} }
if (filterTabsView != null) { if (filterTabsView != null) {
@ -6206,6 +6312,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
doneItemAnimator.start(); doneItemAnimator.start();
} }
private boolean isNextButton = false;
private void updateSelectedCount() { private void updateSelectedCount() {
if (commentView != null) { if (commentView != null) {
if (selectedDialogs.isEmpty()) { if (selectedDialogs.isEmpty()) {
@ -6218,13 +6325,22 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
commentView.hidePopup(false); commentView.hidePopup(false);
commentView.closeKeyboard(); commentView.closeKeyboard();
AnimatorSet animatorSet = new AnimatorSet(); AnimatorSet animatorSet = new AnimatorSet();
animatorSet.playTogether(ObjectAnimator.ofFloat(commentView, View.TRANSLATION_Y, 0, commentView.getMeasuredHeight())); animatorSet.playTogether(
ObjectAnimator.ofFloat(commentView, View.TRANSLATION_Y, 0, commentView.getMeasuredHeight()),
ObjectAnimator.ofFloat(writeButtonContainer, View.SCALE_X, .2f),
ObjectAnimator.ofFloat(writeButtonContainer, View.SCALE_Y, .2f),
ObjectAnimator.ofFloat(writeButtonContainer, View.ALPHA, 0),
ObjectAnimator.ofFloat(selectedCountView, View.SCALE_X, 0.2f),
ObjectAnimator.ofFloat(selectedCountView, View.SCALE_Y, 0.2f),
ObjectAnimator.ofFloat(selectedCountView, View.ALPHA, 0.0f)
);
animatorSet.setDuration(180); animatorSet.setDuration(180);
animatorSet.setInterpolator(new DecelerateInterpolator()); animatorSet.setInterpolator(new DecelerateInterpolator());
animatorSet.addListener(new AnimatorListenerAdapter() { animatorSet.addListener(new AnimatorListenerAdapter() {
@Override @Override
public void onAnimationEnd(Animator animation) { public void onAnimationEnd(Animator animation) {
commentView.setVisibility(View.GONE); commentView.setVisibility(View.GONE);
writeButtonContainer.setVisibility(View.GONE);
} }
}); });
animatorSet.start(); animatorSet.start();
@ -6232,11 +6348,21 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
fragmentView.requestLayout(); fragmentView.requestLayout();
} }
} else { } else {
selectedCountView.invalidate();
if (commentView.getTag() == null) { if (commentView.getTag() == null) {
commentView.setFieldText(""); commentView.setFieldText("");
commentView.setVisibility(View.VISIBLE); commentView.setVisibility(View.VISIBLE);
writeButtonContainer.setVisibility(View.VISIBLE);
AnimatorSet animatorSet = new AnimatorSet(); AnimatorSet animatorSet = new AnimatorSet();
animatorSet.playTogether(ObjectAnimator.ofFloat(commentView, View.TRANSLATION_Y, commentView.getMeasuredHeight(), 0)); animatorSet.playTogether(
ObjectAnimator.ofFloat(commentView, View.TRANSLATION_Y, commentView.getMeasuredHeight(), 0),
ObjectAnimator.ofFloat(writeButtonContainer, View.SCALE_X, 1f),
ObjectAnimator.ofFloat(writeButtonContainer, View.SCALE_Y, 1f),
ObjectAnimator.ofFloat(writeButtonContainer, View.ALPHA, 1f),
ObjectAnimator.ofFloat(selectedCountView, View.SCALE_X, 1f),
ObjectAnimator.ofFloat(selectedCountView, View.SCALE_Y, 1f),
ObjectAnimator.ofFloat(selectedCountView, View.ALPHA, 1f)
);
animatorSet.setDuration(180); animatorSet.setDuration(180);
animatorSet.setInterpolator(new DecelerateInterpolator()); animatorSet.setInterpolator(new DecelerateInterpolator());
animatorSet.addListener(new AnimatorListenerAdapter() { animatorSet.addListener(new AnimatorListenerAdapter() {
@ -6254,6 +6380,10 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
} else if (initialDialogsType == 10) { } else if (initialDialogsType == 10) {
hideFloatingButton(selectedDialogs.isEmpty()); hideFloatingButton(selectedDialogs.isEmpty());
} }
isNextButton = shouldShowNextButton(this, selectedDialogs, commentView.getFieldText(), false);
AndroidUtilities.updateViewVisibilityAnimated(writeButton[0], !isNextButton, 0.5f, true);
AndroidUtilities.updateViewVisibilityAnimated(writeButton[1], isNextButton, 0.5f, true);
} }
@TargetApi(Build.VERSION_CODES.M) @TargetApi(Build.VERSION_CODES.M)
@ -6893,6 +7023,9 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
public void setDelegate(DialogsActivityDelegate dialogsActivityDelegate) { public void setDelegate(DialogsActivityDelegate dialogsActivityDelegate) {
delegate = dialogsActivityDelegate; delegate = dialogsActivityDelegate;
} }
public boolean shouldShowNextButton(DialogsActivity fragment, ArrayList<Long> dids, CharSequence message, boolean param) {
return false;
}
public void setSearchString(String string) { public void setSearchString(String string) {
searchString = string; searchString = string;
@ -7057,6 +7190,87 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
return floatingButton; return floatingButton;
} }
private ActionBarPopupWindow sendPopupWindow;
private boolean onSendLongClick(View view) {
final Activity parentActivity = getParentActivity();
final Theme.ResourcesProvider resourcesProvider = getResourceProvider();
if (parentActivity == null) {
return false;
}
LinearLayout layout = new LinearLayout(parentActivity);
layout.setOrientation(LinearLayout.VERTICAL);
ActionBarPopupWindow.ActionBarPopupWindowLayout sendPopupLayout2 = new ActionBarPopupWindow.ActionBarPopupWindowLayout(parentActivity, resourcesProvider);
sendPopupLayout2.setAnimationEnabled(false);
sendPopupLayout2.setOnTouchListener(new View.OnTouchListener() {
private android.graphics.Rect popupRect = new android.graphics.Rect();
@Override
public boolean onTouch(View v, MotionEvent event) {
if (event.getActionMasked() == MotionEvent.ACTION_DOWN) {
if (sendPopupWindow != null && sendPopupWindow.isShowing()) {
v.getHitRect(popupRect);
if (!popupRect.contains((int) event.getX(), (int) event.getY())) {
sendPopupWindow.dismiss();
}
}
}
return false;
}
});
sendPopupLayout2.setDispatchKeyEventListener(keyEvent -> {
if (keyEvent.getKeyCode() == KeyEvent.KEYCODE_BACK && keyEvent.getRepeatCount() == 0 && sendPopupWindow != null && sendPopupWindow.isShowing()) {
sendPopupWindow.dismiss();
}
});
sendPopupLayout2.setShownFromBotton(false);
sendPopupLayout2.setupRadialSelectors(getThemedColor(Theme.key_dialogButtonSelector));
ActionBarMenuSubItem sendWithoutSound = new ActionBarMenuSubItem(parentActivity, true, true, resourcesProvider);
sendWithoutSound.setTextAndIcon(LocaleController.getString("SendWithoutSound", R.string.SendWithoutSound), R.drawable.input_notify_off);
sendWithoutSound.setMinimumWidth(AndroidUtilities.dp(196));
sendPopupLayout2.addView(sendWithoutSound, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, 48));
sendWithoutSound.setOnClickListener(v -> {
if (sendPopupWindow != null && sendPopupWindow.isShowing()) {
sendPopupWindow.dismiss();
}
this.notify = false;
if (delegate == null || selectedDialogs.isEmpty()) {
return;
}
delegate.didSelectDialogs(DialogsActivity.this, selectedDialogs, commentView.getFieldText(), false);
});
layout.addView(sendPopupLayout2, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT));
sendPopupWindow = new ActionBarPopupWindow(layout, LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT);
sendPopupWindow.setAnimationEnabled(false);
sendPopupWindow.setAnimationStyle(R.style.PopupContextAnimation2);
sendPopupWindow.setOutsideTouchable(true);
sendPopupWindow.setClippingEnabled(true);
sendPopupWindow.setInputMethodMode(ActionBarPopupWindow.INPUT_METHOD_NOT_NEEDED);
sendPopupWindow.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_UNSPECIFIED);
sendPopupWindow.getContentView().setFocusableInTouchMode(true);
SharedConfig.removeScheduledOrNoSuoundHint();
layout.measure(View.MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(1000), View.MeasureSpec.AT_MOST), View.MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(1000), View.MeasureSpec.AT_MOST));
sendPopupWindow.setFocusable(true);
int[] location = new int[2];
view.getLocationInWindow(location);
int y;
// if (keyboardVisible && parentFragment.contentView.getMeasuredHeight() > AndroidUtilities.dp(58)) {
// y = location[1] + view.getMeasuredHeight();
// } else {
y = location[1] - layout.getMeasuredHeight() - AndroidUtilities.dp(2);
// }
sendPopupWindow.showAtLocation(view, Gravity.LEFT | Gravity.TOP, location[0] + view.getMeasuredWidth() - layout.getMeasuredWidth() + AndroidUtilities.dp(8), y);
sendPopupWindow.dimBehind();
view.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
return false;
}
@Override @Override
public ArrayList<ThemeDescription> getThemeDescriptions() { public ArrayList<ThemeDescription> getThemeDescriptions() {
ThemeDescription.ThemeDescriptionDelegate cellDelegate = () -> { ThemeDescription.ThemeDescriptionDelegate cellDelegate = () -> {
@ -7527,7 +7741,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
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_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_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_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(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_actionBarTipBackground));

View File

@ -2628,7 +2628,27 @@ public class LaunchActivity extends Activity implements ActionBarLayout.ActionBa
args.putString("selectAlertString", LocaleController.getString("SendMessagesToText", R.string.SendMessagesToText)); args.putString("selectAlertString", LocaleController.getString("SendMessagesToText", R.string.SendMessagesToText));
args.putString("selectAlertStringGroup", LocaleController.getString("SendMessagesToGroupText", R.string.SendMessagesToGroupText)); args.putString("selectAlertStringGroup", LocaleController.getString("SendMessagesToGroupText", R.string.SendMessagesToGroupText));
} }
DialogsActivity fragment = new DialogsActivity(args); DialogsActivity fragment = new DialogsActivity(args) {
@Override
public boolean shouldShowNextButton(DialogsActivity dialogsFragment, ArrayList<Long> dids, CharSequence message, boolean param) {
if (exportingChatUri != null) {
return false;
} else {
if (contactsToSend != null && contactsToSend.size() == 1 && !mainFragmentsStack.isEmpty()) {
return true;
} else {
if (dids.size() <= 1) {
if (videoPath != null) {
return true;
} else if (photoPathsArray != null && photoPathsArray.size() > 0) {
return true;
}
}
}
}
return false;
}
};
fragment.setDelegate(this); fragment.setDelegate(this);
boolean removeLast; boolean removeLast;
if (AndroidUtilities.isTablet()) { if (AndroidUtilities.isTablet()) {
@ -3979,6 +3999,7 @@ public class LaunchActivity extends Activity implements ActionBarLayout.ActionBa
} }
} else { } else {
boolean notify = dialogsFragment == null || dialogsFragment.notify;
final ChatActivity fragment; final ChatActivity fragment;
if (dids.size() <= 1) { if (dids.size() <= 1) {
final long did = dids.get(0); final long did = dids.get(0);
@ -4032,12 +4053,12 @@ public class LaunchActivity extends Activity implements ActionBarLayout.ActionBa
if (contactsToSend != null && contactsToSend.size() == 1 && !mainFragmentsStack.isEmpty()) { if (contactsToSend != null && contactsToSend.size() == 1 && !mainFragmentsStack.isEmpty()) {
PhonebookShareAlert alert = new PhonebookShareAlert(mainFragmentsStack.get(mainFragmentsStack.size() - 1), null, null, contactsToSendUri, null, null, null); PhonebookShareAlert alert = new PhonebookShareAlert(mainFragmentsStack.get(mainFragmentsStack.size() - 1), null, null, contactsToSendUri, null, null, null);
alert.setDelegate((user, notify, scheduleDate) -> { alert.setDelegate((user, notify2, scheduleDate) -> {
if (fragment != null) { if (fragment != null) {
actionBarLayout.presentFragment(fragment, true, false, true, false); actionBarLayout.presentFragment(fragment, true, false, true, false);
} }
for (int i = 0; i < dids.size(); i++) { for (int i = 0; i < dids.size(); i++) {
SendMessagesHelper.getInstance(account).sendMessage(user, dids.get(i), null, null, null, null, notify, scheduleDate); SendMessagesHelper.getInstance(account).sendMessage(user, dids.get(i), null, null, null, null, notify2, scheduleDate);
} }
}); });
mainFragmentsStack.get(mainFragmentsStack.size() - 1).showDialog(alert); mainFragmentsStack.get(mainFragmentsStack.size() - 1).showDialog(alert);
@ -4049,7 +4070,8 @@ public class LaunchActivity extends Activity implements ActionBarLayout.ActionBa
AccountInstance accountInstance = AccountInstance.getInstance(UserConfig.selectedAccount); AccountInstance accountInstance = AccountInstance.getInstance(UserConfig.selectedAccount);
boolean photosEditorOpened = false; boolean photosEditorOpened = false;
if (fragment != null) { if (fragment != null) {
actionBarLayout.presentFragment(fragment, dialogsFragment != null, dialogsFragment == null, true, false); boolean withoutAnimation = dialogsFragment == null || (videoPath != null || (photoPathsArray != null && photoPathsArray.size() > 0));
actionBarLayout.presentFragment(fragment, dialogsFragment != null, withoutAnimation, true, false);
if (videoPath != null) { if (videoPath != null) {
fragment.openVideoEditor(videoPath, sendingText); fragment.openVideoEditor(videoPath, sendingText);
sendingText = null; sendingText = null;
@ -4067,7 +4089,7 @@ public class LaunchActivity extends Activity implements ActionBarLayout.ActionBa
} }
ArrayList<String> arrayList = new ArrayList<>(); ArrayList<String> arrayList = new ArrayList<>();
arrayList.add(videoPath); arrayList.add(videoPath);
SendMessagesHelper.prepareSendingDocuments(accountInstance, arrayList, arrayList, null, captionToSend, null, did, null, null, null, null, true, 0); SendMessagesHelper.prepareSendingDocuments(accountInstance, arrayList, arrayList, null, captionToSend, null, did, null, null, null, null, notify, 0);
} }
} }
if (photoPathsArray != null && !photosEditorOpened) { if (photoPathsArray != null && !photosEditorOpened) {
@ -4075,14 +4097,14 @@ public class LaunchActivity extends Activity implements ActionBarLayout.ActionBa
photoPathsArray.get(0).caption = sendingText; photoPathsArray.get(0).caption = sendingText;
sendingText = null; sendingText = null;
} }
SendMessagesHelper.prepareSendingMedia(accountInstance, photoPathsArray, did, null, null, null, false, false, null, true, 0); SendMessagesHelper.prepareSendingMedia(accountInstance, photoPathsArray, did, null, null, null, false, false, null, notify, 0);
} }
if (documentsPathsArray != null || documentsUrisArray != null) { if (documentsPathsArray != null || documentsUrisArray != null) {
if (sendingText != null && sendingText.length() <= 1024 && ((documentsPathsArray != null ? documentsPathsArray.size() : 0) + (documentsUrisArray != null ? documentsUrisArray.size() : 0)) == 1) { if (sendingText != null && sendingText.length() <= 1024 && ((documentsPathsArray != null ? documentsPathsArray.size() : 0) + (documentsUrisArray != null ? documentsUrisArray.size() : 0)) == 1) {
captionToSend = sendingText; captionToSend = sendingText;
sendingText = null; sendingText = null;
} }
SendMessagesHelper.prepareSendingDocuments(accountInstance, documentsPathsArray, documentsOriginalPathsArray, documentsUrisArray, captionToSend, documentsMimeType, did, null, null, null, null, true, 0); SendMessagesHelper.prepareSendingDocuments(accountInstance, documentsPathsArray, documentsOriginalPathsArray, documentsUrisArray, captionToSend, documentsMimeType, did, null, null, null, null, notify, 0);
} }
if (sendingLocation != null) { if (sendingLocation != null) {
SendMessagesHelper.prepareSendingLocation(accountInstance, sendingLocation, did); SendMessagesHelper.prepareSendingLocation(accountInstance, sendingLocation, did);
@ -4094,11 +4116,11 @@ public class LaunchActivity extends Activity implements ActionBarLayout.ActionBa
if (contactsToSend != null && !contactsToSend.isEmpty()) { if (contactsToSend != null && !contactsToSend.isEmpty()) {
for (int a = 0; a < contactsToSend.size(); a++) { for (int a = 0; a < contactsToSend.size(); a++) {
TLRPC.User user = contactsToSend.get(a); TLRPC.User user = contactsToSend.get(a);
SendMessagesHelper.getInstance(account).sendMessage(user, did, null, null, null, null, true, 0); SendMessagesHelper.getInstance(account).sendMessage(user, did, null, null, null, null, notify, 0);
} }
} }
if (!TextUtils.isEmpty(message)) { if (!TextUtils.isEmpty(message)) {
SendMessagesHelper.prepareSendingText(accountInstance, message.toString(), did, true, 0); SendMessagesHelper.prepareSendingText(accountInstance, message.toString(), did, notify, 0);
} }
} }
} }