mirror of https://github.com/NekoX-Dev/NekoX.git
update to 8.9.2
This commit is contained in:
parent
b1aa2020e5
commit
172335d189
|
@ -72,7 +72,7 @@ android {
|
|||
coreLibraryDesugaringEnabled true
|
||||
}
|
||||
|
||||
defaultConfig.versionCode = 2751
|
||||
defaultConfig.versionCode = Integer.parseInt(APP_VERSION_CODE)
|
||||
|
||||
defaultConfig {
|
||||
minSdkVersion 16
|
||||
|
|
|
@ -72,6 +72,10 @@
|
|||
|
||||
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />
|
||||
|
||||
<queries>
|
||||
<package android:name="com.google.android.apps.maps"/>
|
||||
</queries>
|
||||
|
||||
<application
|
||||
android:name="org.telegram.messenger.ApplicationLoader"
|
||||
android:allowBackup="false"
|
||||
|
|
|
@ -160,7 +160,7 @@ public class BillingController implements PurchasesUpdatedListener, BillingClien
|
|||
}
|
||||
|
||||
public void launchBillingFlow(Activity activity, AccountInstance accountInstance, TLRPC.InputStorePaymentPurpose paymentPurpose, List<BillingFlowParams.ProductDetailsParams> productDetails, boolean checkedConsume) {
|
||||
if (!isReady()) {
|
||||
if (!isReady() || activity == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -20,8 +20,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 = 2751;
|
||||
public static String BUILD_VERSION_STRING = "8.9.0";
|
||||
public static int BUILD_VERSION = 2756;
|
||||
public static String BUILD_VERSION_STRING = "8.9.2";
|
||||
public static int APP_ID = 4;
|
||||
public static String APP_HASH = "014b35b6184100b085b0d0572f9b5103";
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@ import android.content.Context;
|
|||
import android.graphics.Bitmap;
|
||||
import android.graphics.Point;
|
||||
import android.location.Location;
|
||||
import android.opengl.GLSurfaceView;
|
||||
import android.os.Bundle;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
|
@ -62,6 +63,9 @@ public interface IMapsProvider {
|
|||
void setOnDispatchTouchEventInterceptor(ITouchInterceptor touchInterceptor);
|
||||
void setOnInterceptTouchEventInterceptor(ITouchInterceptor touchInterceptor);
|
||||
void setOnLayoutListener(Runnable callback);
|
||||
default GLSurfaceView getGlSurfaceView() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
interface IUISettings {
|
||||
|
|
|
@ -18,6 +18,7 @@ import android.graphics.Bitmap;
|
|||
import android.graphics.BitmapFactory;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Matrix;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.drawable.BitmapDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.net.Uri;
|
||||
|
@ -959,6 +960,9 @@ public class ImageLoader {
|
|||
if (cacheImage.filter != null && cacheImage.filter.contains("compress")) {
|
||||
cacheOptions.compressQuality = BitmapsCache.COMPRESS_QUALITY_DEFAULT;
|
||||
}
|
||||
if (cacheImage.filter != null && cacheImage.filter.contains("flbk")) {
|
||||
cacheOptions.fallback = true;
|
||||
}
|
||||
}
|
||||
if (compressed) {
|
||||
lottieDrawable = new RLottieDrawable(cacheImage.finalFilePath, decompressGzip(cacheImage.finalFilePath), w, h, cacheOptions, limitFps, null, fitzModifier);
|
||||
|
@ -1538,7 +1542,9 @@ public class ImageLoader {
|
|||
if (!lastFrame) {
|
||||
canvas.scale(currentBitmap.getWidth() / w, currentBitmap.getHeight() / h, w / 2f, h / 2f);
|
||||
}
|
||||
canvas.drawBitmap(currentBitmap, 0, 0, null);
|
||||
Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
|
||||
paint.setFilterBitmap(true);
|
||||
canvas.drawBitmap(currentBitmap, 0, 0, paint);
|
||||
bitmapDrawable = new BitmapDrawable(bitmap);
|
||||
}
|
||||
onPostExecute(bitmapDrawable);
|
||||
|
@ -2772,7 +2778,7 @@ public class ImageLoader {
|
|||
img.secureDocument = imageLocation.secureDocument;
|
||||
onlyCache = img.secureDocument.secureFile.dc_id == Integer.MIN_VALUE;
|
||||
cacheFile = new File(FileLoader.getDirectory(FileLoader.MEDIA_DIR_CACHE), url);
|
||||
} else if (!(hasAutoplayFilter(filter) || isAnimatedAvatar(filter)) && (cacheType != 0 || size <= 0 || imageLocation.path != null || isEncrypted)) {
|
||||
} else if (!(AUTOPLAY_FILTER.equals(filter) || isAnimatedAvatar(filter)) && (cacheType != 0 || size <= 0 || imageLocation.path != null || isEncrypted)) {
|
||||
cacheFile = new File(FileLoader.getDirectory(FileLoader.MEDIA_DIR_CACHE), url);
|
||||
if (cacheFile.exists()) {
|
||||
cacheFileExists = true;
|
||||
|
@ -2847,7 +2853,9 @@ public class ImageLoader {
|
|||
if (hasAutoplayFilter(filter) || isAnimatedAvatar(filter)) {
|
||||
img.imageType = FileLoader.IMAGE_TYPE_ANIMATION;
|
||||
img.size = fileSize;
|
||||
onlyCache = true;
|
||||
if (AUTOPLAY_FILTER.equals(filter) || isAnimatedAvatar(filter)) {
|
||||
onlyCache = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -635,8 +635,9 @@ public class MediaDataController extends BaseController {
|
|||
if (reactionsList == null) {
|
||||
return;
|
||||
}
|
||||
for (int i = 0; i < reactionsList.size(); i++) {
|
||||
TLRPC.TL_availableReaction reaction = reactionsList.get(i);
|
||||
ArrayList<TLRPC.TL_availableReaction> arrayList = new ArrayList<>(reactionsList);
|
||||
for (int i = 0; i < arrayList.size(); i++) {
|
||||
TLRPC.TL_availableReaction reaction = arrayList.get(i);
|
||||
int size = ReactionsEffectOverlay.sizeForBigReaction();
|
||||
preloadImage(ImageLocation.getForDocument(reaction.effect_animation), size + "_" + size + "_pcache");
|
||||
preloadImage(ImageLocation.getForDocument(reaction.activate_animation), null);
|
||||
|
|
|
@ -5416,7 +5416,8 @@ public class MessageObject {
|
|||
if (document != null) {
|
||||
for (int a = 0; a < document.attributes.size(); a++) {
|
||||
TLRPC.DocumentAttribute attribute = document.attributes.get(a);
|
||||
if (attribute instanceof TLRPC.TL_documentAttributeSticker) {
|
||||
if (attribute instanceof TLRPC.TL_documentAttributeSticker ||
|
||||
attribute instanceof TLRPC.TL_documentAttributeCustomEmoji) {
|
||||
return "video/webm".equals(document.mime_type);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13396,17 +13396,16 @@ public class MessagesController extends BaseController implements NotificationCe
|
|||
if (value == null) {
|
||||
value = getMessagesStorage().getDialogReadMax(false, dialogId);
|
||||
}
|
||||
if (update.max_id > value || update.still_unread_count != 0) {
|
||||
if (markAsReadMessagesInbox == null) {
|
||||
markAsReadMessagesInbox = new LongSparseIntArray();
|
||||
}
|
||||
if (stillUnreadMessagesCount == null) {
|
||||
stillUnreadMessagesCount = new LongSparseIntArray();
|
||||
}
|
||||
markAsReadMessagesInbox.put(dialogId, update.max_id);
|
||||
stillUnreadMessagesCount.put(dialogId, update.still_unread_count);
|
||||
dialogs_read_inbox_max.put(dialogId, Math.max(value, update.max_id));
|
||||
|
||||
if (markAsReadMessagesInbox == null) {
|
||||
markAsReadMessagesInbox = new LongSparseIntArray();
|
||||
}
|
||||
if (stillUnreadMessagesCount == null) {
|
||||
stillUnreadMessagesCount = new LongSparseIntArray();
|
||||
}
|
||||
markAsReadMessagesInbox.put(dialogId, update.max_id);
|
||||
stillUnreadMessagesCount.put(dialogId, update.still_unread_count);
|
||||
dialogs_read_inbox_max.put(dialogId, Math.max(value, update.max_id));
|
||||
} else if (baseUpdate instanceof TLRPC.TL_updateReadChannelOutbox) {
|
||||
TLRPC.TL_updateReadChannelOutbox update = (TLRPC.TL_updateReadChannelOutbox) baseUpdate;
|
||||
if (BuildVars.LOGS_ENABLED) {
|
||||
|
|
|
@ -2213,7 +2213,9 @@ public class MessagesStorage extends BaseController {
|
|||
} catch (Exception e) {
|
||||
FileLog.e(e);
|
||||
} finally {
|
||||
database.commitTransaction();
|
||||
if (database != null) {
|
||||
database.commitTransaction();
|
||||
}
|
||||
if (state5 != null) {
|
||||
state5.dispose();
|
||||
}
|
||||
|
@ -3049,7 +3051,9 @@ public class MessagesStorage extends BaseController {
|
|||
} catch (Exception e) {
|
||||
FileLog.e(e);
|
||||
} finally {
|
||||
database.commitTransaction();
|
||||
if (database != null) {
|
||||
database.commitTransaction();
|
||||
}
|
||||
if (state != null) {
|
||||
state.dispose();
|
||||
}
|
||||
|
@ -3789,7 +3793,9 @@ public class MessagesStorage extends BaseController {
|
|||
} catch (Exception e) {
|
||||
FileLog.e(e);
|
||||
} finally {
|
||||
database.commitTransaction();
|
||||
if (database != null) {
|
||||
database.commitTransaction();
|
||||
}
|
||||
if (state != null) {
|
||||
state.dispose();
|
||||
}
|
||||
|
@ -4357,7 +4363,9 @@ public class MessagesStorage extends BaseController {
|
|||
} catch (Exception e) {
|
||||
FileLog.e(e);
|
||||
} finally {
|
||||
database.commitTransaction();
|
||||
if (database != null) {
|
||||
database.commitTransaction();
|
||||
}
|
||||
if (cursor != null) {
|
||||
cursor.dispose();
|
||||
}
|
||||
|
@ -4641,7 +4649,9 @@ public class MessagesStorage extends BaseController {
|
|||
} catch (Exception e) {
|
||||
FileLog.e(e);
|
||||
} finally {
|
||||
database.commitTransaction();
|
||||
if (database != null) {
|
||||
database.commitTransaction();
|
||||
}
|
||||
if (cursor != null) {
|
||||
cursor.dispose();
|
||||
}
|
||||
|
@ -4680,7 +4690,9 @@ public class MessagesStorage extends BaseController {
|
|||
} catch (Exception e) {
|
||||
FileLog.e(e);
|
||||
} finally {
|
||||
database.commitTransaction();
|
||||
if (database != null) {
|
||||
database.commitTransaction();
|
||||
}
|
||||
if (state != null) {
|
||||
state.dispose();
|
||||
}
|
||||
|
@ -4718,7 +4730,9 @@ public class MessagesStorage extends BaseController {
|
|||
} catch (Exception e) {
|
||||
FileLog.e(e);
|
||||
} finally {
|
||||
database.commitTransaction();
|
||||
if (database != null) {
|
||||
database.commitTransaction();
|
||||
}
|
||||
if (state != null) {
|
||||
state.dispose();
|
||||
}
|
||||
|
@ -4758,7 +4772,9 @@ public class MessagesStorage extends BaseController {
|
|||
} catch (Exception e) {
|
||||
FileLog.e(e);
|
||||
} finally {
|
||||
database.commitTransaction();
|
||||
if (database != null) {
|
||||
database.commitTransaction();
|
||||
}
|
||||
if (state != null) {
|
||||
state.dispose();
|
||||
}
|
||||
|
@ -4794,7 +4810,9 @@ public class MessagesStorage extends BaseController {
|
|||
} catch (Exception e) {
|
||||
FileLog.e(e);
|
||||
} finally {
|
||||
database.commitTransaction();
|
||||
if (database != null) {
|
||||
database.commitTransaction();
|
||||
}
|
||||
if (state != null) {
|
||||
state.dispose();
|
||||
}
|
||||
|
@ -5073,7 +5091,9 @@ public class MessagesStorage extends BaseController {
|
|||
} catch (Exception e) {
|
||||
FileLog.e(e);
|
||||
} finally {
|
||||
database.commitTransaction();
|
||||
if (database != null) {
|
||||
database.commitTransaction();
|
||||
}
|
||||
if (state != null) {
|
||||
state.dispose();
|
||||
}
|
||||
|
@ -5729,24 +5749,32 @@ public class MessagesStorage extends BaseController {
|
|||
}
|
||||
cursor.dispose();
|
||||
} else {
|
||||
if (!isEmpty(stillUnreadMessagesCount)) {
|
||||
for (int b = 0; b < stillUnreadMessagesCount.size(); b++) {
|
||||
long key = stillUnreadMessagesCount.keyAt(b);
|
||||
int unread = stillUnreadMessagesCount.get(key);
|
||||
dialogsToUpdate.put(key, unread);
|
||||
|
||||
}
|
||||
}
|
||||
if (!isEmpty(inbox)) {
|
||||
for (int b = 0; b < inbox.size(); b++) {
|
||||
long key = inbox.keyAt(b);
|
||||
int messageId = inbox.get(key);
|
||||
if (dialogsToUpdate.get(key, -1) < 0) {
|
||||
boolean canCountByMessageId = true;
|
||||
|
||||
if (stillUnreadMessagesCount != null && stillUnreadMessagesCount.get(key, -1) != -1) {
|
||||
SQLiteCursor checkHolesCursor = database.queryFinalized(String.format(Locale.US, "SELECT start, end FROM messages_holes WHERE uid = %d AND end > %d", key, messageId));
|
||||
while (checkHolesCursor.next()) {
|
||||
canCountByMessageId = false;
|
||||
}
|
||||
checkHolesCursor.dispose();
|
||||
}
|
||||
|
||||
if (canCountByMessageId) {
|
||||
SQLiteCursor cursor = database.queryFinalized(String.format(Locale.US, "SELECT COUNT(mid) FROM messages_v2 WHERE uid = %d AND mid > %d AND read_state IN(0,2) AND out = 0", key, messageId));
|
||||
if (cursor.next()) {
|
||||
dialogsToUpdate.put(key, cursor.intValue(0));
|
||||
int unread = cursor.intValue(0);
|
||||
dialogsToUpdate.put(key, unread);
|
||||
}
|
||||
cursor.dispose();
|
||||
} else {
|
||||
int unread = stillUnreadMessagesCount.get(key);
|
||||
if (unread > 0) {
|
||||
dialogsToUpdate.put(key, unread);
|
||||
}
|
||||
}
|
||||
|
||||
SQLitePreparedStatement state = database.executeFast("UPDATE dialogs SET inbox_max = max((SELECT inbox_max FROM dialogs WHERE did = ?), ?) WHERE did = ?");
|
||||
|
@ -5994,7 +6022,9 @@ public class MessagesStorage extends BaseController {
|
|||
} catch (Exception e) {
|
||||
FileLog.e(e);
|
||||
} finally {
|
||||
database.commitTransaction();
|
||||
if (database != null) {
|
||||
database.commitTransaction();
|
||||
}
|
||||
if (state != null) {
|
||||
state.dispose();
|
||||
}
|
||||
|
@ -6032,7 +6062,9 @@ public class MessagesStorage extends BaseController {
|
|||
} catch (Exception e) {
|
||||
FileLog.e(e);
|
||||
} finally {
|
||||
database.commitTransaction();
|
||||
if (database != null) {
|
||||
database.commitTransaction();
|
||||
}
|
||||
if (state != null) {
|
||||
state.dispose();
|
||||
}
|
||||
|
@ -6514,7 +6546,9 @@ public class MessagesStorage extends BaseController {
|
|||
} catch (Exception e) {
|
||||
FileLog.e(e);
|
||||
} finally {
|
||||
database.commitTransaction();
|
||||
if (database != null) {
|
||||
database.commitTransaction();
|
||||
}
|
||||
if (cursor != null) {
|
||||
cursor.dispose();
|
||||
}
|
||||
|
@ -6950,7 +6984,9 @@ public class MessagesStorage extends BaseController {
|
|||
if (cursor != null) {
|
||||
cursor.dispose();
|
||||
}
|
||||
database.commitTransaction();
|
||||
if (database != null) {
|
||||
database.commitTransaction();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -6984,7 +7020,9 @@ public class MessagesStorage extends BaseController {
|
|||
if (state != null) {
|
||||
state.dispose();
|
||||
}
|
||||
database.commitTransaction();
|
||||
if (database != null) {
|
||||
database.commitTransaction();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -7078,7 +7116,9 @@ public class MessagesStorage extends BaseController {
|
|||
if (state2 != null) {
|
||||
state2.dispose();
|
||||
}
|
||||
database.commitTransaction();
|
||||
if (database != null) {
|
||||
database.commitTransaction();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -9219,7 +9259,9 @@ public class MessagesStorage extends BaseController {
|
|||
} catch (Exception e) {
|
||||
FileLog.e(e);
|
||||
} finally {
|
||||
database.commitTransaction();
|
||||
if (database != null) {
|
||||
database.commitTransaction();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -9292,7 +9334,9 @@ public class MessagesStorage extends BaseController {
|
|||
state.dispose();
|
||||
}
|
||||
if (transaction) {
|
||||
database.commitTransaction();
|
||||
if (database != null) {
|
||||
database.commitTransaction();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -9469,7 +9513,9 @@ public class MessagesStorage extends BaseController {
|
|||
if (state2 != null) {
|
||||
state2.dispose();
|
||||
}
|
||||
database.commitTransaction();
|
||||
if (database != null) {
|
||||
database.commitTransaction();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -9657,7 +9703,9 @@ public class MessagesStorage extends BaseController {
|
|||
FileLog.e(e);
|
||||
} finally {
|
||||
if (inTransaction) {
|
||||
database.commitTransaction();
|
||||
if (database != null) {
|
||||
database.commitTransaction();
|
||||
}
|
||||
}
|
||||
if (state != null) {
|
||||
state.dispose();
|
||||
|
@ -9803,7 +9851,9 @@ public class MessagesStorage extends BaseController {
|
|||
FileLog.e(e);
|
||||
} finally {
|
||||
if (databaseInTransaction) {
|
||||
database.commitTransaction();
|
||||
if (database != null) {
|
||||
database.commitTransaction();
|
||||
}
|
||||
}
|
||||
if (state != null) {
|
||||
state.dispose();
|
||||
|
@ -10500,7 +10550,9 @@ public class MessagesStorage extends BaseController {
|
|||
FileLog.e(e);
|
||||
} finally {
|
||||
if (databaseInTransaction) {
|
||||
database.commitTransaction();
|
||||
if (database != null) {
|
||||
database.commitTransaction();
|
||||
}
|
||||
}
|
||||
if (state_messages != null) {
|
||||
state_messages.dispose();
|
||||
|
@ -10854,7 +10906,9 @@ public class MessagesStorage extends BaseController {
|
|||
} catch (Exception e) {
|
||||
FileLog.e(e);
|
||||
} finally {
|
||||
database.commitTransaction();
|
||||
if (database != null) {
|
||||
database.commitTransaction();
|
||||
}
|
||||
if (state != null) {
|
||||
state.dispose();
|
||||
}
|
||||
|
@ -11326,7 +11380,9 @@ public class MessagesStorage extends BaseController {
|
|||
} catch (Exception e) {
|
||||
FileLog.e(e);
|
||||
} finally {
|
||||
database.commitTransaction();
|
||||
if (database != null) {
|
||||
database.commitTransaction();
|
||||
}
|
||||
if (cursor != null) {
|
||||
cursor.dispose();
|
||||
}
|
||||
|
@ -11486,7 +11542,9 @@ public class MessagesStorage extends BaseController {
|
|||
} catch (Exception e) {
|
||||
FileLog.e(e);
|
||||
} finally {
|
||||
database.commitTransaction();
|
||||
if (database != null) {
|
||||
database.commitTransaction();
|
||||
}
|
||||
if (cursor != null) {
|
||||
cursor.dispose();
|
||||
}
|
||||
|
@ -12029,7 +12087,9 @@ public class MessagesStorage extends BaseController {
|
|||
} catch (Exception e) {
|
||||
FileLog.e(e);
|
||||
} finally {
|
||||
database.commitTransaction();
|
||||
if (database != null) {
|
||||
database.commitTransaction();
|
||||
}
|
||||
if (state != null) {
|
||||
state.dispose();
|
||||
}
|
||||
|
@ -12393,7 +12453,9 @@ public class MessagesStorage extends BaseController {
|
|||
} catch (Exception e) {
|
||||
FileLog.e(e);
|
||||
} finally {
|
||||
database.commitTransaction();
|
||||
if (database != null) {
|
||||
database.commitTransaction();
|
||||
}
|
||||
if (state_messages != null) {
|
||||
state_messages.dispose();
|
||||
}
|
||||
|
@ -13056,7 +13118,9 @@ public class MessagesStorage extends BaseController {
|
|||
} catch (Exception e) {
|
||||
FileLog.e(e);
|
||||
} finally {
|
||||
database.commitTransaction();
|
||||
if (database != null) {
|
||||
database.commitTransaction();
|
||||
}
|
||||
if (cursor != null) {
|
||||
cursor.dispose();
|
||||
}
|
||||
|
@ -13163,7 +13227,9 @@ public class MessagesStorage extends BaseController {
|
|||
} catch (Exception e) {
|
||||
FileLog.e(e);
|
||||
} finally {
|
||||
database.commitTransaction();
|
||||
if (database != null) {
|
||||
database.commitTransaction();
|
||||
}
|
||||
if (state != null) {
|
||||
state.dispose();
|
||||
}
|
||||
|
|
|
@ -6356,8 +6356,8 @@ public class SendMessagesHelper extends BaseController implements NotificationCe
|
|||
cursor.moveToFirst();
|
||||
len = cursor.getLong(sizeIndex);
|
||||
|
||||
} catch (FileNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
} catch (Exception e) {
|
||||
FileLog.e(e);
|
||||
}
|
||||
}
|
||||
if (!FileLoader.checkUploadFileSize(accountInstance.getCurrentAccount(), len)) {
|
||||
|
@ -6836,7 +6836,7 @@ public class SendMessagesHelper extends BaseController implements NotificationCe
|
|||
precachedKey[0] = getKeyForPhotoSize(accountInstance, photoSizeThumb, precahcedThumb, true, true);
|
||||
}
|
||||
TLRPC.InputPeer sendToPeer = !DialogObject.isEncryptedDialog(dialogId) ? accountInstance.getMessagesController().getInputPeer(dialogId) : null;
|
||||
if (sendToPeer.user_id != 0 && accountInstance.getMessagesController().getUserFull(sendToPeer.user_id) != null &&
|
||||
if (sendToPeer != null && sendToPeer.user_id != 0 && accountInstance.getMessagesController().getUserFull(sendToPeer.user_id) != null &&
|
||||
accountInstance.getMessagesController().getUserFull(sendToPeer.user_id).voice_messages_forbidden && document != null) {
|
||||
|
||||
if (MessageObject.isVoiceDocument(finalDocument)) {
|
||||
|
|
|
@ -2,6 +2,7 @@ package org.telegram.messenger.utils;
|
|||
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.os.Build;
|
||||
|
||||
import org.telegram.messenger.AndroidUtilities;
|
||||
import org.telegram.messenger.BuildVars;
|
||||
|
@ -128,7 +129,11 @@ public class BitmapsCache {
|
|||
int finalFramePosition = framePosition;
|
||||
RandomAccessFile finalRandomAccessFile1 = randomAccessFile;
|
||||
bitmapCompressExecutor.execute(() -> {
|
||||
bitmap[finalIndex].compress(Bitmap.CompressFormat.WEBP, compressQuality, byteArrayOutputStream[finalIndex]);
|
||||
Bitmap.CompressFormat format = Bitmap.CompressFormat.WEBP;
|
||||
if (Build.VERSION.SDK_INT <= 26) {
|
||||
format = Bitmap.CompressFormat.PNG;
|
||||
}
|
||||
bitmap[finalIndex].compress(format, compressQuality, byteArrayOutputStream[finalIndex]);
|
||||
int size = byteArrayOutputStream[finalIndex].count;
|
||||
|
||||
try {
|
||||
|
@ -266,6 +271,8 @@ public class BitmapsCache {
|
|||
source.getFirstFrame(bitmap);
|
||||
return FRAME_RESULT_OK;
|
||||
} else if (frameOffsets.isEmpty()) {
|
||||
randomAccessFile.close();
|
||||
randomAccessFile = null;
|
||||
return FRAME_RESULT_NO_FRAME;
|
||||
}
|
||||
} else {
|
||||
|
@ -291,7 +298,7 @@ public class BitmapsCache {
|
|||
return FRAME_RESULT_OK;
|
||||
} catch (FileNotFoundException e) {
|
||||
|
||||
} catch (IOException e) {
|
||||
} catch (Exception e) {
|
||||
FileLog.e(e);
|
||||
}
|
||||
|
||||
|
@ -415,5 +422,6 @@ public class BitmapsCache {
|
|||
|
||||
public static class CacheOptions {
|
||||
public int compressQuality = 100;
|
||||
public boolean fallback = false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5930,6 +5930,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
|||
}
|
||||
additionHeight -= AndroidUtilities.dp(17);
|
||||
} else if (messageObject.isAnyKindOfSticker()) {
|
||||
|
||||
drawBackground = false;
|
||||
boolean isWebpSticker = messageObject.type == MessageObject.TYPE_STICKER;
|
||||
TLRPC.Document stickerDocument = messageObject.getDocument();
|
||||
|
@ -5951,6 +5952,10 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
|||
if ((messageObject.isAnimatedSticker() || messageObject.isVideoSticker()) && photoWidth == 0 && photoHeight == 0) {
|
||||
photoWidth = photoHeight = 512;
|
||||
}
|
||||
if (messageObject.isAnimatedAnimatedEmoji()) {
|
||||
photoWidth = Math.max(512, photoWidth);
|
||||
photoHeight = Math.max(512, photoHeight);
|
||||
}
|
||||
float maxHeight;
|
||||
int maxWidth;
|
||||
if (AndroidUtilities.isTablet()) {
|
||||
|
|
|
@ -89,26 +89,6 @@ public class StickerSetCell extends FrameLayout {
|
|||
super(context);
|
||||
this.option = option;
|
||||
|
||||
textView = new TextView(context);
|
||||
textView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
|
||||
textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16);
|
||||
textView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
|
||||
textView.setLines(1);
|
||||
textView.setMaxLines(1);
|
||||
textView.setSingleLine(true);
|
||||
textView.setEllipsize(TextUtils.TruncateAt.END);
|
||||
textView.setGravity(LayoutHelper.getAbsoluteGravityStart());
|
||||
addView(textView, LayoutHelper.createFrameRelatively(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.START, 71, 9, 46, 0));
|
||||
|
||||
valueTextView = new TextView(context);
|
||||
valueTextView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteGrayText2));
|
||||
valueTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 13);
|
||||
valueTextView.setLines(1);
|
||||
valueTextView.setMaxLines(1);
|
||||
valueTextView.setSingleLine(true);
|
||||
valueTextView.setGravity(LayoutHelper.getAbsoluteGravityStart());
|
||||
addView(valueTextView, LayoutHelper.createFrameRelatively(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.START, 71, 32, 46, 0));
|
||||
|
||||
imageView = new BackupImageView(context);
|
||||
imageView.setAspectFit(true);
|
||||
imageView.setLayerNum(1);
|
||||
|
@ -202,6 +182,26 @@ public class StickerSetCell extends FrameLayout {
|
|||
}
|
||||
});
|
||||
|
||||
textView = new TextView(context);
|
||||
textView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
|
||||
textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16);
|
||||
textView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
|
||||
textView.setLines(1);
|
||||
textView.setMaxLines(1);
|
||||
textView.setSingleLine(true);
|
||||
textView.setEllipsize(TextUtils.TruncateAt.END);
|
||||
textView.setGravity(LayoutHelper.getAbsoluteGravityStart());
|
||||
addView(textView, LayoutHelper.createFrameRelatively(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.START, 71, 9, 70, 0));
|
||||
|
||||
valueTextView = new TextView(context);
|
||||
valueTextView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteGrayText2));
|
||||
valueTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 13);
|
||||
valueTextView.setLines(1);
|
||||
valueTextView.setMaxLines(1);
|
||||
valueTextView.setSingleLine(true);
|
||||
valueTextView.setGravity(LayoutHelper.getAbsoluteGravityStart());
|
||||
addView(valueTextView, LayoutHelper.createFrameRelatively(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.START, 71, 32, 70, 0));
|
||||
|
||||
updateButtonState(BUTTON_STATE_EMPTY, false);
|
||||
}
|
||||
|
||||
|
@ -528,6 +528,18 @@ public class StickerSetCell extends FrameLayout {
|
|||
}
|
||||
}
|
||||
|
||||
public void updateRightMargin() {
|
||||
sideButtons.measure(MeasureSpec.makeMeasureSpec(999999, MeasureSpec.AT_MOST), MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(58), MeasureSpec.EXACTLY));
|
||||
final int margin = sideButtons.getMeasuredWidth();
|
||||
if (LocaleController.isRTL) {
|
||||
((MarginLayoutParams) textView.getLayoutParams()).leftMargin = margin;
|
||||
((MarginLayoutParams) valueTextView.getLayoutParams()).leftMargin = margin;
|
||||
} else {
|
||||
((MarginLayoutParams) textView.getLayoutParams()).rightMargin = margin;
|
||||
((MarginLayoutParams) valueTextView.getLayoutParams()).rightMargin = margin;
|
||||
}
|
||||
}
|
||||
|
||||
public static final int BUTTON_STATE_EMPTY = 0;
|
||||
public static final int BUTTON_STATE_LOCKED = 1;
|
||||
public static final int BUTTON_STATE_LOCKED_RESTORE = 2;
|
||||
|
@ -574,6 +586,7 @@ public class StickerSetCell extends FrameLayout {
|
|||
premiumButtonView.setVisibility(state == BUTTON_STATE_LOCKED || state == BUTTON_STATE_LOCKED_RESTORE ? View.VISIBLE : View.GONE);
|
||||
addButtonView.setVisibility(state == BUTTON_STATE_ADD ? View.VISIBLE : View.GONE);
|
||||
removeButtonView.setVisibility(state == BUTTON_STATE_REMOVE ? View.VISIBLE : View.GONE);
|
||||
updateRightMargin();
|
||||
}
|
||||
});
|
||||
stateAnimator.setDuration(250);
|
||||
|
@ -592,6 +605,7 @@ public class StickerSetCell extends FrameLayout {
|
|||
removeButtonView.setScaleX(state == BUTTON_STATE_REMOVE ? 1 : .6f);
|
||||
removeButtonView.setScaleY(state == BUTTON_STATE_REMOVE ? 1 : .6f);
|
||||
removeButtonView.setVisibility(state == BUTTON_STATE_REMOVE ? View.VISIBLE : View.GONE);
|
||||
updateRightMargin();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -11873,6 +11873,8 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
|||
boolean allowPlayEffect = ((messageObject.messageOwner.media != null && !messageObject.messageOwner.media.nopremium) || (messageObject.isAnimatedEmojiStickerSingle() && dialog_id > 0));
|
||||
if ((chatListItemAnimator == null || !chatListItemAnimator.isRunning()) && (!messageObject.isOutOwner() || messageObject.forcePlayEffect) && allowPlayEffect && !messageObject.messageOwner.premiumEffectWasPlayed && (messageObject.isPremiumSticker() || messageObject.isAnimatedEmojiStickerSingle()) && emojiAnimationsOverlay.isIdle() && emojiAnimationsOverlay.checkPosition(messageCell, chatListViewPaddingTop, chatListView.getMeasuredHeight() - blurredViewBottomOffset)) {
|
||||
emojiAnimationsOverlay.onTapItem(messageCell, ChatActivity.this, false);
|
||||
} else if (messageObject.isAnimatedAnimatedEmoji()) {
|
||||
emojiAnimationsOverlay.preloadAnimation(messageCell);
|
||||
}
|
||||
} else if (view instanceof ChatActionCell) {
|
||||
ChatActionCell cell = (ChatActionCell) view;
|
||||
|
@ -22599,7 +22601,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
|||
}
|
||||
}
|
||||
|
||||
public void restartSticker(ChatMessageCell cell) {
|
||||
public void setupStickerVibrationAndSound(ChatMessageCell cell) {
|
||||
MessageObject message = cell.getMessageObject();
|
||||
TLRPC.Document document = message.getDocument();
|
||||
boolean isEmoji;
|
||||
|
@ -22609,6 +22611,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
|||
if (drawable != null) {
|
||||
if (isEmoji) {
|
||||
String emoji = message.getStickerEmoji();
|
||||
emoji = EmojiAnimationsOverlay.unwrapEmoji(emoji);
|
||||
if (EmojiData.isHeartEmoji(emoji)) {
|
||||
HashMap<Integer, Integer> pattern = new HashMap<>();
|
||||
pattern.put(1, 1);
|
||||
|
@ -22628,6 +22631,9 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
|||
pattern.put(36, 0);
|
||||
drawable.setVibrationPattern(pattern);
|
||||
}
|
||||
if (message.isAnimatedAnimatedEmoji()) {
|
||||
drawable.resetVibrationAfterRestart(true);
|
||||
}
|
||||
if (!drawable.isRunning() && emoji != null) {
|
||||
MessagesController.EmojiSound sound = getMessagesController().emojiSounds.get(emoji.replace("\uFE0F", ""));
|
||||
if (sound != null) {
|
||||
|
@ -22635,6 +22641,20 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void restartSticker(ChatMessageCell cell) {
|
||||
MessageObject message = cell.getMessageObject();
|
||||
TLRPC.Document document = message.getDocument();
|
||||
if (!message.isAnimatedAnimatedEmoji()) {
|
||||
setupStickerVibrationAndSound(cell);
|
||||
}
|
||||
if ((message.isAnimatedEmoji()) || MessageObject.isAnimatedStickerDocument(document, currentEncryptedChat == null || message.isOut()) && !SharedConfig.loopStickers) {
|
||||
ImageReceiver imageReceiver = cell.getPhotoImage();
|
||||
RLottieDrawable drawable = imageReceiver.getLottieAnimation();
|
||||
if (drawable != null) {
|
||||
drawable.restart();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -426,11 +426,13 @@ public class AnimatedEmojiDrawable extends Drawable {
|
|||
if ("video/webm".equals(document.mime_type)) {
|
||||
mediaLocation = ImageLocation.getForDocument(document);
|
||||
mediaFilter = filter + "_" + ImageLoader.AUTOPLAY_FILTER;
|
||||
SvgHelper.SvgDrawable svgThumb = DocumentObject.getSvgThumb(document.thumbs, Theme.key_windowBackgroundWhiteGrayIcon, 0.2f);
|
||||
thumbDrawable = svgThumb;
|
||||
} else {
|
||||
String probableCacheKey = (cacheType != 0 ? cacheType + "_" : "") + documentId + "@" + filter;
|
||||
if (cacheType == CACHE_TYPE_KEYBOARD || !ImageLoader.getInstance().hasLottieMemCache(probableCacheKey)) {
|
||||
SvgHelper.SvgDrawable svgThumb = DocumentObject.getSvgThumb(document.thumbs, Theme.key_windowBackgroundWhiteGrayIcon, 0.2f);
|
||||
if (svgThumb != null) {
|
||||
if (svgThumb != null && MessageObject.isAnimatedStickerDocument(document, false)) {
|
||||
svgThumb.overrideWidthAndHeight(512, 512);
|
||||
}
|
||||
thumbDrawable = svgThumb;
|
||||
|
@ -443,10 +445,8 @@ public class AnimatedEmojiDrawable extends Drawable {
|
|||
}
|
||||
if (cacheType == STANDARD_LOTTIE_FRAME) {
|
||||
imageReceiver.setImage(null, null, mediaLocation, mediaFilter, null, null, thumbDrawable, document.size, null, document, 1);
|
||||
|
||||
} else {
|
||||
imageReceiver.setImage(mediaLocation, mediaFilter, ImageLocation.getForDocument(thumb, document), sizedp + "_" + sizedp, null, null, thumbDrawable, document.size, null, document, 1);
|
||||
|
||||
}
|
||||
|
||||
if (cacheType == CACHE_TYPE_ALERT_PREVIEW) {
|
||||
|
|
|
@ -34,6 +34,7 @@ import org.telegram.messenger.ImageLocation;
|
|||
import org.telegram.messenger.ImageReceiver;
|
||||
import org.telegram.messenger.utils.BitmapsCache;
|
||||
import org.telegram.tgnet.TLRPC;
|
||||
import org.telegram.ui.ActionBar.Theme;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
|
@ -754,7 +755,19 @@ public class AnimatedFileDrawable extends BitmapDrawable implements Animatable,
|
|||
}
|
||||
|
||||
if (renderingBitmap != null) {
|
||||
if (applyTransformation) {
|
||||
float scaleX = this.scaleX;
|
||||
float scaleY = this.scaleY;
|
||||
if (drawInBackground) {
|
||||
int bitmapW = renderingBitmap.getWidth();
|
||||
int bitmapH = renderingBitmap.getHeight();
|
||||
if (metaData[2] == 90 || metaData[2] == 270) {
|
||||
int temp = bitmapW;
|
||||
bitmapW = bitmapH;
|
||||
bitmapH = temp;
|
||||
}
|
||||
scaleX = rect.width() / bitmapW;
|
||||
scaleY = rect.height() / bitmapH;
|
||||
} else if (applyTransformation) {
|
||||
int bitmapW = renderingBitmap.getWidth();
|
||||
int bitmapH = renderingBitmap.getHeight();
|
||||
if (metaData[2] == 90 || metaData[2] == 270) {
|
||||
|
@ -763,8 +776,8 @@ public class AnimatedFileDrawable extends BitmapDrawable implements Animatable,
|
|||
bitmapH = temp;
|
||||
}
|
||||
rect.set(getBounds());
|
||||
scaleX = rect.width() / bitmapW;
|
||||
scaleY = rect.height() / bitmapH;
|
||||
this.scaleX = scaleX = rect.width() / bitmapW;
|
||||
this.scaleY = scaleY = rect.height() / bitmapH;
|
||||
applyTransformation = false;
|
||||
}
|
||||
if (hasRoundRadius()) {
|
||||
|
@ -981,7 +994,7 @@ public class AnimatedFileDrawable extends BitmapDrawable implements Animatable,
|
|||
generatingCacheBitmap = Bitmap.createBitmap(metaData[0], metaData[1], Bitmap.Config.ARGB_8888);
|
||||
}
|
||||
getVideoFrame(cacheGenerateNativePtr, generatingCacheBitmap, metaData, generatingCacheBitmap.getRowBytes(), false, startTime, endTime);
|
||||
if (cacheGenerateTimestamp != 0 && metaData[3] == 0) {
|
||||
if (cacheGenerateTimestamp != 0 && metaData[3] == 0 || cacheGenerateTimestamp > metaData[3]) {
|
||||
return 0;
|
||||
}
|
||||
bitmap.eraseColor(Color.TRANSPARENT);
|
||||
|
|
|
@ -278,11 +278,7 @@ public class BotCommandsMenuView extends View {
|
|||
TLRPC.TL_botCommand botCommand = info.commands.get(a);
|
||||
if (botCommand != null && botCommand.command != null) {
|
||||
newResult.add("/" + botCommand.command);
|
||||
if (botCommand.description != null && botCommand.description.length() > 1) {
|
||||
newResultHelp.add(botCommand.description.substring(0, 1).toUpperCase() + botCommand.description.substring(1).toLowerCase());
|
||||
} else {
|
||||
newResultHelp.add(botCommand.description);
|
||||
}
|
||||
newResultHelp.add(botCommand.description);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4772,7 +4772,7 @@ public class ChatActivityEnterView extends BlurredFrameLayout implements Notific
|
|||
}
|
||||
|
||||
public static boolean checkPremiumAnimatedEmoji(int currentAccount, long dialogId, BaseFragment parentFragment, FrameLayout container, CharSequence message) {
|
||||
if (message == null) {
|
||||
if (message == null || parentFragment == null) {
|
||||
return false;
|
||||
}
|
||||
if (container == null) {
|
||||
|
|
|
@ -50,6 +50,7 @@ import org.telegram.ui.Components.Premium.PremiumButtonView;
|
|||
import org.telegram.ui.Components.Premium.PremiumFeatureBottomSheet;
|
||||
import org.telegram.ui.LaunchActivity;
|
||||
import org.telegram.ui.PremiumPreviewFragment;
|
||||
import org.telegram.ui.ProfileActivity;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
|
@ -941,7 +942,28 @@ public class EmojiPacksAlert extends BottomSheet implements NotificationCenter.N
|
|||
if (context == null) {
|
||||
context = getContext();
|
||||
}
|
||||
ShareAlert alert = new ShareAlert(context, null, stickersUrl, false, stickersUrl, false, resourcesProvider);
|
||||
ShareAlert alert = new ShareAlert(context, null, stickersUrl, false, stickersUrl, false, resourcesProvider) {
|
||||
@Override
|
||||
protected void onSend(androidx.collection.LongSparseArray<TLRPC.Dialog> dids, int count) {
|
||||
AndroidUtilities.runOnUIThread(() -> {
|
||||
UndoView undoView;
|
||||
if (fragment instanceof ChatActivity) {
|
||||
undoView = ((ChatActivity) fragment).getUndoView();
|
||||
} else if (fragment instanceof ProfileActivity) {
|
||||
undoView = ((ProfileActivity) fragment).getUndoView();
|
||||
} else {
|
||||
undoView = null;
|
||||
}
|
||||
if (undoView != null) {
|
||||
if (dids.size() == 1) {
|
||||
undoView.showWithAction(dids.valueAt(0).id, UndoView.ACTION_FWD_MESSAGES, count);
|
||||
} else {
|
||||
undoView.showWithAction(0, UndoView.ACTION_FWD_MESSAGES, count, dids.size(), null, null);
|
||||
}
|
||||
}
|
||||
}, 100);
|
||||
}
|
||||
};
|
||||
if (fragment != null) {
|
||||
fragment.showDialog(alert);
|
||||
} else {
|
||||
|
|
|
@ -230,10 +230,12 @@ public class EmojiView extends FrameLayout implements NotificationCenter.Notific
|
|||
if (typeTabs != null) {
|
||||
AndroidUtilities.updateViewVisibilityAnimated(typeTabs, currentTabs.size() > 1, 1, animated);
|
||||
}
|
||||
pager.setAdapter(null);
|
||||
pager.setAdapter(emojiPagerAdapter);
|
||||
if (typeTabs != null) {
|
||||
typeTabs.setViewPager(pager);
|
||||
if (pager != null) {
|
||||
pager.setAdapter(null);
|
||||
pager.setAdapter(emojiPagerAdapter);
|
||||
if (typeTabs != null) {
|
||||
typeTabs.setViewPager(pager);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2821,8 +2823,10 @@ public class EmojiView extends FrameLayout implements NotificationCenter.Notific
|
|||
drawable.update(time);
|
||||
imageView.backgroundThreadDrawHolder = drawable.getImageReceiver().setDrawInBackgroundThread(imageView.backgroundThreadDrawHolder);
|
||||
imageView.backgroundThreadDrawHolder.time = time;
|
||||
imageView.backgroundThreadDrawHolder.overrideAlpha = 1f;
|
||||
drawable.setAlpha(255);
|
||||
AndroidUtilities.rectTmp2.set(imageView.getLeft() + imageView.getPaddingLeft() - startOffset, 0, imageView.getRight() - imageView.getPaddingRight() - startOffset, imageView.getMeasuredHeight() - imageView.getPaddingTop() - imageView.getPaddingBottom());
|
||||
int topOffset = (int) (imageView.getHeight() * .03f);
|
||||
AndroidUtilities.rectTmp2.set(imageView.getLeft() + imageView.getPaddingLeft() - startOffset, topOffset, imageView.getRight() - imageView.getPaddingRight() - startOffset, topOffset + imageView.getMeasuredHeight() - imageView.getPaddingTop() - imageView.getPaddingBottom());
|
||||
imageView.backgroundThreadDrawHolder.setBounds(AndroidUtilities.rectTmp2);
|
||||
imageView.drawable = drawable;
|
||||
imageView.imageReceiver = drawable.getImageReceiver();
|
||||
|
@ -2858,7 +2862,8 @@ public class EmojiView extends FrameLayout implements NotificationCenter.Notific
|
|||
continue;
|
||||
}
|
||||
|
||||
AndroidUtilities.rectTmp2.set(imageView.getLeft() + imageView.getPaddingLeft(), 0, imageView.getRight() - imageView.getPaddingRight(), imageView.getMeasuredHeight() - imageView.getPaddingBottom() - imageView.getPaddingTop());
|
||||
int topOffset = (int) (imageView.getHeight() * .03f);
|
||||
AndroidUtilities.rectTmp2.set(imageView.getLeft() + imageView.getPaddingLeft(), topOffset, imageView.getRight() - imageView.getPaddingRight(), topOffset + imageView.getMeasuredHeight() - imageView.getPaddingBottom() - imageView.getPaddingTop());
|
||||
float alpha = 1f, scale = 1;
|
||||
if (imageView.pressedProgress != 0) {
|
||||
scale *= 0.8f + 0.2f * (1f - imageView.pressedProgress);
|
||||
|
@ -5378,7 +5383,11 @@ public class EmojiView extends FrameLayout implements NotificationCenter.Notific
|
|||
int previousCount2 = favouriteStickers.size();
|
||||
recentStickers = MediaDataController.getInstance(currentAccount).getRecentStickers(MediaDataController.TYPE_IMAGE);
|
||||
favouriteStickers = MediaDataController.getInstance(currentAccount).getRecentStickers(MediaDataController.TYPE_FAVE);
|
||||
premiumStickers = MediaDataController.getInstance(currentAccount).getRecentStickers(MediaDataController.TYPE_PREMIUM_STICKERS);
|
||||
if (UserConfig.getInstance(currentAccount).isPremium()) {
|
||||
premiumStickers = MediaDataController.getInstance(currentAccount).getRecentStickers(MediaDataController.TYPE_PREMIUM_STICKERS);
|
||||
} else {
|
||||
premiumStickers = new ArrayList<>();
|
||||
}
|
||||
for (int a = 0; a < favouriteStickers.size(); a++) {
|
||||
TLRPC.Document favSticker = favouriteStickers.get(a);
|
||||
for (int b = 0; b < recentStickers.size(); b++) {
|
||||
|
|
|
@ -18,7 +18,9 @@ import android.graphics.drawable.Animatable;
|
|||
import android.graphics.drawable.BitmapDrawable;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.os.SystemClock;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.HapticFeedbackConstants;
|
||||
import android.view.View;
|
||||
|
||||
|
@ -32,6 +34,7 @@ import org.telegram.messenger.ImageReceiver;
|
|||
import org.telegram.messenger.R;
|
||||
import org.telegram.messenger.Utilities;
|
||||
import org.telegram.messenger.utils.BitmapsCache;
|
||||
import org.telegram.ui.ActionBar.Theme;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
|
@ -63,6 +66,7 @@ public class RLottieDrawable extends BitmapDrawable implements Animatable, Bitma
|
|||
private HashMap<String, Integer> newColorUpdates = new HashMap<>();
|
||||
private volatile HashMap<String, Integer> pendingColorUpdates = new HashMap<>();
|
||||
private HashMap<Integer, Integer> vibrationPattern;
|
||||
private boolean resetVibrationAfterRestart = false;
|
||||
private boolean allowVibration = true;
|
||||
|
||||
private WeakReference<Runnable> frameReadyCallback;
|
||||
|
@ -116,6 +120,7 @@ public class RLottieDrawable extends BitmapDrawable implements Animatable, Bitma
|
|||
protected boolean destroyAfterLoading;
|
||||
protected int secondFramesCount;
|
||||
protected volatile boolean setLastFrame;
|
||||
private boolean fallbackCache;
|
||||
|
||||
private boolean invalidateOnProgressSet;
|
||||
private boolean isInvalid;
|
||||
|
@ -219,7 +224,7 @@ public class RLottieDrawable extends BitmapDrawable implements Animatable, Bitma
|
|||
}
|
||||
}
|
||||
}
|
||||
if (nativePtr == 0 && secondNativePtr == 0 && bitmapsCache == null) {
|
||||
if ((nativePtr == 0 || fallbackCache) && secondNativePtr == 0 && bitmapsCache == null) {
|
||||
recycleResources();
|
||||
return;
|
||||
}
|
||||
|
@ -255,6 +260,7 @@ public class RLottieDrawable extends BitmapDrawable implements Animatable, Bitma
|
|||
|
||||
private boolean genCacheSend;
|
||||
protected Runnable loadFrameRunnable = new Runnable() {
|
||||
private long lastUpdate = 0;
|
||||
@Override
|
||||
public void run() {
|
||||
if (isRecycled) {
|
||||
|
@ -290,26 +296,36 @@ public class RLottieDrawable extends BitmapDrawable implements Animatable, Bitma
|
|||
pendingReplaceColors = null;
|
||||
}
|
||||
try {
|
||||
long ptrToUse;
|
||||
if (isDice == 1) {
|
||||
ptrToUse = nativePtr;
|
||||
} else if (isDice == 2) {
|
||||
ptrToUse = secondNativePtr;
|
||||
if (setLastFrame) {
|
||||
currentFrame = secondFramesCount - 1;
|
||||
}
|
||||
} else {
|
||||
ptrToUse = nativePtr;
|
||||
}
|
||||
int result = 0;
|
||||
int framesPerUpdates = shouldLimitFps ? 2 : 1;
|
||||
if (precache && bitmapsCache != null) {
|
||||
if (precache && bitmapsCache != null && (!fallbackCache || !generatingCache)) {
|
||||
try {
|
||||
result = bitmapsCache.getFrame(currentFrame / framesPerUpdates, backgroundBitmap);
|
||||
} catch (Exception e) {
|
||||
FileLog.e(e);
|
||||
}
|
||||
} else {
|
||||
if (fallbackCache) {
|
||||
final long now = SystemClock.elapsedRealtime();
|
||||
if (lastUpdate > 0) {
|
||||
framesPerUpdates = Math.max(1, Math.min(4, Math.round((now - lastUpdate) / 16f)));
|
||||
if (currentFrame + framesPerUpdates > (customEndFrame >= 0 ? customEndFrame : metaData[0])) {
|
||||
framesPerUpdates = (customEndFrame >= 0 ? customEndFrame : metaData[0]) - currentFrame;
|
||||
}
|
||||
}
|
||||
lastUpdate = now;
|
||||
}
|
||||
long ptrToUse;
|
||||
if (isDice == 1) {
|
||||
ptrToUse = nativePtr;
|
||||
} else if (isDice == 2) {
|
||||
ptrToUse = secondNativePtr;
|
||||
if (setLastFrame) {
|
||||
currentFrame = secondFramesCount - 1;
|
||||
}
|
||||
} else {
|
||||
ptrToUse = nativePtr;
|
||||
}
|
||||
result = getFrame(ptrToUse, currentFrame, backgroundBitmap, width, height, backgroundBitmap.getRowBytes(), true);
|
||||
}
|
||||
if (bitmapsCache != null && bitmapsCache.needGenCache()) {
|
||||
|
@ -317,7 +333,9 @@ public class RLottieDrawable extends BitmapDrawable implements Animatable, Bitma
|
|||
genCacheSend = true;
|
||||
uiHandler.post(uiRunnableGenerateCache);
|
||||
}
|
||||
result = -1;
|
||||
if (!fallbackCache) {
|
||||
result = -1;
|
||||
}
|
||||
}
|
||||
if (result == -1) {
|
||||
uiHandler.post(uiRunnableNoFrame);
|
||||
|
@ -338,6 +356,10 @@ public class RLottieDrawable extends BitmapDrawable implements Animatable, Bitma
|
|||
if (secondNativePtr != 0) {
|
||||
isDice = 2;
|
||||
}
|
||||
if (resetVibrationAfterRestart) {
|
||||
vibrationPattern = null;
|
||||
resetVibrationAfterRestart = false;
|
||||
}
|
||||
}
|
||||
} else if (isDice == 2) {
|
||||
if (currentFrame + framesPerUpdates < secondFramesCount) {
|
||||
|
@ -377,10 +399,18 @@ public class RLottieDrawable extends BitmapDrawable implements Animatable, Bitma
|
|||
} else if (autoRepeat == 1) {
|
||||
currentFrame = 0;
|
||||
nextFrameIsLast = false;
|
||||
if (resetVibrationAfterRestart) {
|
||||
vibrationPattern = null;
|
||||
resetVibrationAfterRestart = false;
|
||||
}
|
||||
} else if (autoRepeat == 2) {
|
||||
currentFrame = 0;
|
||||
nextFrameIsLast = true;
|
||||
autoRepeatPlayCount++;
|
||||
if (resetVibrationAfterRestart) {
|
||||
vibrationPattern = null;
|
||||
resetVibrationAfterRestart = false;
|
||||
}
|
||||
} else {
|
||||
nextFrameIsLast = true;
|
||||
checkDispatchOnAnimationEnd();
|
||||
|
@ -407,6 +437,7 @@ public class RLottieDrawable extends BitmapDrawable implements Animatable, Bitma
|
|||
height = h;
|
||||
shouldLimitFps = limitFps;
|
||||
this.precache = cacheOptions != null;
|
||||
this.fallbackCache = cacheOptions != null && cacheOptions.fallback;
|
||||
getPaint().setFlags(Paint.FILTER_BITMAP_FLAG);
|
||||
|
||||
this.file = file;
|
||||
|
@ -421,8 +452,14 @@ public class RLottieDrawable extends BitmapDrawable implements Animatable, Bitma
|
|||
args.colorReplacement = colorReplacement;
|
||||
args.fitzModifier = fitzModifier;
|
||||
nativePtr = create(file.getAbsolutePath(), null, w, h, metaData, precache, colorReplacement, shouldLimitFps, fitzModifier);
|
||||
destroy(nativePtr);
|
||||
nativePtr = 0;
|
||||
if (fallbackCache) {
|
||||
if (nativePtr == 0) {
|
||||
file.delete();
|
||||
}
|
||||
} else {
|
||||
destroy(nativePtr);
|
||||
nativePtr = 0;
|
||||
}
|
||||
} else {
|
||||
nativePtr = create(file.getAbsolutePath(), null, w, h, metaData, precache, colorReplacement, shouldLimitFps, fitzModifier);
|
||||
if (nativePtr == 0) {
|
||||
|
@ -453,10 +490,16 @@ public class RLottieDrawable extends BitmapDrawable implements Animatable, Bitma
|
|||
args.colorReplacement = colorReplacement;
|
||||
args.fitzModifier = fitzModifier;
|
||||
nativePtr = create(file.getAbsolutePath(), json, w, h, metaData, precache, colorReplacement, shouldLimitFps, fitzModifier);
|
||||
if (nativePtr != 0) {
|
||||
destroy(nativePtr);
|
||||
if (fallbackCache) {
|
||||
if (nativePtr == 0) {
|
||||
file.delete();
|
||||
}
|
||||
} else {
|
||||
if (nativePtr != 0) {
|
||||
destroy(nativePtr);
|
||||
}
|
||||
nativePtr = 0;
|
||||
}
|
||||
nativePtr = 0;
|
||||
} else {
|
||||
nativePtr = create(file.getAbsolutePath(), json, w, h, metaData, precache, colorReplacement, shouldLimitFps, fitzModifier);
|
||||
if (nativePtr == 0) {
|
||||
|
@ -790,6 +833,10 @@ public class RLottieDrawable extends BitmapDrawable implements Animatable, Bitma
|
|||
vibrationPattern = pattern;
|
||||
}
|
||||
|
||||
public boolean hasVibrationPattern() {
|
||||
return vibrationPattern != null;
|
||||
}
|
||||
|
||||
public void beginApplyLayerColors() {
|
||||
applyingLayerColors = true;
|
||||
}
|
||||
|
@ -845,7 +892,7 @@ public class RLottieDrawable extends BitmapDrawable implements Animatable, Bitma
|
|||
return false;
|
||||
}
|
||||
if (generatingCache) {
|
||||
return false;
|
||||
// return false;
|
||||
}
|
||||
if (!newColorUpdates.isEmpty()) {
|
||||
pendingColorUpdates.putAll(newColorUpdates);
|
||||
|
@ -923,6 +970,10 @@ public class RLottieDrawable extends BitmapDrawable implements Animatable, Bitma
|
|||
invalidateSelf();
|
||||
}
|
||||
|
||||
public boolean isCacheFallbacked() {
|
||||
return fallbackCache;
|
||||
}
|
||||
|
||||
public void setProgressMs(long ms) {
|
||||
int frameNum = (int) ((Math.max(0, ms) / timeBetweenFrames) % metaData[0]);
|
||||
setCurrentFrame(frameNum, true, true);
|
||||
|
@ -1107,6 +1158,10 @@ public class RLottieDrawable extends BitmapDrawable implements Animatable, Bitma
|
|||
allowVibration = allow;
|
||||
}
|
||||
|
||||
public void resetVibrationAfterRestart(boolean value) {
|
||||
resetVibrationAfterRestart = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMinimumHeight() {
|
||||
return height;
|
||||
|
@ -1216,7 +1271,7 @@ public class RLottieDrawable extends BitmapDrawable implements Animatable, Bitma
|
|||
|
||||
public boolean canLoadFrames() {
|
||||
if (precache) {
|
||||
return bitmapsCache != null;
|
||||
return bitmapsCache != null || fallbackCache;
|
||||
} else {
|
||||
return nativePtr != 0;
|
||||
}
|
||||
|
|
|
@ -280,11 +280,11 @@ public class SizeNotifierFrameLayout extends FrameLayout {
|
|||
}
|
||||
|
||||
private void checkLayerType() {
|
||||
if (parallaxEffect == null && backgroundDrawable instanceof MotionBackgroundDrawable && SharedConfig.getDevicePerformanceClass() == SharedConfig.PERFORMANCE_CLASS_HIGH) {
|
||||
backgroundView.setLayerType(LAYER_TYPE_HARDWARE, null);
|
||||
} else {
|
||||
backgroundView.setLayerType(LAYER_TYPE_NONE, null);
|
||||
}
|
||||
// if (parallaxEffect == null && backgroundDrawable instanceof MotionBackgroundDrawable && SharedConfig.getDevicePerformanceClass() == SharedConfig.PERFORMANCE_CLASS_HIGH) {
|
||||
// backgroundView.setLayerType(LAYER_TYPE_HARDWARE, null);
|
||||
// } else {
|
||||
// backgroundView.setLayerType(LAYER_TYPE_NONE, null);
|
||||
// }
|
||||
}
|
||||
|
||||
public Drawable getBackgroundImage() {
|
||||
|
|
|
@ -16,6 +16,7 @@ import android.text.TextDirectionHeuristic;
|
|||
import android.text.TextDirectionHeuristics;
|
||||
import android.text.TextPaint;
|
||||
import android.text.TextUtils;
|
||||
import android.text.style.CharacterStyle;
|
||||
|
||||
import org.telegram.messenger.AndroidUtilities;
|
||||
import org.telegram.messenger.FileLog;
|
||||
|
@ -172,7 +173,7 @@ public class StaticLayoutEx {
|
|||
.setAlignment(align)
|
||||
.setLineSpacing(spacingAdd, spacingMult)
|
||||
.setIncludePad(includePad)
|
||||
.setEllipsize(ellipsize)
|
||||
.setEllipsize(stringBuilder.getSpans(0, stringBuilder.length(), CharacterStyle.class).length > 0 ? null : ellipsize)
|
||||
.setEllipsizedWidth(ellipsisWidth)
|
||||
.setMaxLines(maxLines)
|
||||
.setBreakStrategy(canContainUrl ? StaticLayout.BREAK_STRATEGY_HIGH_QUALITY : StaticLayout.BREAK_STRATEGY_SIMPLE)
|
||||
|
|
|
@ -49,6 +49,7 @@ import android.widget.LinearLayout;
|
|||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.collection.LongSparseArray;
|
||||
import androidx.recyclerview.widget.GridLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
|
@ -87,6 +88,7 @@ import org.telegram.ui.Components.Premium.PremiumFeatureBottomSheet;
|
|||
import org.telegram.ui.ContentPreviewViewer;
|
||||
import org.telegram.ui.LaunchActivity;
|
||||
import org.telegram.ui.PremiumPreviewFragment;
|
||||
import org.telegram.ui.ProfileActivity;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
|
@ -1004,6 +1006,27 @@ public class StickersAlert extends BottomSheet implements NotificationCenter.Not
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onSend(LongSparseArray<TLRPC.Dialog> dids, int count) {
|
||||
AndroidUtilities.runOnUIThread(() -> {
|
||||
UndoView undoView;
|
||||
if (parentFragment instanceof ChatActivity) {
|
||||
undoView = ((ChatActivity) parentFragment).getUndoView();
|
||||
} else if (parentFragment instanceof ProfileActivity) {
|
||||
undoView = ((ProfileActivity) parentFragment).getUndoView();
|
||||
} else {
|
||||
undoView = null;
|
||||
}
|
||||
if (undoView != null) {
|
||||
if (dids.size() == 1) {
|
||||
undoView.showWithAction(dids.valueAt(0).id, UndoView.ACTION_FWD_MESSAGES, count);
|
||||
} else {
|
||||
undoView.showWithAction(0, UndoView.ACTION_FWD_MESSAGES, count, dids.size(), null, null);
|
||||
}
|
||||
}
|
||||
}, 100);
|
||||
}
|
||||
};
|
||||
if (parentFragment != null) {
|
||||
parentFragment.showDialog(alert);
|
||||
|
|
|
@ -2,6 +2,7 @@ package org.telegram.ui;
|
|||
|
||||
import android.graphics.Canvas;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.HapticFeedbackConstants;
|
||||
import android.view.View;
|
||||
import android.widget.FrameLayout;
|
||||
|
@ -12,6 +13,7 @@ import org.json.JSONObject;
|
|||
import org.telegram.messenger.AndroidUtilities;
|
||||
import org.telegram.messenger.EmojiData;
|
||||
import org.telegram.messenger.FileLog;
|
||||
import org.telegram.messenger.ImageLoader;
|
||||
import org.telegram.messenger.ImageLocation;
|
||||
import org.telegram.messenger.ImageReceiver;
|
||||
import org.telegram.messenger.LocaleController;
|
||||
|
@ -217,7 +219,7 @@ public class EmojiAnimationsOverlay implements NotificationCenter.NotificationCe
|
|||
|
||||
if (bestView != null) {
|
||||
chatActivity.restartSticker(bestView);
|
||||
if (!EmojiData.hasEmojiSupportVibration(bestView.getMessageObject().getStickerEmoji()) && !bestView.getMessageObject().isPremiumSticker()) {
|
||||
if (!EmojiData.hasEmojiSupportVibration(bestView.getMessageObject().getStickerEmoji()) && !bestView.getMessageObject().isPremiumSticker() && !bestView.getMessageObject().isAnimatedAnimatedEmoji()) {
|
||||
bestView.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP);
|
||||
}
|
||||
showAnimationForCell(bestView, animation, false, true);
|
||||
|
@ -308,7 +310,7 @@ public class EmojiAnimationsOverlay implements NotificationCenter.NotificationCe
|
|||
drawingObject.imageReceiver.draw(canvas);
|
||||
}
|
||||
}
|
||||
if (drawingObject.removeProgress == 1f || (drawingObject.wasPlayed && drawingObject.imageReceiver.getLottieAnimation() != null && drawingObject.imageReceiver.getLottieAnimation().getCurrentFrame() == drawingObject.imageReceiver.getLottieAnimation().getFramesCount() - 2)) {
|
||||
if (drawingObject.removeProgress == 1f || (drawingObject.wasPlayed && drawingObject.imageReceiver.getLottieAnimation() != null && drawingObject.imageReceiver.getLottieAnimation().getCurrentFrame() >= drawingObject.imageReceiver.getLottieAnimation().getFramesCount() - 2)) {
|
||||
drawingObjects.remove(i);
|
||||
i--;
|
||||
} else if (drawingObject.imageReceiver.getLottieAnimation() != null && drawingObject.imageReceiver.getLottieAnimation().isRunning()) {
|
||||
|
@ -338,7 +340,7 @@ public class EmojiAnimationsOverlay implements NotificationCenter.NotificationCe
|
|||
}
|
||||
boolean show = showAnimationForCell(view, -1, userTapped, false);
|
||||
|
||||
if (userTapped && show && !EmojiData.hasEmojiSupportVibration(view.getMessageObject().getStickerEmoji()) && !view.getMessageObject().isPremiumSticker()) {
|
||||
if (userTapped && show && !EmojiData.hasEmojiSupportVibration(view.getMessageObject().getStickerEmoji()) && !view.getMessageObject().isPremiumSticker() && !view.getMessageObject().isAnimatedAnimatedEmoji()) {
|
||||
view.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP);
|
||||
}
|
||||
if (view.getMessageObject().isPremiumSticker() || (!userTapped && view.getMessageObject().isAnimatedEmojiStickerSingle())) {
|
||||
|
@ -447,6 +449,45 @@ public class EmojiAnimationsOverlay implements NotificationCenter.NotificationCe
|
|||
return true;
|
||||
}
|
||||
|
||||
public void preloadAnimation(ChatMessageCell cell) {
|
||||
// MessageObject messageObject = cell.getMessageObject();
|
||||
// if (messageObject.isPremiumSticker()) {
|
||||
// return;
|
||||
// }
|
||||
// String emoji = messageObject.getStickerEmoji();
|
||||
// if (emoji == null) {
|
||||
// emoji = messageObject.messageOwner.message;
|
||||
// }
|
||||
// emoji = unwrapEmoji(emoji);
|
||||
// if (!supportedEmoji.contains(emoji)) {
|
||||
// return;
|
||||
// }
|
||||
// ArrayList<TLRPC.Document> arrayList = emojiInteractionsStickersMap.get(emoji);
|
||||
// if (arrayList == null || arrayList.isEmpty()) {
|
||||
// return;
|
||||
// }
|
||||
// int size = (int) (2f * cell.getPhotoImage().getImageWidth() / AndroidUtilities.density);
|
||||
// int preloadCount = Math.min(1, arrayList.size());
|
||||
// for (int i = 0; i < preloadCount; ++i) {
|
||||
// this.preloadAnimation(arrayList.get(i), size);
|
||||
// }
|
||||
}
|
||||
|
||||
// private HashMap<Long, Boolean> preloaded;
|
||||
// private void preloadAnimation(TLRPC.Document document, int size) {
|
||||
// if (document == null) {
|
||||
// return;
|
||||
// }
|
||||
// if (preloaded != null && preloaded.containsKey(document.id)) {
|
||||
// return;
|
||||
// }
|
||||
// if (preloaded == null) {
|
||||
// preloaded = new HashMap<>();
|
||||
// }
|
||||
// preloaded.put(document.id, true);
|
||||
// new ImageReceiver().setImage(ImageLocation.getForDocument(document), size + "_" + size + "_pcache_compress", null, "tgs", set, 1);
|
||||
// }
|
||||
|
||||
private boolean showAnimationForCell(ChatMessageCell view, int animation, boolean sendTap, boolean sendSeen) {
|
||||
if (drawingObjects.size() > 12) {
|
||||
return false;
|
||||
|
@ -517,6 +558,26 @@ public class EmojiAnimationsOverlay implements NotificationCenter.NotificationCe
|
|||
TLRPC.VideoSize videoSize = null;
|
||||
if (isPremiumSticker) {
|
||||
videoSize = messageObject.getPremiumStickerAnimation();
|
||||
} else if (messageObject.isAnimatedAnimatedEmoji()) {
|
||||
// if (animation < 0 || animation > arrayList.size() - 1) {
|
||||
// ArrayList<Integer> preloadedVariants = new ArrayList<>();
|
||||
// for (int i = 0; i < arrayList.size(); ++i) {
|
||||
// TLRPC.Document d = arrayList.get(i);
|
||||
// if (d == null) {
|
||||
// continue;
|
||||
// }
|
||||
// Boolean value = preloaded.get(d.id);
|
||||
// if (value != null && value) {
|
||||
// preloadedVariants.add(i);
|
||||
// }
|
||||
// }
|
||||
// if (preloadedVariants.isEmpty()) {
|
||||
animation = Math.abs(random.nextInt()) % arrayList.size();
|
||||
// } else {
|
||||
// animation = preloadedVariants.get(Math.abs(random.nextInt()) % preloadedVariants.size());
|
||||
// }
|
||||
// }
|
||||
document = arrayList.get(animation);
|
||||
} else {
|
||||
if (animation < 0 || animation > arrayList.size() - 1) {
|
||||
animation = Math.abs(random.nextInt()) % arrayList.size();
|
||||
|
@ -547,7 +608,17 @@ public class EmojiAnimationsOverlay implements NotificationCenter.NotificationCe
|
|||
ImageLocation imageLocation = ImageLocation.getForDocument(document);
|
||||
drawingObject.imageReceiver.setUniqKeyPrefix(currentIndex + "_" + drawingObject.messageId + "_");
|
||||
|
||||
drawingObject.imageReceiver.setImage(imageLocation, w + "_" + w + "_pcache", null, "tgs", set, 1);
|
||||
drawingObject.imageReceiver.setImage(imageLocation, w + "_" + w + "_pcache_compress_flbk", null, "tgs", set, 1);
|
||||
drawingObject.imageReceiver.setDelegate(new ImageReceiver.ImageReceiverDelegate() {
|
||||
@Override
|
||||
public void didSetImage(ImageReceiver imageReceiver, boolean set, boolean thumb, boolean memCache) {}
|
||||
@Override
|
||||
public void onAnimationReady(ImageReceiver imageReceiver) {
|
||||
if (sendTap && messageObject.isAnimatedAnimatedEmoji() && imageReceiver.getLottieAnimation() != null && !imageReceiver.getLottieAnimation().hasVibrationPattern()) {
|
||||
view.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_VIEW_SETTING);
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
w = (int) (1.5f * imageW / AndroidUtilities.density);
|
||||
if (sameAnimationsCountDocumentId > 0) {
|
||||
|
@ -632,7 +703,7 @@ public class EmojiAnimationsOverlay implements NotificationCenter.NotificationCe
|
|||
bulletin.show();
|
||||
}
|
||||
|
||||
private String unwrapEmoji(String emoji) {
|
||||
public static String unwrapEmoji(String emoji) {
|
||||
CharSequence fixedEmoji = emoji;
|
||||
int length = emoji.length();
|
||||
for (int a = 0; a < length; a++) {
|
||||
|
|
|
@ -39,6 +39,8 @@ import android.graphics.drawable.Drawable;
|
|||
import android.location.Location;
|
||||
import android.location.LocationManager;
|
||||
import android.net.Uri;
|
||||
import android.opengl.GLES20;
|
||||
import android.opengl.GLSurfaceView;
|
||||
import android.os.Build;
|
||||
import android.text.TextUtils;
|
||||
import android.util.TypedValue;
|
||||
|
@ -104,6 +106,7 @@ import org.telegram.ui.Components.RecyclerListView;
|
|||
import org.telegram.ui.Components.UndoView;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
|
@ -135,6 +138,7 @@ public class LocationActivity extends BaseFragment implements NotificationCenter
|
|||
private IMapsProvider.ICameraUpdate moveToBounds;
|
||||
private IMapsProvider.IMapView mapView;
|
||||
private IMapsProvider.ICameraUpdate forceUpdate;
|
||||
private boolean hasScreenshot;
|
||||
private float yOffset;
|
||||
|
||||
private IMapsProvider.ICircle proximityCircle;
|
||||
|
@ -2470,9 +2474,69 @@ public class LocationActivity extends BaseFragment implements NotificationCenter
|
|||
proximitySheet.dismiss();
|
||||
return false;
|
||||
}
|
||||
if (onCheckGlScreenshot()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return super.onBackPressed();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void finishFragment(boolean animated) {
|
||||
if (onCheckGlScreenshot()) {
|
||||
return;
|
||||
}
|
||||
|
||||
super.finishFragment(animated);
|
||||
}
|
||||
|
||||
private boolean onCheckGlScreenshot() {
|
||||
if (mapView != null && mapView.getGlSurfaceView() != null && !hasScreenshot) {
|
||||
GLSurfaceView glSurfaceView = mapView.getGlSurfaceView();
|
||||
glSurfaceView.queueEvent(() -> {
|
||||
if (glSurfaceView.getWidth() == 0 || glSurfaceView.getHeight() == 0) {
|
||||
return;
|
||||
}
|
||||
ByteBuffer buffer = ByteBuffer.allocateDirect(glSurfaceView.getWidth() * glSurfaceView.getHeight() * 4);
|
||||
GLES20.glReadPixels(0, 0, glSurfaceView.getWidth(), glSurfaceView.getHeight(), GLES20.GL_RGBA, GLES20.GL_UNSIGNED_BYTE, buffer);
|
||||
Bitmap bitmap = Bitmap.createBitmap(glSurfaceView.getWidth(), glSurfaceView.getHeight(), Bitmap.Config.ARGB_8888);
|
||||
bitmap.copyPixelsFromBuffer(buffer);
|
||||
|
||||
Matrix flipVertically = new Matrix();
|
||||
flipVertically.preScale(1, -1);
|
||||
|
||||
Bitmap flippedBitmap = Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), flipVertically, false);
|
||||
bitmap.recycle();
|
||||
|
||||
AndroidUtilities.runOnUIThread(()->{
|
||||
ImageView snapshotView = new ImageView(getContext());
|
||||
snapshotView.setImageBitmap(flippedBitmap);
|
||||
|
||||
ViewGroup parent = (ViewGroup) glSurfaceView.getParent();
|
||||
try {
|
||||
parent.addView(snapshotView, parent.indexOfChild(glSurfaceView));
|
||||
} catch (Exception e) {
|
||||
FileLog.e(e);
|
||||
}
|
||||
|
||||
AndroidUtilities.runOnUIThread(()->{
|
||||
try {
|
||||
parent.removeView(glSurfaceView);
|
||||
} catch (Exception e) {
|
||||
FileLog.e(e);
|
||||
}
|
||||
|
||||
hasScreenshot = true;
|
||||
|
||||
finishFragment();
|
||||
}, 100);
|
||||
});
|
||||
});
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onBecomeFullyHidden() {
|
||||
if (undoView[0] != null) {
|
||||
|
|
|
@ -37,6 +37,7 @@ import org.telegram.tgnet.TLRPC;
|
|||
import org.telegram.ui.ActionBar.SimpleTextView;
|
||||
import org.telegram.ui.ActionBar.Theme;
|
||||
import org.telegram.ui.Cells.ChatMessageCell;
|
||||
import org.telegram.ui.Components.AnimatedEmojiDrawable;
|
||||
import org.telegram.ui.Components.AnimatedEmojiSpan;
|
||||
import org.telegram.ui.Components.ChatActivityEnterView;
|
||||
import org.telegram.ui.Components.CubicBezierInterpolator;
|
||||
|
@ -97,6 +98,7 @@ public class TextMessageEnterTransition implements MessageEnterTransitionContain
|
|||
MessageObject.TextLayoutBlock textLayoutBlock;
|
||||
Drawable fromMessageDrawable;
|
||||
ChatActivityEnterView enterView;
|
||||
private AnimatedEmojiSpan.EmojiGroupedSpans animatedEmojiStack;
|
||||
|
||||
float textX;
|
||||
float textY;
|
||||
|
@ -194,9 +196,9 @@ public class TextMessageEnterTransition implements MessageEnterTransitionContain
|
|||
layoutH = chatActivityEnterView.getEditField().getLayout().getLineBottom(chatActivityEnterView.getEditField().getLayout().getLineForOffset(newStart[0] + trimmedStr.length())) - linesOffset;
|
||||
}
|
||||
text = Emoji.replaceEmoji(editText, textPaint.getFontMetricsInt(), emojiSize, false);
|
||||
text = AnimatedEmojiSpan.cloneSpans(text);
|
||||
}
|
||||
|
||||
|
||||
scaleFrom = chatActivityEnterView.getEditField().getTextSize() / textPaint.getTextSize();
|
||||
|
||||
int n = chatActivityEnterView.getEditField().getLayout().getLineCount();
|
||||
|
@ -211,6 +213,7 @@ public class TextMessageEnterTransition implements MessageEnterTransitionContain
|
|||
} else {
|
||||
layout = new StaticLayout(text, textPaint, width, Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false);
|
||||
}
|
||||
animatedEmojiStack = AnimatedEmojiSpan.update(AnimatedEmojiDrawable.CACHE_TYPE_KEYBOARD, null, animatedEmojiStack, layout);
|
||||
float textViewY = chatActivityEnterView.getY() + chatActivityEnterView.getEditField().getY() + ((View) chatActivityEnterView.getEditField().getParent()).getY() + ((View) chatActivityEnterView.getEditField().getParent().getParent()).getY();
|
||||
fromStartX = chatActivityEnterView.getX() + chatActivityEnterView.getEditField().getX() + ((View) chatActivityEnterView.getEditField().getParent()).getX() + ((View) chatActivityEnterView.getEditField().getParent().getParent()).getX();
|
||||
fromStartY = textViewY + AndroidUtilities.dp(10) - chatActivityEnterView.getEditField().getScrollY() + linesOffset;
|
||||
|
@ -386,6 +389,7 @@ public class TextMessageEnterTransition implements MessageEnterTransitionContain
|
|||
chatActivityEnterView.getEditField().setAlpha(1f);
|
||||
chatActivity.getReplyNameTextView().setAlpha(1f);
|
||||
chatActivity.getReplyObjectTextView().setAlpha(1f);
|
||||
AnimatedEmojiSpan.release(null, animatedEmojiStack);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -608,7 +612,9 @@ public class TextMessageEnterTransition implements MessageEnterTransitionContain
|
|||
|
||||
canvas.save();
|
||||
|
||||
canvas.clipRect(drawableX + AndroidUtilities.dp(4), drawableTop + AndroidUtilities.dp(4), drawableRight - AndroidUtilities.dp(4), drawableBottom - AndroidUtilities.dp(4));
|
||||
if (messageView.getMessageObject() == null || messageView.getMessageObject().type != MessageObject.TYPE_EMOJIS) {
|
||||
canvas.clipRect(drawableX + AndroidUtilities.dp(4), drawableTop + AndroidUtilities.dp(4), drawableRight - AndroidUtilities.dp(4), drawableBottom - AndroidUtilities.dp(4));
|
||||
}
|
||||
|
||||
float scale = progressX + scaleFrom * (1f - progressX);
|
||||
float scale2;
|
||||
|
@ -627,20 +633,23 @@ public class TextMessageEnterTransition implements MessageEnterTransitionContain
|
|||
bitmapPaint.setAlpha((int) (255 * (1f - alphaProgress)));
|
||||
}
|
||||
canvas.drawBitmap(textLayoutBitmap, 0, 0, bitmapPaint);
|
||||
} else if (currentMessageObject == null || currentMessageObject.type != MessageObject.TYPE_EMOJIS) {
|
||||
} else {
|
||||
if (crossfade && changeColor) {
|
||||
int oldColor = layout.getPaint().getColor();
|
||||
int oldAlpha = Color.alpha(oldColor);
|
||||
layout.getPaint().setColor(ColorUtils.setAlphaComponent(ColorUtils.blendARGB(fromColor, toColor, alphaProgress), (int) (oldAlpha * (1f - alphaProgress))));
|
||||
layout.draw(canvas);
|
||||
AnimatedEmojiSpan.drawAnimatedEmojis(canvas, layout, animatedEmojiStack, 0, null, 0, 0, 0, 1f - alphaProgress);
|
||||
layout.getPaint().setColor(oldColor);
|
||||
} else if (crossfade) {
|
||||
int oldAlpha = Theme.chat_msgTextPaint.getAlpha();
|
||||
Theme.chat_msgTextPaint.setAlpha((int) (oldAlpha * (1f - alphaProgress)));
|
||||
layout.draw(canvas);
|
||||
AnimatedEmojiSpan.drawAnimatedEmojis(canvas, layout, animatedEmojiStack, 0, null, 0, 0, 0, 1f - alphaProgress);
|
||||
Theme.chat_msgTextPaint.setAlpha(oldAlpha);
|
||||
} else {
|
||||
layout.draw(canvas);
|
||||
AnimatedEmojiSpan.drawAnimatedEmojis(canvas, layout, animatedEmojiStack, 0, null, 0, 0, 0, 1f);
|
||||
}
|
||||
}
|
||||
canvas.restore();
|
||||
|
|
|
@ -6,6 +6,10 @@
|
|||
|
||||
<uses-permission android:name="com.huawei.appmarket.service.commondata.permission.GET_COMMON_DATA"/>
|
||||
|
||||
<queries>
|
||||
<package android:name="com.huawei.maps.app"/>
|
||||
</queries>
|
||||
|
||||
<application android:name="org.telegram.messenger.HuaweiApplicationLoader" tools:replace="name">
|
||||
<service android:name="org.telegram.messenger.GoogleVoiceClientService"/>
|
||||
<activity
|
||||
|
|
|
@ -5,9 +5,11 @@ import android.content.Context;
|
|||
import android.graphics.Bitmap;
|
||||
import android.graphics.Point;
|
||||
import android.location.Location;
|
||||
import android.opengl.GLSurfaceView;
|
||||
import android.os.Bundle;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.core.util.Consumer;
|
||||
|
||||
|
@ -34,6 +36,9 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
|
||||
public class HuaweiMapsProvider implements IMapsProvider {
|
||||
public HuaweiMapsProvider() {
|
||||
initializeMaps(ApplicationLoader.applicationContext);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initializeMaps(Context context) {
|
||||
|
@ -96,8 +101,8 @@ public class HuaweiMapsProvider implements IMapsProvider {
|
|||
private Map<Marker, HuaweiMarker> implToAbsMarkerMap = new HashMap<>();
|
||||
private Map<Circle, HuaweiCircle> implToAbsCircleMap = new HashMap<>();
|
||||
|
||||
private HuaweiMapImpl(HuaweiMap googleMap) {
|
||||
this.huaweiMap = googleMap;
|
||||
private HuaweiMapImpl(HuaweiMap huaweiMap) {
|
||||
this.huaweiMap = huaweiMap;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -521,6 +526,8 @@ public class HuaweiMapsProvider implements IMapsProvider {
|
|||
private ITouchInterceptor interceptInterceptor;
|
||||
private Runnable onLayoutListener;
|
||||
|
||||
private GLSurfaceView glSurfaceView;
|
||||
|
||||
private HuaweiMapView(Context context) {
|
||||
mapView = new MapView(context) {
|
||||
@Override
|
||||
|
@ -571,7 +578,28 @@ public class HuaweiMapsProvider implements IMapsProvider {
|
|||
|
||||
@Override
|
||||
public void getMapAsync(Consumer<IMap> callback) {
|
||||
mapView.getMapAsync(googleMap -> callback.accept(new HuaweiMapImpl(googleMap)));
|
||||
mapView.getMapAsync(huaweiMap -> {
|
||||
callback.accept(new HuaweiMapImpl(huaweiMap));
|
||||
findGlSurfaceView(mapView);
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public GLSurfaceView getGlSurfaceView() {
|
||||
return glSurfaceView;
|
||||
}
|
||||
|
||||
private void findGlSurfaceView(View v) {
|
||||
if (v instanceof GLSurfaceView) {
|
||||
glSurfaceView = (GLSurfaceView) v;
|
||||
}
|
||||
|
||||
if (v instanceof ViewGroup) {
|
||||
ViewGroup vg = (ViewGroup) v;
|
||||
for (int i = 0; i < vg.getChildCount(); i++) {
|
||||
findGlSurfaceView(vg.getChildAt(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -13,12 +13,12 @@
|
|||
# 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=8.9.0
|
||||
APP_VERSION_CODE=2751
|
||||
APP_VERSION_NAME=8.9.2
|
||||
APP_VERSION_CODE=2756
|
||||
APP_PACKAGE=org.telegram.messenger
|
||||
RELEASE_KEY_PASSWORD=android
|
||||
RELEASE_KEY_ALIAS=androidkey
|
||||
RELEASE_STORE_PASSWORD=android
|
||||
RELEASE_KEY_PASSWORD=TelegramAndroidPswd
|
||||
RELEASE_KEY_ALIAS=tmessages
|
||||
RELEASE_STORE_PASSWORD=TelegramAndroidPswd
|
||||
org.gradle.jvmargs=-Xmx4096M -XX:MaxPermSize=4096m
|
||||
org.gradle.daemon=true
|
||||
org.gradle.parallel=true
|
||||
|
|
Loading…
Reference in New Issue