update to 9.3.2

This commit is contained in:
xaxtix 2022-12-31 14:47:53 +04:00
parent 3ccf875b1b
commit 5a31f93ec2
45 changed files with 482 additions and 159 deletions

View File

@ -499,7 +499,7 @@ public class AndroidUtilities {
}
}
}
}), 36);
}), Build.VERSION.SDK_INT <= 23 ? 100 : 36);
}
}
@ -4617,13 +4617,7 @@ public class AndroidUtilities {
}
public static boolean isAccessibilityScreenReaderEnabled() {
return false;
// try {
// AccessibilityManager am = (AccessibilityManager) ApplicationLoader.applicationContext.getSystemService(Context.ACCESSIBILITY_SERVICE);
// return (am != null && am.isEnabled() && !am.isTouchExplorationEnabled());
// } catch (Exception ignroe) {
// return false;
// }
return isAccessibilityTouchExplorationEnabled();
}
public static CharSequence trim(CharSequence text, int[] newStart) {

View File

@ -24,8 +24,8 @@ public class BuildVars {
public static boolean USE_CLOUD_STRINGS = true;
public static boolean CHECK_UPDATES = true;
public static boolean NO_SCOPED_STORAGE = Build.VERSION.SDK_INT <= 29;
public static int BUILD_VERSION = 3021;
public static String BUILD_VERSION_STRING = "9.3.0";
public static int BUILD_VERSION = 3023;
public static String BUILD_VERSION_STRING = "9.3.2";
public static int APP_ID = 4;
public static String APP_HASH = "014b35b6184100b085b0d0572f9b5103";

View File

@ -753,7 +753,6 @@ public class ContactsController extends BaseController {
pCur = null;
}
//TODO optimize
Cursor cur = cr.query(ContactsContract.Contacts.CONTENT_URI, null,ContactsContract.Contacts.HAS_PHONE_NUMBER + " = ?", new String[]{"0"}, null);
if (cur != null) {
String[] metadata = new String[5];
@ -789,6 +788,8 @@ public class ContactsController extends BaseController {
}
}
pCur.close();
if (phone != null) {
String shortNumber = phone;
@ -811,7 +812,9 @@ public class ContactsController extends BaseController {
contactsMap.put(lookup_key, contact);
}
}
cur.close();
}
} catch (Throwable e) {
FileLog.e(e);
if (contactsMap != null) {

View File

@ -494,10 +494,10 @@ public class Emoji {
}
public static CharSequence replaceEmoji(CharSequence cs, Paint.FontMetricsInt fontMetrics, int size, boolean createNew, int[] emojiOnly) {
return replaceEmoji(cs, fontMetrics, size, createNew, emojiOnly, false);
return replaceEmoji(cs, fontMetrics, createNew, emojiOnly, DynamicDrawableSpan.ALIGN_BOTTOM);
}
public static CharSequence replaceEmoji(CharSequence cs, Paint.FontMetricsInt fontMetrics, int size, boolean createNew, int[] emojiOnly, boolean limit) {
public static CharSequence replaceEmoji(CharSequence cs, Paint.FontMetricsInt fontMetrics, boolean createNew, int[] emojiOnly, int alignment) {
if (SharedConfig.useSystemEmoji || cs == null || cs.length() == 0) {
return cs;
}
@ -534,7 +534,7 @@ public class Emoji {
}
drawable = Emoji.getEmojiDrawable(emojiRange.code);
if (drawable != null) {
span = new EmojiSpan(drawable, DynamicDrawableSpan.ALIGN_BOTTOM, size, fontMetrics);
span = new EmojiSpan(drawable, alignment, fontMetrics);
span.emoji = emojiRange.code == null ? null : emojiRange.code.toString();
s.setSpan(span, emojiRange.start, emojiRange.end, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
}
@ -553,7 +553,7 @@ public class Emoji {
public int size = AndroidUtilities.dp(20);
public String emoji;
public EmojiSpan(Drawable d, int verticalAlignment, int s, Paint.FontMetricsInt original) {
public EmojiSpan(Drawable d, int verticalAlignment, Paint.FontMetricsInt original) {
super(d, verticalAlignment);
fontMetrics = original;
if (original != null) {

View File

@ -71,7 +71,7 @@ public class FileLog {
private static HashSet<String> excludeRequests;
public static void dumpResponseAndRequest(TLObject request, TLObject response, TLRPC.TL_error error, long requestMsgId, long startRequestTimeInMillis, int requestToken) {
if (!BuildVars.DEBUG_PRIVATE_VERSION || !BuildVars.LOGS_ENABLED || request == null) {
if (!BuildVars.DEBUG_PRIVATE_VERSION || !BuildVars.LOGS_ENABLED || request == null || SharedConfig.getDevicePerformanceClass() != SharedConfig.PERFORMANCE_CLASS_LOW) {
return;
}
String requestSimpleName = request.getClass().getSimpleName();

View File

@ -85,7 +85,7 @@ import java.util.zip.GZIPInputStream;
* isc - ignore cache for small images
* b - need blur image
* g - autoplay
* lastframe - return firstframe for Lottie animation
* lastframe - return lastframe for Lottie animation
* firstframe - return firstframe for Lottie animation
*/
public class ImageLoader {

View File

@ -5329,7 +5329,6 @@ public class MessagesController extends BaseController implements NotificationCe
getMessagesStorage().putDialogPhotos(did, res, messages);
} else if (res == null || res.photos.isEmpty()) {
loadDialogPhotos(did, count, maxId, false, classGuid);
return;
}
AndroidUtilities.runOnUIThread(() -> {
putUsers(res.users, fromCache);

View File

@ -15,6 +15,7 @@ import android.text.SpannableStringBuilder;
import android.text.Spanned;
import android.text.TextUtils;
import android.text.style.ForegroundColorSpan;
import android.util.Log;
import android.util.Pair;
import android.util.SparseArray;
import android.util.SparseIntArray;
@ -9751,6 +9752,9 @@ public class MessagesStorage extends BaseController {
if (updateTopic) {
if (unreadMentionsCount >= 0) {
if (BuildVars.DEBUG_PRIVATE_VERSION && unreadMentionsCount > 0) {
FileLog.d("(updateRepliesMaxReadIdInternal) new unread mentions " + unreadMentionsCount + " for dialog_id=" + -chatId + " topic_id=" + mid);
}
database.executeFast(String.format(Locale.ENGLISH, "UPDATE topics SET max_read_id = %d, unread_count = %d, unread_mentions = %d WHERE did = %d AND topic_id = %d", readMaxId, unreadCount, unreadMentionsCount, -chatId, mid)).stepThis().dispose();
} else {
database.executeFast(String.format(Locale.ENGLISH, "UPDATE topics SET max_read_id = %d, unread_count = %d WHERE did = %d AND topic_id = %d", readMaxId, unreadCount, -chatId, mid)).stepThis().dispose();
@ -10894,6 +10898,9 @@ public class MessagesStorage extends BaseController {
int newUnreadMentions = oldMentions + newMentions;
int newTotalMessagesCount = oldTotalCount == 0 ? 0 : oldTotalCount + newMessages;
if (BuildVars.DEBUG_PRIVATE_VERSION && newUnreadMentions > 0) {
FileLog.d("(putMessagesInternal)" + " new unread mentions " + newUnreadMentions + " for dialog_id=" + topicKey.dialogId + " topic_id=" + topicKey.topicId);
}
state_topics_update.requery();
state_topics_update.bindInteger(1, newUnreadCount);
state_topics_update.bindInteger(2, messageId);
@ -11917,6 +11924,9 @@ public class MessagesStorage extends BaseController {
int newUnreadCount = Math.max(0, old_unread_count - counts[0]);
int newUnreadMentionsCount = Math.max(0, old_mentions_count - counts[1]);
int newTotalCount = Math.max(0, old_total_count - counts[2]);
if (BuildVars.DEBUG_PRIVATE_VERSION && newUnreadMentionsCount > 0) {
FileLog.d("(markMessagesAsDeletedInternal) new unread mentions " + newUnreadMentionsCount + " for dialog_id=" + topicKey.dialogId + " topic_id=" + topicKey.topicId);
}
state = database.executeFast("UPDATE topics SET unread_count = ?, unread_mentions = ?, total_messages_count = ? WHERE did = ? AND topic_id = ?");
state.requery();
state.bindInteger(1, newUnreadCount);

View File

@ -23,6 +23,7 @@ import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.ImageDecoder;
import android.graphics.Paint;
@ -53,6 +54,7 @@ import androidx.core.content.FileProvider;
import androidx.core.content.LocusIdCompat;
import androidx.core.content.pm.ShortcutInfoCompat;
import androidx.core.content.pm.ShortcutManagerCompat;
import androidx.core.graphics.ColorUtils;
import androidx.core.graphics.drawable.IconCompat;
import com.google.android.exoplayer2.util.Log;
@ -61,10 +63,12 @@ import org.telegram.messenger.support.LongSparseIntArray;
import org.telegram.tgnet.ConnectionsManager;
import org.telegram.tgnet.TLRPC;
import org.telegram.ui.BubbleActivity;
import org.telegram.ui.Components.spoilers.SpoilerEffect;
import org.telegram.ui.LaunchActivity;
import org.telegram.ui.PopupNotificationActivity;
import java.io.File;
import java.io.FileOutputStream;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.HashMap;
@ -134,6 +138,8 @@ public class NotificationsController extends BaseController {
private int notificationId;
private String notificationGroup;
private SpoilerEffect mediaSpoilerEffect = new SpoilerEffect();
public static final int SETTING_SOUND_ON = 0;
public static final int SETTING_SOUND_OFF = 1;
@ -4396,6 +4402,40 @@ public class NotificationsController extends BaseController {
if (preview[0] && Build.VERSION.SDK_INT >= Build.VERSION_CODES.P && !((ActivityManager) ApplicationLoader.applicationContext.getSystemService(Context.ACTIVITY_SERVICE)).isLowRamDevice()) {
if (!waitingForPasscode && !messageObject.isSecretMedia() && (messageObject.type == MessageObject.TYPE_PHOTO || messageObject.isSticker())) {
File attach = getFileLoader().getPathToMessage(messageObject.messageOwner);
File blurredAttach;
if (attach.exists() && messageObject.hasMediaSpoilers()) {
blurredAttach = new File(attach.getParentFile(), attach.getName() + ".blur.jpg");
if (!blurredAttach.exists()) {
try {
Bitmap bitmap = BitmapFactory.decodeFile(attach.getAbsolutePath());
Bitmap blurBitmap = Utilities.stackBlurBitmapMax(bitmap);
bitmap.recycle();
Bitmap scaledBitmap = Bitmap.createScaledBitmap(blurBitmap, bitmap.getWidth(), bitmap.getHeight(), true);
Utilities.stackBlurBitmap(scaledBitmap, 5);
blurBitmap.recycle();
Canvas canvas = new Canvas(scaledBitmap);
int sColor = Color.WHITE;
mediaSpoilerEffect.setColor(ColorUtils.setAlphaComponent(sColor, (int) (Color.alpha(sColor) * 0.325f)));
mediaSpoilerEffect.setBounds(0, 0, scaledBitmap.getWidth(), scaledBitmap.getHeight());
mediaSpoilerEffect.draw(canvas);
FileOutputStream fos = new FileOutputStream(blurredAttach);
scaledBitmap.compress(Bitmap.CompressFormat.JPEG, 100, fos);
fos.close();
scaledBitmap.recycle();
attach = blurredAttach;
} catch (Exception e) {
FileLog.e(e);
}
}
} else {
blurredAttach = null;
}
NotificationCompat.MessagingStyle.Message msg = new NotificationCompat.MessagingStyle.Message(message, ((long) messageObject.messageOwner.date) * 1000L, person);
String mimeType = messageObject.isSticker() ? "image/webp" : "image/jpeg";
Uri uri;
@ -4423,7 +4463,12 @@ public class NotificationsController extends BaseController {
messagingStyle.addMessage(msg);
Uri uriFinal = uri;
ApplicationLoader.applicationContext.grantUriPermission("com.android.systemui", uri, Intent.FLAG_GRANT_READ_URI_PERMISSION);
AndroidUtilities.runOnUIThread(() -> ApplicationLoader.applicationContext.revokeUriPermission(uriFinal, Intent.FLAG_GRANT_READ_URI_PERMISSION), 20000);
AndroidUtilities.runOnUIThread(() -> {
ApplicationLoader.applicationContext.revokeUriPermission(uriFinal, Intent.FLAG_GRANT_READ_URI_PERMISSION);
if (blurredAttach != null) {
blurredAttach.delete();
}
}, 20000);
if (!TextUtils.isEmpty(messageObject.caption)) {
messagingStyle.addMessage(messageObject.caption, ((long) messageObject.messageOwner.date) * 1000, person);

View File

@ -467,7 +467,7 @@ public class SharedConfig {
fastScrollHintCount = preferences.getInt("fastScrollHintCount", 3);
dontAskManageStorage = preferences.getBoolean("dontAskManageStorage", false);
hasEmailLogin = preferences.getBoolean("hasEmailLogin", false);
useLNavigation = preferences.getBoolean("useLNavigation", BuildVars.DEBUG_VERSION);
useLNavigation = preferences.getBoolean("useLNavigation", false);
isFloatingDebugActive = preferences.getBoolean("floatingDebugActive", false);
preferences = ApplicationLoader.applicationContext.getSharedPreferences("Notifications", Activity.MODE_PRIVATE);

View File

@ -80,9 +80,9 @@ public class PhotoUtilities {
ImageLoader.getInstance().replaceImageInCache(oldKey, newKey, ImageLocation.getForUser(user, ImageLocation.TYPE_SMALL), false);
}
if (bigSize2 != null && smallSize != null && smallSize.location != null) {
if (bigSize2 != null && bigSize != null && bigSize.location != null) {
File destFile = FileLoader.getInstance(currentAccount).getPathToAttach(bigSize2, true);
File src = FileLoader.getInstance(currentAccount).getPathToAttach(smallSize.location, true);
File src = FileLoader.getInstance(currentAccount).getPathToAttach(bigSize.location, true);
src.renameTo(destFile);
}

View File

@ -1256,7 +1256,7 @@ public class DialogsSearchAdapter extends RecyclerListView.SelectionAdapter {
@Override
public boolean isEnabled(RecyclerView.ViewHolder holder) {
int type = holder.getItemViewType();
return type != 1 && type != 3;
return type != 1 && type != 4;
}
@Override

View File

@ -50,6 +50,7 @@ import android.text.StaticLayout;
import android.text.TextPaint;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.text.style.DynamicDrawableSpan;
import android.text.style.MetricAffectingSpan;
import android.text.style.URLSpan;
import android.util.Property;
@ -106,6 +107,7 @@ import org.telegram.messenger.AndroidUtilities;
import org.telegram.messenger.ApplicationLoader;
import org.telegram.messenger.ChatObject;
import org.telegram.messenger.DownloadController;
import org.telegram.messenger.Emoji;
import org.telegram.messenger.FileLoader;
import org.telegram.messenger.FileLog;
import org.telegram.messenger.ImageLoader;
@ -2501,6 +2503,7 @@ public class ArticleViewer implements NotificationCenter.NotificationCenterDeleg
} else {
paint = getTextPaint(richText, richText, parentBlock);
}
text = Emoji.replaceEmoji(text, paint.getFontMetricsInt(), false, null, DynamicDrawableSpan.ALIGN_BASELINE);
StaticLayout result;
if (maxLines != 0) {
if (parentBlock instanceof TLRPC.TL_pageBlockPullquote) {

View File

@ -91,6 +91,7 @@ import org.telegram.ui.Components.CacheChart;
import org.telegram.ui.Components.CheckBox2;
import org.telegram.ui.Components.CubicBezierInterpolator;
import org.telegram.ui.Components.FlickerLoadingView;
import org.telegram.ui.Components.HideViewAfterAnimation;
import org.telegram.ui.Components.LayoutHelper;
import org.telegram.ui.Components.ListView.AdapterWithDiffUtils;
import org.telegram.ui.Components.LoadingDrawable;
@ -301,7 +302,7 @@ public class CacheControlActivity extends BaseFragment implements NotificationCe
FileLog.e(e);
}
long minDuration = System.currentTimeMillis() - fragmentCreateTime > 25 || true ? 800 : 0;
long minDuration = System.currentTimeMillis() - fragmentCreateTime > 45 ? 600 : 0;
AndroidUtilities.runOnUIThread(() -> {
resumeDelayedFragmentAnimation();
calculating = false;
@ -435,6 +436,13 @@ public class CacheControlActivity extends BaseFragment implements NotificationCe
setCacheModel(cacheModel);
updateRows();
updateChart();
if (cacheChartHeader != null && !calculating && System.currentTimeMillis() - fragmentCreateTime > 120) {
cacheChartHeader.setData(
totalSize > 0,
totalDeviceSize <= 0 ? 0 : (float) totalSize / totalDeviceSize,
totalDeviceFreeSize <= 0 || totalDeviceSize <= 0 ? 0 : (float) (totalDeviceSize - totalDeviceFreeSize) / totalDeviceSize
);
}
}
});
});
@ -885,15 +893,6 @@ public class CacheControlActivity extends BaseFragment implements NotificationCe
MediaDataController.getInstance(currentAccount).chekAllMedia(true);
loadDialogEntities();
updateChart();
if (cacheChartHeader != null && !calculating) {
cacheChartHeader.setData(
totalSize > 0,
totalDeviceSize <= 0 ? 0 : (float) totalSize / totalDeviceSize,
totalDeviceFreeSize <= 0 || totalDeviceSize <= 0 ? 0 : (float) (totalDeviceSize - totalDeviceFreeSize) / totalDeviceSize
);
}
});
}
@ -1074,6 +1073,9 @@ public class CacheControlActivity extends BaseFragment implements NotificationCe
if (getParentActivity() == null) {
return;
}
if (position < 0 || position >= itemInners.size()) {
return;
}
ItemInner item = itemInners.get(position);
// if (position == databaseRow) {
// clearDatabase();
@ -1393,14 +1395,14 @@ public class CacheControlActivity extends BaseFragment implements NotificationCe
} else if (i == 1) {
subtitle[i].setAlpha(0);
subtitle[i].setText(LocaleController.getString("StorageUsageTelegram", R.string.StorageUsageTelegram));
subtitle[i].setVisibility(View.GONE);
subtitle[i].setVisibility(View.INVISIBLE);
} else if (i == 2) {
subtitle[i].setText(LocaleController.getString("StorageCleared2", R.string.StorageCleared2));
subtitle[i].setAlpha(0);
subtitle[i].setVisibility(View.GONE);
subtitle[i].setVisibility(View.INVISIBLE);
}
subtitle[i].setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteGrayText4));
addView(subtitle[i], LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.TOP | Gravity.CENTER_HORIZONTAL, 0, i == 2 ? 38 : 32, 0, 0));
addView(subtitle[i], LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.CENTER, 0, i == 2 ? 12 : -6, 0, 0));
}
bottomImage = new View(context) {
@ -1457,9 +1459,36 @@ public class CacheControlActivity extends BaseFragment implements NotificationCe
private void switchSubtitle(int type) {
boolean animated = System.currentTimeMillis() - fragmentCreateTime > 40;
AndroidUtilities.updateViewShow(subtitle[0], type == 0, false, -.5f, animated, null);
AndroidUtilities.updateViewShow(subtitle[1], type == 1, false, -.5f, animated, null);
AndroidUtilities.updateViewShow(subtitle[2], type == 2, false, -.5f, animated, null);
updateViewVisible(subtitle[0], type == 0, animated);
updateViewVisible(subtitle[1], type == 1, animated);
updateViewVisible(subtitle[2], type == 2, animated);
}
private void updateViewVisible(View view, boolean show, boolean animated) {
if (view == null) {
return;
}
if (view.getParent() == null) {
animated = false;
}
view.animate().setListener(null).cancel();
if (!animated) {
view.setVisibility(show ? View.VISIBLE : View.INVISIBLE);
view.setTag(show ? 1 : null);
view.setAlpha(show ? 1f : 0f);
view.setTranslationY(show ? 0 : AndroidUtilities.dp(8));
invalidate();
} else if (show) {
if (view.getVisibility() != View.VISIBLE) {
view.setVisibility(View.VISIBLE);
view.setAlpha(0f);
view.setTranslationY(AndroidUtilities.dp(8));
}
view.animate().alpha(1f).translationY(0).setInterpolator(CubicBezierInterpolator.EASE_OUT_QUINT).setDuration(340).setUpdateListener(anm -> invalidate()).start();
} else {
view.animate().alpha(0).translationY(AndroidUtilities.dp(8)).setListener(new HideViewAfterAnimation(view)).setInterpolator(CubicBezierInterpolator.EASE_OUT_QUINT).setDuration(340).setUpdateListener(anm -> invalidate()).start();
}
}
@Override
@ -1471,7 +1500,7 @@ public class CacheControlActivity extends BaseFragment implements NotificationCe
int height = AndroidUtilities.dp(90 - 18);
int maxSubtitleHeight = 0;
for (int i = 0; i < subtitle.length; ++i) {
maxSubtitleHeight = Math.max(maxSubtitleHeight, subtitle[i].getMeasuredHeight());
maxSubtitleHeight = Math.max(maxSubtitleHeight, subtitle[i].getMeasuredHeight() - (i == 2 ? AndroidUtilities.dp(16) : 0));
}
height += maxSubtitleHeight;
setMeasuredDimension(fullWidth, height);
@ -1486,7 +1515,7 @@ public class CacheControlActivity extends BaseFragment implements NotificationCe
@Override
protected void dispatchDraw(Canvas canvas) {
float barAlpha = Math.max(subtitle[0].getAlpha(), subtitle[1].getAlpha());
float barAlpha = 1f - subtitle[2].getAlpha();
float loading = this.loadingFloat.set(this.percent == null ? 1f : 0f);
float percent = this.percentAnimated.set(this.percent == null ? 0 : this.percent);

View File

@ -685,11 +685,12 @@ public class CachedMediaLayout extends FrameLayout implements NestedSizeNotifier
CacheModel.FileInfo file = itemInners.get(position).file;
boolean animated = file == cell.getTag();
cell.setTag(file);
int size = (int) Math.max(100, AndroidUtilities.getRealScreenSize().x / AndroidUtilities.density);
if (file.type == TYPE_VIDEOS) {
cell.imageReceiver.setImage(ImageLocation.getForPath("vthumb://" + 0 + ":" + file.file.getAbsolutePath()), null, thumb, null, null, 0);
cell.imageReceiver.setImage(ImageLocation.getForPath("vthumb://" + 0 + ":" + file.file.getAbsolutePath()), size + "_" + size, thumb, null, null, 0);
cell.setVideoText(AndroidUtilities.formatFileSize(file.size), true);
} else {
cell.imageReceiver.setImage(ImageLocation.getForPath("thumb://" + 0 + ":" + file.file.getAbsolutePath()), null, thumb, null, null, 0);
cell.imageReceiver.setImage(ImageLocation.getForPath("thumb://" + 0 + ":" + file.file.getAbsolutePath()), size + "_" + size, thumb, null, null, 0);
cell.setVideoText(AndroidUtilities.formatFileSize(file.size), false);
}
cell.setChecked(cacheModel.isSelected(file), animated);

View File

@ -736,7 +736,7 @@ public class ChatActionCell extends BaseCell implements DownloadController.FileD
}
if (!result) {
if (event.getAction() == MotionEvent.ACTION_DOWN || pressedLink != null && event.getAction() == MotionEvent.ACTION_UP) {
if (x >= textX && y >= textY && x <= textX + textWidth && y <= textY + textHeight) {
if (textLayout != null && x >= textX && y >= textY && x <= textX + textWidth && y <= textY + textHeight) {
y -= textY;
x -= textXLeft;

View File

@ -2371,16 +2371,16 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
int offset = AndroidUtilities.dp(27);
area2 = x >= buttonX + offset && x <= buttonX + offset + side && y >= buttonY + offset && y <= buttonY + offset + side;
}
boolean noSpoilersOrRevealed = currentMessageObject == null || !currentMessageObject.hasMediaSpoilers() || currentMessageObject.isMediaSpoilersRevealed;
boolean allowClickButtons = currentMessageObject == null || !currentMessageObject.hasMediaSpoilers() || currentMessageObject.isMediaSpoilersRevealed || buttonState == 1;
if (area2) {
miniButtonPressed = 1;
invalidate();
result = true;
} else if (buttonState != -1 && radialProgress.getIcon() != MediaActionDrawable.ICON_NONE && x >= buttonX && x <= buttonX + side && y >= buttonY && y <= buttonY + side && noSpoilersOrRevealed) {
} else if (buttonState != -1 && radialProgress.getIcon() != MediaActionDrawable.ICON_NONE && x >= buttonX && x <= buttonX + side && y >= buttonY && y <= buttonY + side && allowClickButtons) {
buttonPressed = 1;
invalidate();
result = true;
} else if (drawVideoImageButton && buttonState != -1 && x >= videoButtonX && x <= videoButtonX + AndroidUtilities.dp(26 + 8) + Math.max(infoWidth, docTitleWidth) && y >= videoButtonY && y <= videoButtonY + AndroidUtilities.dp(30) && noSpoilersOrRevealed) {
} else if (drawVideoImageButton && buttonState != -1 && x >= videoButtonX && x <= videoButtonX + AndroidUtilities.dp(26 + 8) + Math.max(infoWidth, docTitleWidth) && y >= videoButtonY && y <= videoButtonY + AndroidUtilities.dp(30) && allowClickButtons) {
videoButtonPressed = 1;
invalidate();
result = true;
@ -9433,13 +9433,21 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
if (flipImage) {
canvas.save();
canvas.scale(-1f, 1, photoImage.getCenterX(), photoImage.getCenterY());
imageDrawn = photoImage.draw(canvas);
if (allowDrawPhotoImage()) {
imageDrawn = photoImage.draw(canvas);
} else {
imageDrawn = true;
}
if (currentMessageObject.hasMediaSpoilers()) {
drawBlurredPhoto(canvas);
}
canvas.restore();
} else {
imageDrawn = photoImage.draw(canvas);
if (allowDrawPhotoImage()) {
imageDrawn = photoImage.draw(canvas);
} else {
imageDrawn = true;
}
if (currentMessageObject.hasMediaSpoilers()) {
drawBlurredPhoto(canvas);
}
@ -10259,7 +10267,11 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
if (delegate == null || delegate.getPinchToZoomHelper() == null || !delegate.getPinchToZoomHelper().isInOverlayModeFor(this)) {
if (alpha != 1f) {
photoImage.setAlpha(alpha);
imageDrawn = photoImage.draw(canvas);
if (allowDrawPhotoImage()) {
imageDrawn = photoImage.draw(canvas);
} else {
imageDrawn = true;
}
if (currentMessageObject.hasMediaSpoilers()) {
blurredPhotoImage.setAlpha(alpha);
drawBlurredPhoto(canvas);
@ -10267,7 +10279,11 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
}
photoImage.setAlpha(1f);
} else {
imageDrawn = photoImage.draw(canvas);
if (allowDrawPhotoImage()) {
imageDrawn = photoImage.draw(canvas);
} else {
imageDrawn = true;
}
if (currentMessageObject.hasMediaSpoilers()) {
drawBlurredPhoto(canvas);
}
@ -10360,7 +10376,11 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
if (delegate == null || delegate.getPinchToZoomHelper() == null || !delegate.getPinchToZoomHelper().isInOverlayModeFor(this)) {
if (alpha != 1f) {
photoImage.setAlpha(alpha);
imageDrawn = photoImage.draw(canvas);
if (allowDrawPhotoImage()) {
imageDrawn = photoImage.draw(canvas);
} else {
imageDrawn = true;
}
if (currentMessageObject.hasMediaSpoilers()) {
blurredPhotoImage.setAlpha(alpha);
drawBlurredPhoto(canvas);
@ -10368,7 +10388,11 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
}
photoImage.setAlpha(1f);
} else {
imageDrawn = photoImage.draw(canvas);
if (allowDrawPhotoImage()) {
imageDrawn = photoImage.draw(canvas);
} else {
imageDrawn = true;
}
if (currentMessageObject.hasMediaSpoilers()) {
drawBlurredPhoto(canvas);
}
@ -10551,8 +10575,8 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
float s = button.getPressScale();
rect.set(button.x + addX, y, button.x + addX + button.width, y + button.height);
canvas.save();
if (s != 1) {
canvas.save();
canvas.scale(s, s, rect.centerX(), rect.centerY());
}
applyServiceShaderMatrix();
@ -10629,13 +10653,15 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
Theme.chat_botCardDrawable.draw(canvas);
}
if (s != 1) {
canvas.restore();
}
canvas.restore();
}
canvas.restore();
}
private boolean allowDrawPhotoImage() {
return !currentMessageObject.hasMediaSpoilers() || currentMessageObject.isMediaSpoilersRevealed || mediaSpoilerRevealProgress != 0f || blurredPhotoImage.getBitmap() == null;
}
@SuppressLint("Range")
public void drawMessageText(Canvas canvas, ArrayList<MessageObject.TextLayoutBlock> textLayoutBlocks, boolean origin, float alpha, boolean drawOnlyText) {
if (textLayoutBlocks == null || textLayoutBlocks.isEmpty() || alpha == 0) {
@ -11676,7 +11702,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
updateButtonState(false, true, false);
}
}
if (set && !thumb && currentMessageObject != null) {
if (set && currentMessageObject != null) {
if (blurredPhotoImage.getBitmap() != null) {
blurredPhotoImage.getBitmap().recycle();
blurredPhotoImage.setImageBitmap((Bitmap) null);
@ -12477,7 +12503,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
replyImageReceiver.setRoundRadius(AndroidUtilities.dp(4));
}
currentReplyPhoto = photoSize;
replyImageReceiver.setImage(ImageLocation.getForObject(photoSize, photoObject), hasReplySpoiler ? "20_20_b" : "50_50", ImageLocation.getForObject(thumbPhotoSize, photoObject), hasReplySpoiler ? "50_50_b4" : "50_50_b", size, null, messageObject.replyMessageObject, cacheType);
replyImageReceiver.setImage(ImageLocation.getForObject(photoSize, photoObject), hasReplySpoiler ? "5_5_b" : "50_50", ImageLocation.getForObject(thumbPhotoSize, photoObject), hasReplySpoiler ? "50_50_b4" : "50_50_b", size, null, messageObject.replyMessageObject, cacheType);
needReplyImage = true;
maxWidth -= AndroidUtilities.dp(16) + (Theme.chat_replyTextPaint.getTextSize() + Theme.chat_replyNamePaint.getTextSize());
}

View File

@ -2097,7 +2097,7 @@ public class DialogCell extends BaseCell {
if (nameLayout != null && nameLayout.getLineCount() > 0) {
left = nameLayout.getLineLeft(0);
widthpx = Math.ceil(nameLayout.getLineWidth(0));
nameWidth += AndroidUtilities.dp(12);
nameLeft += AndroidUtilities.dp(12);
if (nameLayoutEllipsizeByGradient) {
widthpx = Math.min(nameWidth, widthpx);
}

View File

@ -620,6 +620,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
private boolean replyImageHasMediaSpoiler;
private int pinnedImageSize;
private int pinnedImageCacheType;
private boolean pinnedImageHasBlur;
private TLRPC.PhotoSize pinnedImageLocation;
private TLRPC.PhotoSize pinnedImageThumbLocation;
private TLObject pinnedImageLocationObject;
@ -935,6 +936,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
private final static int OPTION_SEND_NOW = 100;
private final static int OPTION_EDIT_SCHEDULE_TIME = 102;
private final static int OPTION_SPEED_PROMO = 103;
private final static int OPTION_OPEN_PROFILE = 104;
private final static int[] allowedNotificationsDuringChatListAnimations = new int[]{
NotificationCenter.messagesRead,
@ -3231,7 +3233,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
boolean r = false;
if (isInPreviewMode() && allowExpandPreviewByClick) {
if (ev.getAction() == MotionEvent.ACTION_DOWN) {
boolean pressedOnPageDownButtons = false;
boolean pressedOnPageDownButtons = false, pressedOnAvatar = false;
int[] off = new int[2];
getLocationInWindow(off);
int[] pos = new int[2];
@ -3242,6 +3244,14 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
pressedOnPageDownButtons = true;
}
}
if (avatarContainer != null && avatarContainer.getAvatarImageView() != null) {
BackupImageView avatar = avatarContainer.getAvatarImageView();
avatar.getLocationInWindow(pos);
AndroidUtilities.rectTmp2.set(pos[0] - off[0], pos[1] - off[1], pos[0] - off[0] + avatar.getMeasuredWidth(), pos[1] - off[1] + avatar.getMeasuredHeight());
if (AndroidUtilities.rectTmp2.contains((int) ev.getX(), (int) ev.getY())) {
pressedOnAvatar = true;
}
}
if (!pressedOnPageDownButtons && mentiondownButton != null) {
mentiondownButton.getLocationInWindow(pos);
AndroidUtilities.rectTmp2.set(pos[0] - off[0], pos[1] - off[1], pos[0] - off[0] + mentiondownButton.getMeasuredWidth(), pos[1] - off[1] + mentiondownButton.getMeasuredHeight());
@ -3249,7 +3259,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
pressedOnPageDownButtons = true;
}
}
if (!pressedOnPageDownButtons) {
if (!pressedOnPageDownButtons && !pressedOnAvatar) {
x = ev.getX();
y = ev.getY();
pressTime = SystemClock.elapsedRealtime();
@ -5144,7 +5154,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
}
selectorRect.setEmpty();
if (pullingDownOffset != 0) {
canvas.save();
int restoreToCount = canvas.save();
float transitionOffset = 0;
if (pullingDownAnimateProgress != 0) {
transitionOffset = (chatListView.getMeasuredHeight() - pullingDownOffset) * pullingDownAnimateProgress;
@ -5153,7 +5163,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
drawChatBackgroundElements(canvas);
super.dispatchDraw(canvas);
drawChatForegroundElements(canvas);
canvas.restore();
canvas.restoreToCount(restoreToCount);
} else {
drawChatBackgroundElements(canvas);
super.dispatchDraw(canvas);
@ -6603,7 +6613,40 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
pinnedMessageButton[a] = new PinnedMessageButton(context);
pinnedMessageView.addView(pinnedMessageButton[a], LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, 28, Gravity.TOP | Gravity.RIGHT, 0, 10, 14, 0));
pinnedMessageImageView[a] = new BackupImageView(context);
pinnedMessageImageView[a] = new BackupImageView(context) {
private SpoilerEffect spoilerEffect = new SpoilerEffect();
private Path path = new Path();
private float[] radii = new float[8];
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
if (hasBlur) {
canvas.save();
AndroidUtilities.rectTmp.set(0, 0, getWidth(), getHeight());
int[] rad = imageReceiver.getRoundRadius();
radii[0] = radii[1] = rad[0];
radii[2] = radii[3] = rad[1];
radii[4] = radii[5] = rad[2];
radii[6] = radii[7] = rad[3];
path.rewind();
path.addRoundRect(AndroidUtilities.rectTmp, radii, Path.Direction.CW);
canvas.clipPath(path);
int sColor = Color.WHITE;
spoilerEffect.setColor(ColorUtils.setAlphaComponent(sColor, (int) (Color.alpha(sColor) * 0.325f)));
spoilerEffect.setBounds(0, 0, getWidth(), getHeight());
spoilerEffect.draw(canvas);
canvas.restore();
invalidate();
}
}
};
pinnedMessageImageView[a].setBlurAllowed(true);
pinnedMessageImageView[a].setRoundRadius(AndroidUtilities.dp(2));
pinnedMessageView.addView(pinnedMessageImageView[a], LayoutHelper.createFrame(32, 32, Gravity.TOP | Gravity.LEFT, 17, 8, 0, 0));
if (a == 1) {
@ -8357,7 +8400,6 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
}
}
};
replyImageView.setBlurAllowed(true);
replyImageView.setRoundRadius(AndroidUtilities.dp(2));
replyLayout.addView(replyImageView, LayoutHelper.createFrame(34, 34, Gravity.TOP | Gravity.LEFT, 52, 6, 0, 0));
@ -9728,7 +9770,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
if (progressView == null) {
return;
}
if (DISABLE_PROGRESS_VIEW && !AndroidUtilities.isTablet() && !isComments && currentUser == null) {
if (DISABLE_PROGRESS_VIEW && !AndroidUtilities.isTablet() && !isComments && currentUser == null && !SharedConfig.getLiteMode().enabled()) {
animateProgressViewTo = show;
return;
}
@ -10767,7 +10809,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
}
private void showVoiceHint(boolean hide, boolean video) {
if (getParentActivity() == null || fragmentView == null || hide && voiceHintTextView == null || chatMode != 0 || chatActivityEnterView == null || chatActivityEnterView.getAudioVideoButtonContainer() == null || chatActivityEnterView.getAudioVideoButtonContainer().getVisibility() != View.VISIBLE) {
if (getParentActivity() == null || fragmentView == null || hide && voiceHintTextView == null || chatMode != 0 || chatActivityEnterView == null || chatActivityEnterView.getAudioVideoButtonContainer() == null || chatActivityEnterView.getAudioVideoButtonContainer().getVisibility() != View.VISIBLE || isInPreviewMode()) {
return;
}
if (voiceHintTextView == null) {
@ -12378,8 +12420,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
replyImageThumbLocation = thumbPhotoSize;
replyImageLocationObject = photoSizeObject;
replyImageHasMediaSpoiler = thumbMediaMessageObject.hasMediaSpoilers();
replyImageView.setImage(ImageLocation.getForObject(replyImageLocation, photoSizeObject), "50_50", ImageLocation.getForObject(thumbPhotoSize, photoSizeObject), "50_50_b", null, size, cacheType, thumbMediaMessageObject);
replyImageView.setHasBlur(replyImageHasMediaSpoiler);
replyImageView.setImage(ImageLocation.getForObject(replyImageLocation, photoSizeObject), replyImageHasMediaSpoiler ? "5_5_b" : "50_50", ImageLocation.getForObject(thumbPhotoSize, photoSizeObject), replyImageHasMediaSpoiler ? "5_5_b" : "50_50_b", null, size, cacheType, thumbMediaMessageObject);
replyImageView.setVisibility(View.VISIBLE);
layoutParams1.leftMargin = layoutParams2.leftMargin = layoutParams3.leftMargin = AndroidUtilities.dp(96);
}
@ -20750,6 +20791,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
if (noImage = (photoSize == null || photoSize instanceof TLRPC.TL_photoSizeEmpty || photoSize.location instanceof TLRPC.TL_fileLocationUnavailable || pinnedMessageObject.isAnyKindOfSticker() || pinnedMessageObject.isSecretMedia())) {
pinnedImageLocation = null;
pinnedImageLocationObject = null;
pinnedImageHasBlur = false;
if (animateToNext == 0) {
pinnedMessageImageView[0].setImageBitmap(null);
pinnedMessageImageView[0].setVisibility(View.INVISIBLE);
@ -20761,6 +20803,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
} else {
pinnedMessageImageView[1].setRoundRadius(AndroidUtilities.dp(2));
}
pinnedImageHasBlur = pinnedMessageObject.hasMediaSpoilers();
pinnedImageSize = size;
pinnedImageCacheType = cacheType;
pinnedImageLocation = photoSize;
@ -20768,6 +20811,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
pinnedImageLocationObject = photoSizeObject;
pinnedMessageImageView[1].setImage(ImageLocation.getForObject(pinnedImageLocation, photoSizeObject), "50_50", ImageLocation.getForObject(thumbPhotoSize, photoSizeObject), "50_50_b", null, size, cacheType, pinnedMessageObject);
pinnedMessageImageView[1].setVisibility(View.VISIBLE);
pinnedMessageImageView[1].setHasBlur(pinnedImageHasBlur);
if (animateToNext != 0) {
pinnedMessageImageView[1].setAlpha(0.0f);
}
@ -21750,6 +21794,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
if (pinnedImageLocation != null && pinnedMessageImageView != null) {
MessageObject pinnedMessageObject = pinnedMessageObjects.get(currentPinnedMessageId);
pinnedMessageImageView[0].setImage(ImageLocation.getForObject(pinnedImageLocation, pinnedImageLocationObject), "50_50", ImageLocation.getForObject(pinnedImageThumbLocation, pinnedImageLocationObject), "50_50_b", null, pinnedImageSize, pinnedImageCacheType, pinnedMessageObject);
pinnedMessageImageView[0].setHasBlur(pinnedImageHasBlur);
}
if (chatMode == 0) {
@ -22547,6 +22592,12 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
final ArrayList<Integer> options = new ArrayList<>();
View optionsView = null;
if (AndroidUtilities.isAccessibilityScreenReaderEnabled() && message.messageOwner != null && message.messageOwner.from_id.user_id != getUserConfig().clientUserId) {
items.add(LocaleController.getString(R.string.OpenProfile));
options.add(OPTION_OPEN_PROFILE);
icons.add(R.drawable.msg_user_search);
}
if (!getUserConfig().isPremium() && !getMessagesController().premiumLocked && message.getDocument() != null && message.getDocument().size >= 150 * 1024 * 1024 && FileLoader.getInstance(currentAccount).isLoadingFile(FileLoader.getAttachFileName(message.getDocument()))) {
items.add(LocaleController.getString(R.string.PremiumSpeedPromo));
options.add(OPTION_SPEED_PROMO);
@ -24998,6 +25049,11 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
showDialog(new PremiumFeatureBottomSheet(ChatActivity.this, PremiumPreviewFragment.PREMIUM_FEATURE_DOWNLOAD_SPEED, true));
break;
}
case OPTION_OPEN_PROFILE: {
TLRPC.Peer from = selectedObject.messageOwner.from_id;
openUserProfile(from.user_id != 0 ? from.user_id : from.channel_id != 0 ? from.channel_id : from.chat_id);
break;
}
}
selectedObject = null;
selectedObjectGroup = null;
@ -27777,22 +27833,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
@Override
public void needOpenUserProfile(long uid) {
if (uid < 0) {
Bundle args = new Bundle();
args.putLong("chat_id", -uid);
if (getMessagesController().checkCanOpenChat(args, ChatActivity.this)) {
presentFragment(new ChatActivity(args));
}
} else if (uid != getUserConfig().getClientUserId()) {
Bundle args = new Bundle();
args.putLong("user_id", uid);
if (currentEncryptedChat != null && uid == currentUser.id) {
args.putLong("dialog_id", dialog_id);
}
ProfileActivity fragment = new ProfileActivity(args);
fragment.setPlayProfileAnimation(currentUser != null && currentUser.id == uid ? 1 : 0);
presentFragment(fragment);
}
openUserProfile(uid);
}
@Override
@ -28621,6 +28662,25 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
}
}
private void openUserProfile(long uid) {
if (uid < 0) {
Bundle args = new Bundle();
args.putLong("chat_id", -uid);
if (getMessagesController().checkCanOpenChat(args, ChatActivity.this)) {
presentFragment(new ChatActivity(args));
}
} else if (uid != getUserConfig().getClientUserId()) {
Bundle args = new Bundle();
args.putLong("user_id", uid);
if (currentEncryptedChat != null && uid == currentUser.id) {
args.putLong("dialog_id", dialog_id);
}
ProfileActivity fragment = new ProfileActivity(args);
fragment.setPlayProfileAnimation(currentUser != null && currentUser.id == uid ? 1 : 0);
presentFragment(fragment);
}
}
private boolean openLinkInternally(String urlFinal, ChatMessageCell cell, CharacterStyle span, int fromMessageId) {
return openLinkInternally(urlFinal, cell, span, fromMessageId, PROGRESS_LINK);
}

View File

@ -242,7 +242,7 @@ public class CacheChart extends View {
particlesStart = now;
}
float time = (now - particlesStart) / 10000f;
if (particle != null || !pathBounds.isEmpty()) {
if (particle != null) {
int sz = particle.getWidth();
float stepangle = 7f;
@ -306,7 +306,7 @@ public class CacheChart extends View {
canvas.saveLayerAlpha(rectF, 0xFF, Canvas.ALL_SAVE_FLAG);
canvas.drawCircle(rectF.centerX(), rectF.centerY(), rectF.width() / 2, uncut);
canvas.drawRect(rectF, paint);
drawParticles(canvas, rectF.centerX(), rectF.centerY(), x, y, angleCenter - angleSize, angleCenter + angleSize, innerRect.width() / 2f, rectF.width() / 2f, textAlpha, Math.max(0, loading / .75f - .75f) * particlesAlpha);
drawParticles(canvas, rectF.centerX(), rectF.centerY(), x, y, 0, 359, innerRect.width() / 2f, rectF.width() / 2f, textAlpha, Math.max(0, loading / .75f - .75f) * particlesAlpha);
canvas.drawCircle(innerRect.centerX(), innerRect.centerY(), innerRect.width() / 2, cut);
canvas.restore();
} else {
@ -732,10 +732,14 @@ public class CacheChart extends View {
}
}
protected int heightDp() {
return 200;
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
final int width = MeasureSpec.getSize(widthMeasureSpec);
final int height = dp(200);
final int height = dp(heightDp());
final int d = dp(172);
chartBounds.set(

View File

@ -105,6 +105,7 @@ import org.telegram.messenger.AccountInstance;
import org.telegram.messenger.AndroidUtilities;
import org.telegram.messenger.ApplicationLoader;
import org.telegram.messenger.ChatObject;
import org.telegram.messenger.ContactsController;
import org.telegram.messenger.DialogObject;
import org.telegram.messenger.Emoji;
import org.telegram.messenger.FileLog;
@ -2331,7 +2332,7 @@ public class ChatActivityEnterView extends BlurredFrameLayout implements Notific
for (int i = 0; i < spans.length; i++) {
editable.removeSpan(spans[i]);
}
Emoji.replaceEmoji(editable, messageEditText.getPaint().getFontMetricsInt(), AndroidUtilities.dp(20), false, null, true);
Emoji.replaceEmoji(editable, messageEditText.getPaint().getFontMetricsInt(), AndroidUtilities.dp(20), false, null);
processChange = false;
}
}
@ -6471,7 +6472,7 @@ public class ChatActivityEnterView extends BlurredFrameLayout implements Notific
FileLog.e(e);
}
}
textToSetWithKeyboard = Emoji.replaceEmoji(new SpannableStringBuilder(stringBuilder), messageEditText.getPaint().getFontMetricsInt(), AndroidUtilities.dp(20), false, null, true);
textToSetWithKeyboard = Emoji.replaceEmoji(new SpannableStringBuilder(stringBuilder), messageEditText.getPaint().getFontMetricsInt(), AndroidUtilities.dp(20), false, null);
} else {
textToSetWithKeyboard = "";
}
@ -6889,10 +6890,16 @@ public class ChatActivityEnterView extends BlurredFrameLayout implements Notific
if (defPeer != null) {
if (defPeer.channel_id != 0) {
TLRPC.Chat ch = MessagesController.getInstance(currentAccount).getChat(defPeer.channel_id);
if (ch != null) senderSelectView.setAvatar(ch);
if (ch != null) {
senderSelectView.setAvatar(ch);
senderSelectView.setContentDescription(LocaleController.formatString(R.string.AccDescrSendAs, ch.title));
}
} else {
TLRPC.User user = MessagesController.getInstance(currentAccount).getUser(defPeer.user_id);
if (user != null) senderSelectView.setAvatar(user);
if (user != null) {
senderSelectView.setAvatar(user);
senderSelectView.setContentDescription(LocaleController.formatString(R.string.AccDescrSendAs, ContactsController.formatName(user.first_name, user.last_name)));
}
}
}
boolean wasVisible = senderSelectView.getVisibility() == View.VISIBLE;

View File

@ -3213,7 +3213,7 @@ public class ChatAttachAlertPhotoLayout extends ChatAttachAlert.AttachAlertLayou
@Override
void onOpenAnimationEnd() {
checkCamera(true);
checkCamera(parentAlert != null && parentAlert.baseFragment instanceof ChatActivity);
}
@Override

View File

@ -131,7 +131,11 @@ public class ChatAvatarContainer extends FrameLayout implements NotificationCent
avatarImageView.setRoundRadius(AndroidUtilities.dp(21));
addView(avatarImageView);
if (avatarClickable) {
avatarImageView.setOnClickListener(v -> openProfile(true));
avatarImageView.setOnClickListener(v -> {
if (!onAvatarClick()) {
openProfile(true);
}
});
}
titleTextView = new SimpleTextView(context) {
@ -233,6 +237,10 @@ public class ChatAvatarContainer extends FrameLayout implements NotificationCent
emojiStatusDrawable = new AnimatedEmojiDrawable.SwapAnimatedEmojiDrawable(titleTextView, AndroidUtilities.dp(24));
}
protected boolean onAvatarClick() {
return false;
}
public void setTitleExpand(boolean titleExpand) {
int newRightPadding = titleExpand ? AndroidUtilities.dp(10) : 0;
if (titleTextView.getPaddingRight() != newRightPadding) {
@ -315,6 +323,10 @@ public class ChatAvatarContainer extends FrameLayout implements NotificationCent
}
public void openProfile(boolean byAvatar) {
openProfile(byAvatar, true);
}
public void openProfile(boolean byAvatar, boolean fromChatAnimation) {
if (byAvatar && (AndroidUtilities.isTablet() || AndroidUtilities.displaySize.x > AndroidUtilities.displaySize.y || !avatarImageView.getImageReceiver().hasNotThumb())) {
byAvatar = false;
}
@ -348,7 +360,9 @@ public class ChatAvatarContainer extends FrameLayout implements NotificationCent
args.putInt("actionBarColor", getThemedColor(Theme.key_actionBarDefault));
ProfileActivity fragment = new ProfileActivity(args, sharedMediaPreloader);
fragment.setUserInfo(parentFragment.getCurrentUserInfo());
fragment.setPlayProfileAnimation(byAvatar ? 2 : 1);
if (fromChatAnimation) {
fragment.setPlayProfileAnimation(byAvatar ? 2 : 1);
}
parentFragment.presentFragment(fragment);
}
} else if (chat != null) {
@ -359,7 +373,9 @@ public class ChatAvatarContainer extends FrameLayout implements NotificationCent
}
ProfileActivity fragment = new ProfileActivity(args, sharedMediaPreloader);
fragment.setChatInfo(parentFragment.getCurrentChatInfo());
fragment.setPlayProfileAnimation(byAvatar ? 2 : 1);
if (fromChatAnimation) {
fragment.setPlayProfileAnimation(byAvatar ? 2 : 1);
}
parentFragment.presentFragment(fragment);
}
}

View File

@ -739,6 +739,9 @@ public class CropView extends FrameLayout implements CropAreaView.AreaViewListen
}
public void maximize(boolean animated) {
if (state == null) {
return;
}
final float toScale = state.minimumScale;
areaView.resetAnimator();
float aspectRatio;

View File

@ -533,7 +533,7 @@ public class EditTextCaption extends EditTextBoldCursor {
try {
String html = clipData.getItemAt(0).getHtmlText();
Spannable pasted = CopyUtilities.fromHTML(html);
Emoji.replaceEmoji(pasted, getPaint().getFontMetricsInt(), AndroidUtilities.dp(20), false, null, true);
Emoji.replaceEmoji(pasted, getPaint().getFontMetricsInt(), AndroidUtilities.dp(20), false, null);
AnimatedEmojiSpan[] spans = pasted.getSpans(0, pasted.length(), AnimatedEmojiSpan.class);
if (spans != null) {
for (int k = 0; k < spans.length; ++k) {

View File

@ -335,6 +335,10 @@ public class EmojiTabsStrip extends ScrollableHorizontalScrollView {
}
protected boolean allowEmojisForNonPremium() {
return false;
}
boolean first = true;
private ValueAnimator appearAnimation;
private int appearCount;
@ -359,7 +363,7 @@ public class EmojiTabsStrip extends ScrollableHorizontalScrollView {
appearAnimation = null;
}
appearCount = emojiPacks.size();
final boolean isPremium = UserConfig.getInstance(UserConfig.selectedAccount).isPremium();
final boolean isPremium = UserConfig.getInstance(UserConfig.selectedAccount).isPremium() || allowEmojisForNonPremium();
for (int i = 0; i < emojipackTabs.size(); ++i) {
EmojiTabButton emojipackTab = emojipackTabs.get(i);
EmojiView.EmojiPack pack = null;

View File

@ -242,6 +242,12 @@ public class EmojiView extends FrameLayout implements NotificationCenter.Notific
}
}
private boolean allowEmojisForNonPremium;
public void allowEmojisForNonPremium(boolean allow) {
allowEmojisForNonPremium = allow;
}
@IntDef({Type.STICKERS, Type.EMOJIS, Type.GIFS})
@Retention(RetentionPolicy.SOURCE)
private @interface Type {
@ -971,7 +977,7 @@ public class EmojiView extends FrameLayout implements NotificationCenter.Notific
if (emoticon == null && document != null) {
emoticon = MessageObject.findAnimatedEmojiEmoticon(document);
}
if (!MessageObject.isFreeEmoji(document) && !UserConfig.getInstance(currentAccount).isPremium() && !(delegate != null && delegate.isUserSelf())) {
if (!MessageObject.isFreeEmoji(document) && !UserConfig.getInstance(currentAccount).isPremium() && !(delegate != null && delegate.isUserSelf()) && !allowEmojisForNonPremium) {
showBottomTab(false, true);
BulletinFactory factory = fragment != null ? BulletinFactory.of(fragment) : BulletinFactory.of(bulletinContainer, resourcesProvider);
if (premiumBulletin || fragment == null) {
@ -1607,6 +1613,11 @@ public class EmojiView extends FrameLayout implements NotificationCenter.Notific
return pack.installed || installedEmojiSets.contains(pack.set.id);
}
@Override
protected boolean allowEmojisForNonPremium() {
return allowEmojisForNonPremium;
}
@Override
public void setTranslationY(float translationY) {
super.setTranslationY(translationY);
@ -3055,7 +3066,7 @@ public class EmojiView extends FrameLayout implements NotificationCenter.Notific
}
clipBottom += AndroidUtilities.dp(6);
float lockT = premiumT.set(UserConfig.getInstance(currentAccount).isPremium() ? 0f : 1f); // CubicBezierInterpolator.EASE_OUT_QUINT.getInterpolation(Math.min(now - appearTime, 550) / 550f);
float lockT = premiumT.set(UserConfig.getInstance(currentAccount).isPremium() || allowEmojisForNonPremium ? 0f : 1f); // CubicBezierInterpolator.EASE_OUT_QUINT.getInterpolation(Math.min(now - appearTime, 550) / 550f);
int positionInGroup = childPosition - start;
float top;
@ -3623,7 +3634,7 @@ public class EmojiView extends FrameLayout implements NotificationCenter.Notific
}
int state = BUTTON_STATE_EMPTY;
boolean installed = pack.installed || installedEmojiSets.contains(pack.set.id);
if (!pack.free && !UserConfig.getInstance(currentAccount).isPremium()) {
if (!pack.free && !UserConfig.getInstance(currentAccount).isPremium() && !allowEmojisForNonPremium) {
state = BUTTON_STATE_LOCKED;
} else if (pack.featured) {
if (installed) {
@ -3749,7 +3760,7 @@ public class EmojiView extends FrameLayout implements NotificationCenter.Notific
outRect.left = AndroidUtilities.dp(5);
outRect.right = AndroidUtilities.dp(5);
int position = parent.getChildAdapterPosition(view);
if (position + 1 > emojiAdapter.plainEmojisCount && !UserConfig.getInstance(currentAccount).isPremium()) {
if (position + 1 > emojiAdapter.plainEmojisCount && !UserConfig.getInstance(currentAccount).isPremium() && !allowEmojisForNonPremium) {
outRect.top = AndroidUtilities.dp(10);
}
} else if (view instanceof RecyclerListView || view instanceof EmojiPackHeader) {
@ -5776,14 +5787,15 @@ public class EmojiView extends FrameLayout implements NotificationCenter.Notific
if (imageLocation == null) {
return;
}
String filter = SharedConfig.getLiteMode().enabled() ? "30_30_firstframe" : "30_30";
if (object instanceof TLRPC.Document && (MessageObject.isAnimatedStickerDocument(document, true) || MessageObject.isVideoSticker(document))) {
if (svgThumb != null) {
imageView.setImage(ImageLocation.getForDocument(document), "30_30", svgThumb, 0, set);
imageView.setImage(ImageLocation.getForDocument(document), filter, svgThumb, 0, set);
} else {
imageView.setImage(ImageLocation.getForDocument(document), "30_30", imageLocation, null, 0, set);
imageView.setImage(ImageLocation.getForDocument(document), filter, imageLocation, null, 0, set);
}
} else if (imageLocation.imageType == FileLoader.IMAGE_TYPE_LOTTIE) {
imageView.setImage(imageLocation, "30_30", "tgs", svgThumb, set);
imageView.setImage(imageLocation, filter, "tgs", svgThumb, set);
} else {
imageView.setImage(imageLocation, null, "webp", svgThumb, set);
}
@ -6571,7 +6583,7 @@ public class EmojiView extends FrameLayout implements NotificationCenter.Notific
frozenEmojiPacks = new ArrayList<>(mediaDataController.getStickerSets(MediaDataController.TYPE_EMOJIPACKS));
}
ArrayList<TLRPC.TL_messages_stickerSet> installedEmojipacks = frozenEmojiPacks;
boolean isPremium = UserConfig.getInstance(currentAccount).isPremium();
boolean isPremium = UserConfig.getInstance(currentAccount).isPremium() || allowEmojisForNonPremium;
int index = 0;
if (!isPremium) {
for (int i = 0; i < installedEmojipacks.size(); ++i) {
@ -6690,7 +6702,7 @@ public class EmojiView extends FrameLayout implements NotificationCenter.Notific
int start = packStartPosition.get(index);
expandedEmojiSets.add(pack.set.id);
boolean isPremium = UserConfig.getInstance(currentAccount).isPremium();
boolean isPremium = UserConfig.getInstance(currentAccount).isPremium() || allowEmojisForNonPremium;
int maxlen = emojiLayoutManager.getSpanCount() * 3;
int fromCount = ((pack.installed && !pack.featured) && (pack.free || isPremium) || pack.expanded ? pack.documents.size() : Math.min(maxlen, pack.documents.size()));
Integer from = null, count = null;
@ -6771,7 +6783,7 @@ public class EmojiView extends FrameLayout implements NotificationCenter.Notific
}
}
boolean isPremium = UserConfig.getInstance(currentAccount).isPremium();
boolean isPremium = UserConfig.getInstance(currentAccount).isPremium() || allowEmojisForNonPremium;
int maxlen = emojiLayoutManager.getSpanCount() * 3;
plainEmojisCount = itemCount;
firstTrendingRow = -1;

View File

@ -7,6 +7,7 @@ import android.view.View;
import org.telegram.messenger.VideoEditedInfo;
import org.telegram.tgnet.TLRPC;
import org.telegram.ui.Components.Paint.RenderView;
import org.telegram.ui.PhotoViewer;
import java.util.ArrayList;
@ -39,6 +40,7 @@ public interface IPhotoPaintView {
void setOnDoneButtonClickedListener(Runnable callback);
void onBackPressed();
int getEmojiPadding(boolean panned);
RenderView getRenderView();
void updateZoom(boolean zoomedOut);

View File

@ -123,7 +123,7 @@ public class NestedSizeNotifierLayout extends SizeNotifierFrameLayout implements
public void setChildLayout(ChildLayout childLayout) {
if (this.childLayout != childLayout) {
this.childLayout = childLayout;
if (attached) {
if (attached && childLayout != null && childLayout.getListView() != null) {
childLayout.getListView().addOnLayoutChangeListener(this);
}
updateMaxTop();

View File

@ -126,6 +126,9 @@ public class EntityView extends FrameLayout {
}
private boolean onTouchMove(float x, float y) {
if (getParent() == null) {
return false;
}
float scale = ((View) getParent()).getScaleX();
float tx = (x - previousLocationX) / scale;
float ty = (y - previousLocationY) / scale;

View File

@ -1810,6 +1810,11 @@ public class LPhotoPaintView extends SizeNotifierFrameLayoutPhoto implements IPh
return AndroidUtilities.dp(24);
}
@Override
public RenderView getRenderView() {
return renderView;
}
@Override
public void setTransform(float scale, float trX, float trY, float imageWidth, float imageHeight) {
this.scale = scale;
@ -2016,7 +2021,7 @@ public class LPhotoPaintView extends SizeNotifierFrameLayoutPhoto implements IPh
.setStiffness(1250f)
.setDampingRatio(SpringForce.DAMPING_RATIO_NO_BOUNCY));
boolean moveBottomLayout = keyboardVisible || emojiViewVisible;
boolean[] moveBottomLayout = new boolean[] { keyboardVisible || emojiViewVisible };
float bottomLayoutTranslationY = bottomLayout.getTranslationY();
View barView = getBarView();
@ -2035,7 +2040,10 @@ public class LPhotoPaintView extends SizeNotifierFrameLayoutPhoto implements IPh
cancelButton.setProgress(toolsTransformProgress);
tabsLayout.setTranslationY(AndroidUtilities.dp(32) * toolsTransformProgress);
if (moveBottomLayout) {
if (adjustPanLayoutHelper.animationInProgress()) {
moveBottomLayout[0] = false;
}
if (moveBottomLayout[0]) {
float progress = show ? toolsTransformProgress : 1f - toolsTransformProgress;
bottomLayout.setTranslationY(bottomLayoutTranslationY - AndroidUtilities.dp(40) * progress * (show ? 1 : -1));
}
@ -3121,6 +3129,7 @@ public class LPhotoPaintView extends SizeNotifierFrameLayoutPhoto implements IPh
return;
}
emojiView = new EmojiView(null, true, false, false, getContext(), false, null, null, resourcesProvider);
emojiView.allowEmojisForNonPremium(true);
emojiView.setVisibility(GONE);
if (AndroidUtilities.isTablet()) {
emojiView.setForseMultiwindowLayout(true);

View File

@ -1381,6 +1381,11 @@ public class PhotoPaintView extends FrameLayout implements IPhotoPaintView, Enti
return 0;
}
@Override
public RenderView getRenderView() {
return renderView;
}
private LinearLayout buttonForBrush(final int brush, int icon, String text, boolean selected) {
LinearLayout button = new LinearLayout(getContext()) {
@Override

View File

@ -46,6 +46,7 @@ import org.telegram.messenger.FileLoader;
import org.telegram.messenger.ImageLocation;
import org.telegram.messenger.MessageObject;
import org.telegram.messenger.R;
import org.telegram.messenger.SharedConfig;
import org.telegram.messenger.SvgHelper;
import org.telegram.tgnet.TLObject;
import org.telegram.tgnet.TLRPC;
@ -650,7 +651,7 @@ public class ScrollSlidingTabStrip extends HorizontalScrollView {
thumbDrawable = (Drawable) thumb;
}
if (sticker instanceof TLRPC.Document) {
tabView.imageView.setImage(ImageLocation.getForDocument((TLRPC.Document) sticker), "36_36_nolimit", (Drawable) null, null);
tabView.imageView.setImage(ImageLocation.getForDocument((TLRPC.Document) sticker), SharedConfig.getLiteMode().enabled() ? "36_36_firstframe" : "36_36_nolimit", (Drawable) null, null);
} else {
tabView.imageView.setImageDrawable(thumbDrawable);
}
@ -687,22 +688,26 @@ public class ScrollSlidingTabStrip extends HorizontalScrollView {
tabView.inited = true;
SvgHelper.SvgDrawable svgThumb = tabView.svgThumb;
BackupImageView imageView = tabView.imageView;
if (MessageObject.isVideoSticker(sticker)) {
if (svgThumb != null) {
imageView.setImage(ImageLocation.getForDocument(sticker), "40_40", svgThumb, 0, parentObject);
String imageFilter = SharedConfig.getLiteMode().enabled() ? "40_40_firstframe" : "40_40";
if (MessageObject.isVideoSticker(sticker) && sticker.thumbs != null && sticker.thumbs.size() > 0) {
if (SharedConfig.getLiteMode().enabled()) {
TLRPC.PhotoSize thumb = FileLoader.getClosestPhotoSizeWithSize(sticker.thumbs, 90);
imageView.setImage(ImageLocation.getForDocument(thumb, sticker), "40_40", svgThumb, 0, parentObject);
} else if (svgThumb != null) {
imageView.setImage(ImageLocation.getForDocument(sticker), imageFilter, svgThumb, 0, parentObject);
} else {
imageView.setImage(ImageLocation.getForDocument(sticker), "40_40", imageLocation, null, 0, parentObject);
imageView.setImage(ImageLocation.getForDocument(sticker), imageFilter, imageLocation, null, 0, parentObject);
}
} else if (MessageObject.isAnimatedStickerDocument(sticker, true)) {
if (svgThumb != null) {
imageView.setImage(ImageLocation.getForDocument(sticker), "40_40", svgThumb, 0, parentObject);
imageView.setImage(ImageLocation.getForDocument(sticker), imageFilter, svgThumb, 0, parentObject);
} else {
imageView.setImage(ImageLocation.getForDocument(sticker), "40_40", imageLocation, null, 0, parentObject);
imageView.setImage(ImageLocation.getForDocument(sticker), imageFilter, imageLocation, null, 0, parentObject);
}
} else if (imageLocation.imageType == FileLoader.IMAGE_TYPE_LOTTIE) {
imageView.setImage(imageLocation, "40_40", "tgs", svgThumb, parentObject);
imageView.setImage(imageLocation, imageFilter, "tgs", svgThumb, parentObject);
} else {
imageView.setImage(imageLocation, null, "webp", svgThumb, parentObject);
imageView.setImage(imageLocation, imageFilter, "webp", svgThumb, parentObject);
}
String title = null;
if (parentObject instanceof TLRPC.TL_messages_stickerSet) {

View File

@ -450,7 +450,7 @@ public class ContactAddActivity extends BaseFragment implements NotificationCent
LocaleController.formatString("ResetToOriginalPhotoMessage", R.string.ResetToOriginalPhotoMessage, user.first_name),
LocaleController.getString("Reset", R.string.Reset), () -> {
avatar = null;
sendPhotoChangedRequest(null, null, null, 0, TYPE_SET);
sendPhotoChangedRequest(null, null,null, null, 0, TYPE_SET);
TLRPC.User user1 = getMessagesController().getUser(user_id);
user1.photo.personal = false;
@ -701,7 +701,7 @@ public class ContactAddActivity extends BaseFragment implements NotificationCent
getNotificationCenter().postNotificationName(NotificationCenter.reloadDialogPhotos);
getNotificationCenter().postNotificationName(NotificationCenter.updateInterfaces, MessagesController.UPDATE_MASK_AVATAR);
}
sendPhotoChangedRequest(avatar, photo, video, videoStartTimestamp, photoSelectedTypeFinal);
sendPhotoChangedRequest(avatar, bigSize.location, photo, video, videoStartTimestamp, photoSelectedTypeFinal);
showAvatarProgress(false, true);
} else {
avatarImage.setImage(ImageLocation.getForLocal(avatar), "50_50", avatarDrawable, getMessagesController().getUser(user_id));
@ -761,7 +761,7 @@ public class ContactAddActivity extends BaseFragment implements NotificationCent
getMessagesController().photoSuggestion.put(message.local_id, imageUpdater);
}
private void sendPhotoChangedRequest(TLRPC.FileLocation avatar, TLRPC.InputFile photo, TLRPC.InputFile video, double videoStartTimestamp, int photoSelectedTypeFinal) {
private void sendPhotoChangedRequest(TLRPC.FileLocation avatar, TLRPC.FileLocation bigAvatar, TLRPC.InputFile photo, TLRPC.InputFile video, double videoStartTimestamp, int photoSelectedTypeFinal) {
TLRPC.TL_photos_uploadContactProfilePhoto req = new TLRPC.TL_photos_uploadContactProfilePhoto();
req.user_id = getMessagesController().getInputUser(user_id);
@ -812,9 +812,9 @@ public class ContactAddActivity extends BaseFragment implements NotificationCent
ImageLoader.getInstance().replaceImageInCache(oldKey, newKey, ImageLocation.getForUser(user, ImageLocation.TYPE_SMALL), false);
}
if (bigSize2 != null && avatar != null) {
if (bigSize2 != null && bigAvatar != null) {
File destFile = FileLoader.getInstance(currentAccount).getPathToAttach(bigSize2, true);
File src = FileLoader.getInstance(currentAccount).getPathToAttach(avatar, true);
File src = FileLoader.getInstance(currentAccount).getPathToAttach(bigAvatar, true);
src.renameTo(destFile);
}
PhotoUtilities.applyPhotoToUser(photo2.photo, user, true);

View File

@ -4274,6 +4274,9 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
int finalSelectedIndex = selectedIndex;
AndroidUtilities.runOnUIThread(() -> {
if (frozenDialogsList != null) {
if (finalSelectedIndex < 0 || finalSelectedIndex >= frozenDialogsList.size()) {
return;
}
frozenDialogsList.add(finalSelectedIndex, dialog);
viewPages[0].updateList(true);
}
@ -4481,9 +4484,11 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
if (menuDrawable != null && hasFragment()) {
menuDrawable.setRotation(progress, false);
}
actionBar.getTitleTextView().setAlpha(1f - progress);
if (actionBar.getTitleTextView().getAlpha() > 0) {
actionBar.getTitleTextView().setVisibility(View.VISIBLE);
if (actionBar.getTitleTextView() != null) {
actionBar.getTitleTextView().setAlpha(1f - progress);
if (actionBar.getTitleTextView().getAlpha() > 0) {
actionBar.getTitleTextView().setVisibility(View.VISIBLE);
}
}
if (proxyItem != null) {
proxyItem.setAlpha(1f - progress);
@ -6244,6 +6249,9 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
} else if (obj instanceof ContactsController.Contact) {
ContactsController.Contact contact = (ContactsController.Contact) obj;
AlertsCreator.createContactInviteDialog(DialogsActivity.this, contact.first_name, contact.last_name, contact.phones.get(0));
} else if (obj instanceof TLRPC.TL_forumTopic && rightSlidingDialogContainer != null && rightSlidingDialogContainer.getFragment() instanceof TopicsFragment) {
dialogId = ((TopicsFragment) rightSlidingDialogContainer.getFragment()).getDialogId();
topicId = ((TLRPC.TL_forumTopic) obj).id;
}
if (dialogId != 0 && actionBar.isActionModeShowed()) {

View File

@ -133,15 +133,16 @@ public class KeepMediaPopupView extends ActionBarPopupWindow.ActionBarPopupWindo
for (int i = 0; i < checkItems.size(); i++) {
int keepMedia = checkItems.get(i).type;
checkItems.get(i).item.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
window.dismiss();
if (currentType >= 0) {
cacheByChatsController.setKeepMedia(currentType, keepMedia);
if (callback != null) {
callback.onKeepMediaChange(currentType, keepMedia);
}
checkItems.get(i).item.setOnClickListener(v -> {
window.dismiss();
if (currentType >= 0) {
cacheByChatsController.setKeepMedia(currentType, keepMedia);
if (callback != null) {
callback.onKeepMediaChange(currentType, keepMedia);
}
} else {
if (callback != null) {
callback.onKeepMediaChange(currentType, keepMedia);
}
}
});

View File

@ -168,6 +168,7 @@ import java.util.concurrent.atomic.AtomicReference;
@SuppressLint("HardwareIds")
public class LoginActivity extends BaseFragment {
public final static boolean ENABLE_PASTED_TEXT_PROCESSING = false;
private final static int SHOW_DELAY = SharedConfig.getDevicePerformanceClass() <= SharedConfig.PERFORMANCE_CLASS_AVERAGE ? 150 : 100;
public final static int AUTH_TYPE_MESSAGE = 1,
@ -876,6 +877,8 @@ public class LoginActivity extends BaseFragment {
bundle.putString(key, (String) value);
} else if (value instanceof Integer) {
bundle.putInt(key, (Integer) value);
} else if (value instanceof Boolean) {
bundle.putBoolean(key, (Boolean) value);
}
} else if (args.length == 2) {
Bundle inner = bundle.getBundle(args[0]);
@ -887,6 +890,8 @@ public class LoginActivity extends BaseFragment {
inner.putString(args[1], (String) value);
} else if (value instanceof Integer) {
inner.putInt(args[1], (Integer) value);
} else if (value instanceof Boolean) {
inner.putBoolean(args[1], (Boolean) value);
}
}
}
@ -920,6 +925,12 @@ public class LoginActivity extends BaseFragment {
} else {
editor.putInt(key, (Integer) obj);
}
} else if (obj instanceof Boolean) {
if (prefix != null) {
editor.putBoolean(prefix + "_|_" + key, (Boolean) obj);
} else {
editor.putBoolean(key, (Boolean) obj);
}
} else if (obj instanceof Bundle) {
putBundleToEditor((Bundle) obj, editor, key);
}
@ -1994,7 +2005,7 @@ public class LoginActivity extends BaseFragment {
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
if (ignoreOnPhoneChange || ignoreOnPhoneChangePaste) {
if (!ENABLE_PASTED_TEXT_PROCESSING || ignoreOnPhoneChange || ignoreOnPhoneChangePaste) {
return;
}

View File

@ -423,7 +423,7 @@ public class NewContactBottomSheet extends BottomSheet implements AdapterView.On
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
if (ignoreOnPhoneChange || ignoreOnPhoneChangePaste) {
if (!LoginActivity.ENABLE_PASTED_TEXT_PROCESSING || ignoreOnPhoneChange || ignoreOnPhoneChangePaste) {
return;
}

View File

@ -12747,7 +12747,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
}
SecureDocument location = secureDocuments.get(index);
f1 = FileLoader.getInstance(currentAccount).getPathToAttach(location, true);
f1 = FileLoader.getInstance(currentAccount).getPathToAttach(location, false);
f2 = FileLoader.getInstance(currentAccount).getPathToAttach(location, false);
} else if (currentPathObject != null) {
f1 = new File(FileLoader.getDirectory(FileLoader.MEDIA_DIR_DOCUMENT), currentFileNames[a]);
f2 = new File(FileLoader.getDirectory(FileLoader.MEDIA_DIR_CACHE), currentFileNames[a]);
@ -15865,7 +15865,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
}
}
if (currentEditMode == EDIT_MODE_PAINT) {
photoPaintView.setTransform(currentScale, currentTranslationX, currentTranslationY, bitmapWidth * scaleToFitX, bitmapHeight * scaleToFitX);
photoPaintView.setTransform(currentScale, currentTranslationX, currentTranslationY + (sendPhotoType == SELECT_TYPE_AVATAR ? AndroidUtilities.statusBarHeight / 2f : 0) * photoPaintView.getRenderView().getScaleX(), bitmapWidth * scaleToFitX, bitmapHeight * scaleToFitX);
}
if (drawCenterImage) {

View File

@ -513,6 +513,9 @@ public class PremiumPreviewFragment extends BaseFragment implements Notification
// bottomSheet.setParentFragment(PremiumPreviewFragment.this);
// showDialog(bottomSheet);
// } else {
if (subscriptionTiers.isEmpty()) {
return;
}
showDialog(new PremiumFeatureBottomSheet(PremiumPreviewFragment.this, cell.data.type, false, subscriptionTiers.get(selectedTierIndex)));
// }
}
@ -715,7 +718,7 @@ public class PremiumPreviewFragment extends BaseFragment implements Notification
if (response instanceof TLRPC.Updates) {
fragment.getMessagesController().processUpdates((TLRPC.Updates) response, false);
onSuccess.run();
AndroidUtilities.runOnUIThread(onSuccess);
} else if (error != null) {
AndroidUtilities.runOnUIThread(() -> AlertsCreator.processError(fragment.getCurrentAccount(), error, fragment, req));
}

View File

@ -52,7 +52,6 @@ import android.text.TextPaint;
import android.text.TextUtils;
import android.text.style.ClickableSpan;
import android.text.style.ForegroundColorSpan;
import android.util.Log;
import android.util.Property;
import android.util.SparseIntArray;
import android.util.TypedValue;
@ -2146,11 +2145,11 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
builder.setPositiveButton(LocaleController.getString("Delete", R.string.Delete), (dialogInterface, i) -> {
int position = avatarsViewPager.getRealPosition();
TLRPC.Photo photo = avatarsViewPager.getPhoto(position);
if (hasFallbackPhoto && getUserInfo() != null && getUserInfo().fallback_photo != null && getUserInfo().fallback_photo.id == photo.id) {
getUserInfo().fallback_photo = null;
getUserInfo().flags &= ~4194304;
getUserInfo().fallback_photo = null;
getMessagesStorage().updateUserInfo(getUserInfo(), true);
TLRPC.UserFull userFull = getUserInfo();
if (hasFallbackPhoto && userFull != null && userFull.fallback_photo != null && userFull.fallback_photo.id == photo.id) {
userFull.fallback_photo = null;
userFull.flags &= ~4194304;
getMessagesStorage().updateUserInfo(userFull, true);
updateProfileData(false);
}
if (avatarsViewPager.getRealCount() == 1) {
@ -2360,6 +2359,9 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
listView.setBottomGlowOffset(0);
}
initialAnimationExtraHeight = paddingTop - actionBarHeight;
if (playProfileAnimation == 0) {
extraHeight = initialAnimationExtraHeight;
}
layoutManager.scrollToPositionWithOffset(0, -actionBarHeight);
listView.setPadding(0, paddingTop, 0, paddingBottom);
measureChildWithMargins(listView, widthMeasureSpec, 0, heightMeasureSpec, 0);
@ -8766,7 +8768,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
if (user != null && !TextUtils.isEmpty(vcardPhone)) {
text = PhoneFormat.getInstance().format("+" + vcardPhone);
phoneNumber = vcardPhone;
} else if (!TextUtils.isEmpty(user.phone)) {
} else if (user != null && !TextUtils.isEmpty(user.phone)) {
text = PhoneFormat.getInstance().format("+" + user.phone);
phoneNumber = user.phone;
} else {
@ -10427,9 +10429,9 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
float photoDescriptionProgress = -1;
private void checkPhotoDescriptionAlpha() {
float p = photoDescriptionProgress;
if (playProfileAnimation == 1 && openAnimationInProgress) {
if (playProfileAnimation == 1 && (!fragmentOpened || openAnimationInProgress)) {
photoDescriptionProgress = 0;
} else if (playProfileAnimation == 2 && openAnimationInProgress) {
} else if (playProfileAnimation == 2 && (!fragmentOpened || openAnimationInProgress)) {
photoDescriptionProgress = onlineTextView[1].getAlpha();
} else {
if (userId == UserConfig.getInstance(currentAccount).clientUserId) {

View File

@ -91,6 +91,7 @@ public class ProxyListActivity extends BaseFragment implements NotificationCente
private int proxyDetailRow;
private int callsRow;
private int callsDetailRow;
private int deleteAllRow;
private ItemTouchHelper itemTouchHelper;
private NumberTextView selectedCountTextView;
@ -478,6 +479,33 @@ public class ProxyListActivity extends BaseFragment implements NotificationCente
ConnectionsManager.setProxySettings(useProxySettings, SharedConfig.currentProxy.address, SharedConfig.currentProxy.port, SharedConfig.currentProxy.username, SharedConfig.currentProxy.password, SharedConfig.currentProxy.secret);
} else if (position == proxyAddRow) {
presentFragment(new ProxySettingsActivity());
} else if (position == deleteAllRow) {
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
builder.setMessage(LocaleController.getString(R.string.DeleteAllProxiesConfirm));
builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
builder.setTitle(LocaleController.getString(R.string.DeleteProxyTitle));
builder.setPositiveButton(LocaleController.getString(R.string.Delete), (dialog, which) -> {
for (SharedConfig.ProxyInfo info : proxyList) {
SharedConfig.deleteProxy(info);
}
useProxyForCalls = false;
useProxySettings = false;
NotificationCenter.getGlobalInstance().removeObserver(ProxyListActivity.this, NotificationCenter.proxySettingsChanged);
NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.proxySettingsChanged);
NotificationCenter.getGlobalInstance().addObserver(ProxyListActivity.this, NotificationCenter.proxySettingsChanged);
updateRows(true);
if (listAdapter != null) {
listAdapter.notifyItemChanged(useProxyRow, ListAdapter.PAYLOAD_CHECKED_CHANGED);
listAdapter.notifyItemChanged(callsRow, ListAdapter.PAYLOAD_CHECKED_CHANGED);
listAdapter.clearSelected();
}
});
AlertDialog dialog = builder.create();
showDialog(dialog);
TextView button = (TextView) dialog.getButton(DialogInterface.BUTTON_POSITIVE);
if (button != null) {
button.setTextColor(Theme.getColor(Theme.key_dialogTextRed2));
}
}
});
listView.setOnItemLongClickListener((view, position) -> {
@ -643,6 +671,11 @@ public class ProxyListActivity extends BaseFragment implements NotificationCente
listAdapter.notifyItemRangeRemoved(proxyDetailRow + 1, 2);
}
}
if (proxyList.size() >= 10) {
deleteAllRow = rowCount++;
} else {
deleteAllRow = -1;
}
checkProxyList();
if (notify && listAdapter != null) {
listAdapter.notifyDataSetChanged();
@ -807,7 +840,10 @@ public class ProxyListActivity extends BaseFragment implements NotificationCente
TextSettingsCell textCell = (TextSettingsCell) holder.itemView;
textCell.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
if (position == proxyAddRow) {
textCell.setText(LocaleController.getString("AddProxy", R.string.AddProxy), false);
textCell.setText(LocaleController.getString("AddProxy", R.string.AddProxy), deleteAllRow != -1);
} else if (position == deleteAllRow) {
textCell.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteRedText4));
textCell.setText(LocaleController.getString(R.string.DeleteAllProxies), false);
}
break;
}
@ -887,7 +923,7 @@ public class ProxyListActivity extends BaseFragment implements NotificationCente
@Override
public boolean isEnabled(RecyclerView.ViewHolder holder) {
int position = holder.getAdapterPosition();
return position == useProxyRow || position == callsRow || position == proxyAddRow || position >= proxyStartRow && position < proxyEndRow;
return position == useProxyRow || position == callsRow || position == proxyAddRow || position == deleteAllRow || position >= proxyStartRow && position < proxyEndRow;
}
@Override
@ -925,6 +961,7 @@ public class ProxyListActivity extends BaseFragment implements NotificationCente
@Override
public long getItemId(int position) {
// Random stable ids, could be anything non-repeating
if (position == useProxyDetailRow) {
return -1;
} else if (position == proxyDetailRow) {
@ -937,6 +974,8 @@ public class ProxyListActivity extends BaseFragment implements NotificationCente
return -5;
} else if (position == connectionsHeaderRow) {
return -6;
} else if (position == deleteAllRow) {
return -8;
} else if (position >= proxyStartRow && position < proxyEndRow) {
return proxyList.get(position - proxyStartRow).hashCode();
} else {
@ -948,7 +987,7 @@ public class ProxyListActivity extends BaseFragment implements NotificationCente
public int getItemViewType(int position) {
if (position == useProxyDetailRow || position == proxyDetailRow) {
return 0;
} else if (position == proxyAddRow) {
} else if (position == proxyAddRow || position == deleteAllRow) {
return 1;
} else if (position == useProxyRow || position == callsRow) {
return 3;

View File

@ -10,6 +10,7 @@ import android.graphics.Color;
import android.graphics.LinearGradient;
import android.graphics.Matrix;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffXfermode;
import android.graphics.Shader;
@ -415,6 +416,9 @@ public class TextMessageEnterTransition implements MessageEnterTransitionContain
float lastMessageX;
float lastMessageY;
private Path replyRoundRect;
private float[] roundRectRadii;
public void onDraw(Canvas canvas) {
if (drawBitmaps && !initBitmaps && crossfadeTextBitmap != null && messageView.getTransitionParams().wasDraw) {
initBitmaps = true;
@ -565,8 +569,20 @@ public class TextMessageEnterTransition implements MessageEnterTransitionContain
float replyX = fromReplayX * (1f - progressX) + toReplayX * progressX;
float replyY = (fromReplayY + AndroidUtilities.dp(12) * progress) * (1f - progress) + toReplayY * progress;
if (replyRoundRect == null) {
replyRoundRect = new Path();
} else {
replyRoundRect.rewind();
}
if (roundRectRadii == null) {
roundRectRadii = new float[8];
roundRectRadii[0] = roundRectRadii[1] = roundRectRadii[6] = roundRectRadii[7] = AndroidUtilities.dp(2); // left
roundRectRadii[2] = roundRectRadii[3] = roundRectRadii[4] = roundRectRadii[5] = AndroidUtilities.dp(1); // right
}
AndroidUtilities.rectTmp.set(replyX, replyY, replyX + AndroidUtilities.dp(3), replyY + AndroidUtilities.lerp(AndroidUtilities.dp(35), messageView.replyHeight, progressX));
replyRoundRect.addRoundRect(AndroidUtilities.rectTmp, roundRectRadii, Path.Direction.CW);
Theme.chat_replyLinePaint.setColor(ColorUtils.setAlphaComponent(replyLineColor, (int) (Color.alpha(replyLineColor) * progressX)));
canvas.drawRect(replyX, replyY, replyX + AndroidUtilities.dp(2), replyY + AndroidUtilities.lerp(AndroidUtilities.dp(35), messageView.replyHeight, progressX), Theme.chat_replyLinePaint);
canvas.drawPath(replyRoundRect, Theme.chat_replyLinePaint);
canvas.save();
canvas.translate(offset * progressX, 0);

View File

@ -6046,4 +6046,7 @@
<string name="LightMode">Lite Mode (Beta)</string>
<string name="EnableLightMode">Enable lite mode</string>
<string name="LightModeInfoRow">This mode turns off all visual effects in the app. It is recommended only for those devices that are low on CPU and memory.</string>
<string name="DeleteAllProxies">Delete All Proxies</string>
<string name="DeleteAllProxiesConfirm">Are you sure you want to delete all proxies?</string>
<string name="AccDescrSendAs">Send as %1$s</string>
</resources>

View File

@ -13,8 +13,8 @@
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
#Sat Mar 12 05:53:50 MSK 2016
APP_VERSION_NAME=9.3.0
APP_VERSION_CODE=3021
APP_VERSION_NAME=9.3.2
APP_VERSION_CODE=3023
APP_PACKAGE=org.telegram.messenger
RELEASE_KEY_PASSWORD=TelegramAndroidPswd
RELEASE_KEY_ALIAS=tmessages
@ -24,5 +24,5 @@ org.gradle.daemon=true
org.gradle.parallel=true
org.gradle.configureondemand=false
android.useAndroidX=true
android.enableJetif ier=true
android.enableJetifier=true
android.defaults.buildfeatures.buildconfig=true