Update to 8.5.1
|
@ -300,7 +300,7 @@ android {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
defaultConfig.versionCode = 2551
|
defaultConfig.versionCode = 2563
|
||||||
|
|
||||||
applicationVariants.all { variant ->
|
applicationVariants.all { variant ->
|
||||||
variant.outputs.all { output ->
|
variant.outputs.all { output ->
|
||||||
|
@ -319,7 +319,7 @@ android {
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
minSdkVersion 16
|
minSdkVersion 16
|
||||||
targetSdkVersion 30
|
targetSdkVersion 30
|
||||||
versionName "8.5.1"
|
versionName "8.5.2"
|
||||||
|
|
||||||
vectorDrawables.generatedDensities = ['mdpi', 'hdpi', 'xhdpi', 'xxhdpi']
|
vectorDrawables.generatedDensities = ['mdpi', 'hdpi', 'xhdpi', 'xxhdpi']
|
||||||
|
|
||||||
|
|
|
@ -1179,9 +1179,9 @@ static inline void writeFrameToBitmap(JNIEnv *env, VideoInfo *info, jintArray da
|
||||||
void *pixels;
|
void *pixels;
|
||||||
if (AndroidBitmap_lockPixels(env, bitmap, &pixels) >= 0) {
|
if (AndroidBitmap_lockPixels(env, bitmap, &pixels) >= 0) {
|
||||||
if (info->sws_ctx == nullptr) {
|
if (info->sws_ctx == nullptr) {
|
||||||
if (info->frame->format > AV_PIX_FMT_NONE && info->frame->format < AV_PIX_FMT_NB && !info->frame->format == AV_PIX_FMT_YUVA420P) {
|
if (info->frame->format > AV_PIX_FMT_NONE && info->frame->format < AV_PIX_FMT_NB && info->frame->format != AV_PIX_FMT_YUVA420P) {
|
||||||
info->sws_ctx = sws_getContext(info->frame->width, info->frame->height, (AVPixelFormat) info->frame->format, bitmapWidth, bitmapHeight, AV_PIX_FMT_RGBA, SWS_BILINEAR, NULL, NULL, NULL);
|
info->sws_ctx = sws_getContext(info->frame->width, info->frame->height, (AVPixelFormat) info->frame->format, bitmapWidth, bitmapHeight, AV_PIX_FMT_RGBA, SWS_BILINEAR, NULL, NULL, NULL);
|
||||||
} else if (info->video_dec_ctx->pix_fmt > AV_PIX_FMT_NONE && info->video_dec_ctx->pix_fmt < AV_PIX_FMT_NB && !info->frame->format == AV_PIX_FMT_YUVA420P) {
|
} else if (info->video_dec_ctx->pix_fmt > AV_PIX_FMT_NONE && info->video_dec_ctx->pix_fmt < AV_PIX_FMT_NB && info->frame->format != AV_PIX_FMT_YUVA420P) {
|
||||||
info->sws_ctx = sws_getContext(info->video_dec_ctx->width, info->video_dec_ctx->height, info->video_dec_ctx->pix_fmt, bitmapWidth, bitmapHeight, AV_PIX_FMT_RGBA, SWS_BILINEAR, NULL, NULL, NULL);
|
info->sws_ctx = sws_getContext(info->video_dec_ctx->width, info->video_dec_ctx->height, info->video_dec_ctx->pix_fmt, bitmapWidth, bitmapHeight, AV_PIX_FMT_RGBA, SWS_BILINEAR, NULL, NULL, NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1203,8 +1203,7 @@ static inline void writeFrameToBitmap(JNIEnv *env, VideoInfo *info, jintArray da
|
||||||
uint8_t __attribute__ ((aligned (16))) *dst_data[1];
|
uint8_t __attribute__ ((aligned (16))) *dst_data[1];
|
||||||
dst_data[0] = (uint8_t *) pixels;
|
dst_data[0] = (uint8_t *) pixels;
|
||||||
info->dst_linesize[0] = stride;
|
info->dst_linesize[0] = stride;
|
||||||
sws_scale(info->sws_ctx, info->frame->data, info->frame->linesize, 0,
|
sws_scale(info->sws_ctx, info->frame->data, info->frame->linesize, 0, info->frame->height, dst_data, info->dst_linesize);
|
||||||
info->frame->height, dst_data, info->dst_linesize);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
AndroidBitmap_unlockPixels(env, bitmap);
|
AndroidBitmap_unlockPixels(env, bitmap);
|
||||||
|
|
|
@ -740,7 +740,7 @@ public class AndroidUtilities {
|
||||||
writer.flush();
|
writer.flush();
|
||||||
writer.close();
|
writer.close();
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
FileLog.e(e);
|
FileLog.e(e, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -77,7 +77,7 @@ public class AnimatedFileDrawableStream implements FileLoadOperationStream {
|
||||||
}
|
}
|
||||||
lastOffset = offset + availableLength;
|
lastOffset = offset + availableLength;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
FileLog.e(e);
|
FileLog.e(e, false);
|
||||||
}
|
}
|
||||||
return availableLength;
|
return availableLength;
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,13 +21,19 @@ import android.content.SharedPreferences;
|
||||||
import android.content.pm.ApplicationInfo;
|
import android.content.pm.ApplicationInfo;
|
||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
import android.net.ConnectivityManager;
|
import android.net.ConnectivityManager;
|
||||||
|
import android.net.Network;
|
||||||
|
import android.net.NetworkCapabilities;
|
||||||
import android.net.NetworkInfo;
|
import android.net.NetworkInfo;
|
||||||
|
import android.os.Build;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.PowerManager;
|
import android.os.PowerManager;
|
||||||
import android.os.SystemClock;
|
import android.os.SystemClock;
|
||||||
import android.telephony.TelephonyManager;
|
import android.telephony.TelephonyManager;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.multidex.MultiDex;
|
||||||
|
|
||||||
import com.google.android.gms.common.ConnectionResult;
|
import com.google.android.gms.common.ConnectionResult;
|
||||||
import com.google.android.gms.common.GooglePlayServicesUtil;
|
import com.google.android.gms.common.GooglePlayServicesUtil;
|
||||||
import com.google.firebase.messaging.FirebaseMessaging;
|
import com.google.firebase.messaging.FirebaseMessaging;
|
||||||
|
@ -39,8 +45,6 @@ import org.telegram.ui.Components.ForegroundDetector;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
import androidx.multidex.MultiDex;
|
|
||||||
|
|
||||||
public class ApplicationLoader extends Application {
|
public class ApplicationLoader extends Application {
|
||||||
|
|
||||||
@SuppressLint("StaticFieldLeak")
|
@SuppressLint("StaticFieldLeak")
|
||||||
|
@ -50,6 +54,8 @@ public class ApplicationLoader extends Application {
|
||||||
|
|
||||||
private static ConnectivityManager connectivityManager;
|
private static ConnectivityManager connectivityManager;
|
||||||
private static volatile boolean applicationInited = false;
|
private static volatile boolean applicationInited = false;
|
||||||
|
private static long lastNetworkCheckTypeTime;
|
||||||
|
private static int lastKnownNetworkType = -1;
|
||||||
|
|
||||||
public static long startTime;
|
public static long startTime;
|
||||||
|
|
||||||
|
@ -312,6 +318,20 @@ public class ApplicationLoader extends Application {
|
||||||
connectivityManager = (ConnectivityManager) ApplicationLoader.applicationContext.getSystemService(Context.CONNECTIVITY_SERVICE);
|
connectivityManager = (ConnectivityManager) ApplicationLoader.applicationContext.getSystemService(Context.CONNECTIVITY_SERVICE);
|
||||||
}
|
}
|
||||||
currentNetworkInfo = connectivityManager.getActiveNetworkInfo();
|
currentNetworkInfo = connectivityManager.getActiveNetworkInfo();
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||||
|
connectivityManager.registerDefaultNetworkCallback(new ConnectivityManager.NetworkCallback() {
|
||||||
|
@Override
|
||||||
|
public void onAvailable(@NonNull Network network) {
|
||||||
|
lastKnownNetworkType = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCapabilitiesChanged(@NonNull Network network, @NonNull NetworkCapabilities networkCapabilities) {
|
||||||
|
super.onCapabilitiesChanged(network, networkCapabilities);
|
||||||
|
lastKnownNetworkType = -1;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
} catch (Throwable ignore) {
|
} catch (Throwable ignore) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -381,11 +401,16 @@ public class ApplicationLoader extends Application {
|
||||||
return StatsController.TYPE_MOBILE;
|
return StatsController.TYPE_MOBILE;
|
||||||
}
|
}
|
||||||
if (currentNetworkInfo.getType() == ConnectivityManager.TYPE_WIFI || currentNetworkInfo.getType() == ConnectivityManager.TYPE_ETHERNET) {
|
if (currentNetworkInfo.getType() == ConnectivityManager.TYPE_WIFI || currentNetworkInfo.getType() == ConnectivityManager.TYPE_ETHERNET) {
|
||||||
if (connectivityManager.isActiveNetworkMetered()) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N && (lastKnownNetworkType == StatsController.TYPE_MOBILE || lastKnownNetworkType == StatsController.TYPE_WIFI) && System.currentTimeMillis() - lastNetworkCheckTypeTime < 5000) {
|
||||||
return StatsController.TYPE_MOBILE;
|
return lastKnownNetworkType;
|
||||||
} else {
|
|
||||||
return StatsController.TYPE_WIFI;
|
|
||||||
}
|
}
|
||||||
|
if (connectivityManager.isActiveNetworkMetered()) {
|
||||||
|
lastKnownNetworkType = StatsController.TYPE_MOBILE;
|
||||||
|
} else {
|
||||||
|
lastKnownNetworkType = StatsController.TYPE_WIFI;
|
||||||
|
}
|
||||||
|
lastNetworkCheckTypeTime = System.currentTimeMillis();
|
||||||
|
return lastKnownNetworkType;
|
||||||
}
|
}
|
||||||
if (currentNetworkInfo.isRoaming()) {
|
if (currentNetworkInfo.isRoaming()) {
|
||||||
return StatsController.TYPE_ROAMING;
|
return StatsController.TYPE_ROAMING;
|
||||||
|
|
|
@ -20,8 +20,8 @@ public class BuildVars {
|
||||||
public static boolean USE_CLOUD_STRINGS = true;
|
public static boolean USE_CLOUD_STRINGS = true;
|
||||||
public static boolean CHECK_UPDATES = true;
|
public static boolean CHECK_UPDATES = true;
|
||||||
public static boolean NO_SCOPED_STORAGE = Build.VERSION.SDK_INT <= 29;
|
public static boolean NO_SCOPED_STORAGE = Build.VERSION.SDK_INT <= 29;
|
||||||
public static int BUILD_VERSION = 2551;
|
public static int BUILD_VERSION = 2563;
|
||||||
public static String BUILD_VERSION_STRING = "8.5.1";
|
public static String BUILD_VERSION_STRING = "8.5.2";
|
||||||
public static int APP_ID = 4;
|
public static int APP_ID = 4;
|
||||||
public static String APP_HASH = "014b35b6184100b085b0d0572f9b5103";
|
public static String APP_HASH = "014b35b6184100b085b0d0572f9b5103";
|
||||||
|
|
||||||
|
|
|
@ -1107,6 +1107,9 @@ public class FileLoader extends BaseController {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getDocumentFileName(TLRPC.Document document) {
|
public static String getDocumentFileName(TLRPC.Document document) {
|
||||||
|
if (document.file_name_fixed != null) {
|
||||||
|
return document.file_name_fixed;
|
||||||
|
}
|
||||||
String fileName = null;
|
String fileName = null;
|
||||||
if (document != null) {
|
if (document != null) {
|
||||||
if (document.file_name != null) {
|
if (document.file_name != null) {
|
||||||
|
|
|
@ -1074,6 +1074,7 @@ public class GcmPushListenerService extends FirebaseMessagingService {
|
||||||
messageOwner.from_scheduled = scheduled;
|
messageOwner.from_scheduled = scheduled;
|
||||||
|
|
||||||
MessageObject messageObject = new MessageObject(currentAccount, messageOwner, messageText, name, userName, localMessage, channel, supergroup, edited);
|
MessageObject messageObject = new MessageObject(currentAccount, messageOwner, messageText, name, userName, localMessage, channel, supergroup, edited);
|
||||||
|
messageObject.isReactionPush = loc_key.startsWith("REACT_") || loc_key.startsWith("CHAT_REACT_");
|
||||||
ArrayList<MessageObject> arrayList = new ArrayList<>();
|
ArrayList<MessageObject> arrayList = new ArrayList<>();
|
||||||
arrayList.add(messageObject);
|
arrayList.add(messageObject);
|
||||||
canRelease = false;
|
canRelease = false;
|
||||||
|
|
|
@ -51,6 +51,7 @@ import java.io.FileNotFoundException;
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
|
import java.io.InterruptedIOException;
|
||||||
import java.io.RandomAccessFile;
|
import java.io.RandomAccessFile;
|
||||||
import java.net.HttpURLConnection;
|
import java.net.HttpURLConnection;
|
||||||
import java.net.SocketException;
|
import java.net.SocketException;
|
||||||
|
@ -534,7 +535,7 @@ public class ImageLoader {
|
||||||
} else if (e instanceof FileNotFoundException) {
|
} else if (e instanceof FileNotFoundException) {
|
||||||
canRetry = false;
|
canRetry = false;
|
||||||
sentLogs = false;
|
sentLogs = false;
|
||||||
} else if (e instanceof InterruptedException) {
|
} else if (e instanceof InterruptedIOException) {
|
||||||
sentLogs = false;
|
sentLogs = false;
|
||||||
}
|
}
|
||||||
FileLog.e(e, sentLogs);
|
FileLog.e(e, sentLogs);
|
||||||
|
|
|
@ -418,6 +418,7 @@ public class ImageReceiver implements NotificationCenter.NotificationCenterDeleg
|
||||||
currentExt = ext;
|
currentExt = ext;
|
||||||
currentParentObject = null;
|
currentParentObject = null;
|
||||||
currentCacheType = 0;
|
currentCacheType = 0;
|
||||||
|
roundPaint.setShader(null);
|
||||||
staticThumbDrawable = thumb;
|
staticThumbDrawable = thumb;
|
||||||
currentAlpha = 1.0f;
|
currentAlpha = 1.0f;
|
||||||
previousAlpha = 1f;
|
previousAlpha = 1f;
|
||||||
|
@ -573,6 +574,7 @@ public class ImageReceiver implements NotificationCenter.NotificationCenterDeleg
|
||||||
mediaShader = null;
|
mediaShader = null;
|
||||||
legacyShader = null;
|
legacyShader = null;
|
||||||
legacyCanvas = null;
|
legacyCanvas = null;
|
||||||
|
roundPaint.setShader(null);
|
||||||
if (legacyBitmap != null) {
|
if (legacyBitmap != null) {
|
||||||
legacyBitmap.recycle();
|
legacyBitmap.recycle();
|
||||||
legacyBitmap = null;
|
legacyBitmap = null;
|
||||||
|
@ -721,6 +723,7 @@ public class ImageReceiver implements NotificationCenter.NotificationCenterDeleg
|
||||||
fileDrawable.setAllowDecodeSingleFrame(true);
|
fileDrawable.setAllowDecodeSingleFrame(true);
|
||||||
}
|
}
|
||||||
thumbShader = null;
|
thumbShader = null;
|
||||||
|
roundPaint.setShader(null);
|
||||||
staticThumbDrawable = bitmap;
|
staticThumbDrawable = bitmap;
|
||||||
updateDrawableRadius(bitmap);
|
updateDrawableRadius(bitmap);
|
||||||
currentMediaLocation = null;
|
currentMediaLocation = null;
|
||||||
|
@ -865,6 +868,7 @@ public class ImageReceiver implements NotificationCenter.NotificationCenterDeleg
|
||||||
if (staticThumbDrawable != null) {
|
if (staticThumbDrawable != null) {
|
||||||
staticThumbDrawable = null;
|
staticThumbDrawable = null;
|
||||||
thumbShader = null;
|
thumbShader = null;
|
||||||
|
roundPaint.setShader(null);
|
||||||
}
|
}
|
||||||
clearImage();
|
clearImage();
|
||||||
if (isPressed == 0) {
|
if (isPressed == 0) {
|
||||||
|
@ -1005,9 +1009,6 @@ public class ImageReceiver implements NotificationCenter.NotificationCenterDeleg
|
||||||
bitmapW = bitmapDrawable.getIntrinsicWidth();
|
bitmapW = bitmapDrawable.getIntrinsicWidth();
|
||||||
bitmapH = bitmapDrawable.getIntrinsicHeight();
|
bitmapH = bitmapDrawable.getIntrinsicHeight();
|
||||||
}
|
}
|
||||||
if (parentView != null) {
|
|
||||||
parentView.invalidate();
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
Bitmap bitmap = bitmapDrawable.getBitmap();
|
Bitmap bitmap = bitmapDrawable.getBitmap();
|
||||||
if (bitmap != null && bitmap.isRecycled()) {
|
if (bitmap != null && bitmap.isRecycled()) {
|
||||||
|
@ -2408,6 +2409,7 @@ public class ImageReceiver implements NotificationCenter.NotificationCenterDeleg
|
||||||
currentThumbKey = null;
|
currentThumbKey = null;
|
||||||
currentThumbDrawable = null;
|
currentThumbDrawable = null;
|
||||||
thumbShader = null;
|
thumbShader = null;
|
||||||
|
roundPaint.setShader(null);
|
||||||
staticThumbDrawable = new BitmapDrawable(null, thumb);
|
staticThumbDrawable = new BitmapDrawable(null, thumb);
|
||||||
crossfadeWithThumb = true;
|
crossfadeWithThumb = true;
|
||||||
currentAlpha = 0f;
|
currentAlpha = 0f;
|
||||||
|
|
|
@ -3694,6 +3694,7 @@ public class MediaController implements AudioManager.OnAudioFocusChangeListener,
|
||||||
}
|
}
|
||||||
if (sourceFile.exists()) {
|
if (sourceFile.exists()) {
|
||||||
saveFileInternal(isMusic ? 3 : 2, sourceFile, name);
|
saveFileInternal(isMusic ? 3 : 2, sourceFile, name);
|
||||||
|
copiedFiles++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -3744,6 +3745,7 @@ public class MediaController implements AudioManager.OnAudioFocusChangeListener,
|
||||||
}
|
}
|
||||||
if (sourceFile.exists()) {
|
if (sourceFile.exists()) {
|
||||||
copyFile(sourceFile, destFile, message.getMimeType());
|
copyFile(sourceFile, destFile, message.getMimeType());
|
||||||
|
copiedFiles++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3863,7 +3865,6 @@ public class MediaController implements AudioManager.OnAudioFocusChangeListener,
|
||||||
FileLog.e(e);
|
FileLog.e(e);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
copiedFiles++;
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
|
@ -98,6 +98,7 @@ public class MessageObject {
|
||||||
public long reactionsLastCheckTime;
|
public long reactionsLastCheckTime;
|
||||||
public String customName;
|
public String customName;
|
||||||
public boolean reactionsChanged;
|
public boolean reactionsChanged;
|
||||||
|
public boolean isReactionPush;
|
||||||
private int isRoundVideoCached;
|
private int isRoundVideoCached;
|
||||||
public long eventId;
|
public long eventId;
|
||||||
public int contentType;
|
public int contentType;
|
||||||
|
@ -5057,7 +5058,7 @@ public class MessageObject {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean canAutoplayAnimatedSticker(TLRPC.Document document) {
|
public static boolean canAutoplayAnimatedSticker(TLRPC.Document document) {
|
||||||
return isAnimatedStickerDocument(document, true) && SharedConfig.getDevicePerformanceClass() != SharedConfig.PERFORMANCE_CLASS_LOW;
|
return (isAnimatedStickerDocument(document, true) || isVideoStickerDocument(document)) && SharedConfig.getDevicePerformanceClass() != SharedConfig.PERFORMANCE_CLASS_LOW;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isMaskDocument(TLRPC.Document document) {
|
public static boolean isMaskDocument(TLRPC.Document document) {
|
||||||
|
@ -6318,7 +6319,7 @@ public class MessageObject {
|
||||||
return !isEditing() && !isSponsored() && isSent() && messageOwner.action == null;
|
return !isEditing() && !isSponsored() && isSent() && messageOwner.action == null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean selectReaction(String reaction, boolean fromDoubleTap) {
|
public boolean selectReaction(String reaction, boolean big, boolean fromDoubleTap) {
|
||||||
if (messageOwner.reactions == null) {
|
if (messageOwner.reactions == null) {
|
||||||
messageOwner.reactions = new TLRPC.TL_messageReactions();
|
messageOwner.reactions = new TLRPC.TL_messageReactions();
|
||||||
messageOwner.reactions.can_see_list = isFromGroup() || isFromUser();
|
messageOwner.reactions.can_see_list = isFromGroup() || isFromUser();
|
||||||
|
@ -6335,6 +6336,10 @@ public class MessageObject {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (choosenReaction != null && choosenReaction == newReaction && big) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if (choosenReaction != null && (choosenReaction == newReaction || fromDoubleTap)) {
|
if (choosenReaction != null && (choosenReaction == newReaction || fromDoubleTap)) {
|
||||||
choosenReaction.chosen = false;
|
choosenReaction.chosen = false;
|
||||||
choosenReaction.count--;
|
choosenReaction.count--;
|
||||||
|
|
|
@ -14004,7 +14004,7 @@ public class MessagesController extends BaseController implements NotificationCe
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkUnreadReactions(long dialogId, SparseBooleanArray unreadReactions) {
|
public void checkUnreadReactions(long dialogId, SparseBooleanArray unreadReactions) {
|
||||||
getMessagesStorage().getStorageQueue().postRunnable(() -> {
|
getMessagesStorage().getStorageQueue().postRunnable(() -> {
|
||||||
boolean needReload = false;
|
boolean needReload = false;
|
||||||
boolean changed = false;
|
boolean changed = false;
|
||||||
|
@ -14071,6 +14071,7 @@ public class MessagesController extends BaseController implements NotificationCe
|
||||||
AndroidUtilities.runOnUIThread(() -> {
|
AndroidUtilities.runOnUIThread(() -> {
|
||||||
TLRPC.Dialog dialog = dialogs_dict.get(dialogId);
|
TLRPC.Dialog dialog = dialogs_dict.get(dialogId);
|
||||||
if (dialog == null) {
|
if (dialog == null) {
|
||||||
|
getMessagesStorage().updateDialogUnreadReactions(dialogId, count, false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
dialog.unread_reactions_count = count;
|
dialog.unread_reactions_count = count;
|
||||||
|
@ -14084,6 +14085,7 @@ public class MessagesController extends BaseController implements NotificationCe
|
||||||
AndroidUtilities.runOnUIThread(() -> {
|
AndroidUtilities.runOnUIThread(() -> {
|
||||||
TLRPC.Dialog dialog = dialogs_dict.get(dialogId);
|
TLRPC.Dialog dialog = dialogs_dict.get(dialogId);
|
||||||
if (dialog == null) {
|
if (dialog == null) {
|
||||||
|
getMessagesStorage().updateDialogUnreadReactions(dialogId, finalNewUnreadCount, true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
dialog.unread_reactions_count += finalNewUnreadCount;
|
dialog.unread_reactions_count += finalNewUnreadCount;
|
||||||
|
|
|
@ -134,18 +134,38 @@ public class MessagesStorage extends BaseController {
|
||||||
state.dispose();
|
state.dispose();
|
||||||
data.reuse();
|
data.reuse();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
FileLog.e(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getMessagesStorage().getDatabase().executeFast("UPDATE reaction_mentions SET state = 0 WHERE uid = %d AND ");
|
|
||||||
} catch (SQLiteException e) {
|
} catch (SQLiteException e) {
|
||||||
e.printStackTrace();
|
FileLog.e(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void updateDialogUnreadReactions(long dialogId, int newUnreadCount, boolean increment) {
|
||||||
|
storageQueue.postRunnable(() -> {
|
||||||
|
try {
|
||||||
|
int oldUnreadRactions = 0;
|
||||||
|
if (increment) {
|
||||||
|
SQLiteCursor cursor = database.queryFinalized("SELECT unread_reactions FROM dialogs WHERE did = " + dialogId);
|
||||||
|
if (cursor.next()) {
|
||||||
|
oldUnreadRactions = Math.max(0, cursor.intValue(0));
|
||||||
|
}
|
||||||
|
cursor.dispose();
|
||||||
|
}
|
||||||
|
oldUnreadRactions += newUnreadCount;
|
||||||
|
SQLitePreparedStatement state = getMessagesStorage().getDatabase().executeFast("UPDATE dialogs SET unread_reactions = ? WHERE did = ?");
|
||||||
|
state.bindInteger(1, oldUnreadRactions);
|
||||||
|
state.bindLong(2, dialogId);
|
||||||
|
state.step();
|
||||||
|
state.dispose();
|
||||||
|
} catch (SQLiteException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
public interface IntCallback {
|
public interface IntCallback {
|
||||||
void run(int param);
|
void run(int param);
|
||||||
}
|
}
|
||||||
|
@ -194,7 +214,7 @@ public class MessagesStorage extends BaseController {
|
||||||
private CountDownLatch openSync = new CountDownLatch(1);
|
private CountDownLatch openSync = new CountDownLatch(1);
|
||||||
|
|
||||||
private static volatile MessagesStorage[] Instance = new MessagesStorage[UserConfig.MAX_ACCOUNT_COUNT];
|
private static volatile MessagesStorage[] Instance = new MessagesStorage[UserConfig.MAX_ACCOUNT_COUNT];
|
||||||
private final static int LAST_DB_VERSION = 89;
|
private final static int LAST_DB_VERSION = 90;
|
||||||
private boolean databaseMigrationInProgress;
|
private boolean databaseMigrationInProgress;
|
||||||
|
|
||||||
public static MessagesStorage getInstance(int num) {
|
public static MessagesStorage getInstance(int num) {
|
||||||
|
@ -438,7 +458,7 @@ public class MessagesStorage extends BaseController {
|
||||||
database.executeFast("INSERT INTO params VALUES(1, 0, 0, 0, 0, 0, 0, NULL)").stepThis().dispose();
|
database.executeFast("INSERT INTO params VALUES(1, 0, 0, 0, 0, 0, 0, NULL)").stepThis().dispose();
|
||||||
|
|
||||||
database.executeFast("CREATE TABLE media_v4(mid INTEGER, uid INTEGER, date INTEGER, type INTEGER, data BLOB, PRIMARY KEY(mid, uid, type))").stepThis().dispose();
|
database.executeFast("CREATE TABLE media_v4(mid INTEGER, uid INTEGER, date INTEGER, type INTEGER, data BLOB, PRIMARY KEY(mid, uid, type))").stepThis().dispose();
|
||||||
database.executeFast("CREATE INDEX IF NOT EXISTS uid_mid_type_date_idx_media_v3 ON media_v4(uid, mid, type, date);").stepThis().dispose();
|
database.executeFast("CREATE INDEX IF NOT EXISTS uid_mid_type_date_idx_media_v4 ON media_v4(uid, mid, type, date);").stepThis().dispose();
|
||||||
|
|
||||||
database.executeFast("CREATE TABLE bot_keyboard(uid INTEGER PRIMARY KEY, mid INTEGER, info BLOB)").stepThis().dispose();
|
database.executeFast("CREATE TABLE bot_keyboard(uid INTEGER PRIMARY KEY, mid INTEGER, info BLOB)").stepThis().dispose();
|
||||||
database.executeFast("CREATE INDEX IF NOT EXISTS bot_keyboard_idx_mid_v2 ON bot_keyboard(mid, uid);").stepThis().dispose();
|
database.executeFast("CREATE INDEX IF NOT EXISTS bot_keyboard_idx_mid_v2 ON bot_keyboard(mid, uid);").stepThis().dispose();
|
||||||
|
@ -500,7 +520,9 @@ public class MessagesStorage extends BaseController {
|
||||||
database.executeFast("CREATE INDEX IF NOT EXISTS polls_id_v2 ON polls_v2(id);").stepThis().dispose();
|
database.executeFast("CREATE INDEX IF NOT EXISTS polls_id_v2 ON polls_v2(id);").stepThis().dispose();
|
||||||
|
|
||||||
database.executeFast("CREATE TABLE reactions(data BLOB, hash INTEGER, date INTEGER);").stepThis().dispose();
|
database.executeFast("CREATE TABLE reactions(data BLOB, hash INTEGER, date INTEGER);").stepThis().dispose();
|
||||||
database.executeFast("CREATE TABLE reaction_mentions(message_id INTEGER PRIMARY KEY, state INTEGER, dialog_id INTEGER);").stepThis().dispose();
|
database.executeFast("CREATE TABLE reaction_mentions(message_id INTEGER, state INTEGER, dialog_id INTEGER, PRIMARY KEY(message_id, dialog_id))").stepThis().dispose();
|
||||||
|
database.executeFast("CREATE INDEX IF NOT EXISTS reaction_mentions_did ON reaction_mentions(dialog_id);").stepThis().dispose();
|
||||||
|
|
||||||
//version
|
//version
|
||||||
database.executeFast("PRAGMA user_version = " + LAST_DB_VERSION).stepThis().dispose();
|
database.executeFast("PRAGMA user_version = " + LAST_DB_VERSION).stepThis().dispose();
|
||||||
} else {
|
} else {
|
||||||
|
@ -1641,11 +1663,18 @@ public class MessagesStorage extends BaseController {
|
||||||
version = 88;
|
version = 88;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (version == 88) {
|
if (version == 88 || version == 89) {
|
||||||
|
long time = System.currentTimeMillis();
|
||||||
database.executeFast("DROP TABLE IF EXISTS reaction_mentions;").stepThis().dispose();
|
database.executeFast("DROP TABLE IF EXISTS reaction_mentions;").stepThis().dispose();
|
||||||
database.executeFast("CREATE TABLE reaction_mentions(message_id INTEGER PRIMARY KEY, state INTEGER, dialog_id INTEGER);").stepThis().dispose();
|
database.executeFast("CREATE TABLE IF NOT EXISTS reaction_mentions(message_id INTEGER, state INTEGER, dialog_id INTEGER, PRIMARY KEY(dialog_id, message_id));").stepThis().dispose();
|
||||||
database.executeFast("PRAGMA user_version = 89").stepThis().dispose();
|
database.executeFast("CREATE INDEX IF NOT EXISTS reaction_mentions_did ON reaction_mentions(dialog_id);").stepThis().dispose();
|
||||||
version = 89;
|
|
||||||
|
database.executeFast("DROP INDEX IF EXISTS uid_mid_type_date_idx_media_v3").stepThis().dispose();
|
||||||
|
database.executeFast("CREATE INDEX IF NOT EXISTS uid_mid_type_date_idx_media_v4 ON media_v4(uid, mid, type, date);").stepThis().dispose();
|
||||||
|
|
||||||
|
database.executeFast("PRAGMA user_version = 90").stepThis().dispose();
|
||||||
|
|
||||||
|
version = 90;
|
||||||
}
|
}
|
||||||
|
|
||||||
FileLog.d("MessagesStorage db migration finished");
|
FileLog.d("MessagesStorage db migration finished");
|
||||||
|
@ -10279,6 +10308,7 @@ public class MessagesStorage extends BaseController {
|
||||||
state.dispose();
|
state.dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
long time = System.currentTimeMillis();
|
||||||
database.executeFast(String.format(Locale.US, "DELETE FROM media_v4 WHERE mid IN(%s) AND uid = %d", ids, did)).stepThis().dispose();
|
database.executeFast(String.format(Locale.US, "DELETE FROM media_v4 WHERE mid IN(%s) AND uid = %d", ids, did)).stepThis().dispose();
|
||||||
}
|
}
|
||||||
database.executeFast(String.format(Locale.US, "DELETE FROM messages_seq WHERE mid IN(%s)", ids)).stepThis().dispose();
|
database.executeFast(String.format(Locale.US, "DELETE FROM messages_seq WHERE mid IN(%s)", ids)).stepThis().dispose();
|
||||||
|
|
|
@ -55,6 +55,7 @@ import androidx.core.content.pm.ShortcutManagerCompat;
|
||||||
import androidx.core.graphics.drawable.IconCompat;
|
import androidx.core.graphics.drawable.IconCompat;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.util.SparseArray;
|
import android.util.SparseArray;
|
||||||
|
import android.util.SparseBooleanArray;
|
||||||
|
|
||||||
import org.telegram.messenger.support.LongSparseIntArray;
|
import org.telegram.messenger.support.LongSparseIntArray;
|
||||||
import org.telegram.tgnet.ConnectionsManager;
|
import org.telegram.tgnet.ConnectionsManager;
|
||||||
|
@ -675,6 +676,9 @@ public class NotificationsController extends BaseController {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
MessageObject oldMessage = sparseArray.get(messageObject.getId());
|
MessageObject oldMessage = sparseArray.get(messageObject.getId());
|
||||||
|
if (oldMessage != null && oldMessage.isReactionPush) {
|
||||||
|
oldMessage = null;
|
||||||
|
}
|
||||||
if (oldMessage != null) {
|
if (oldMessage != null) {
|
||||||
updated = true;
|
updated = true;
|
||||||
sparseArray.put(messageObject.getId(), messageObject);
|
sparseArray.put(messageObject.getId(), messageObject);
|
||||||
|
@ -831,6 +835,11 @@ public class NotificationsController extends BaseController {
|
||||||
pushDialogsOverrideMention.put(originalDialogId, current == null ? 1 : current + 1);
|
pushDialogsOverrideMention.put(originalDialogId, current == null ? 1 : current + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (messageObject.isReactionPush) {
|
||||||
|
SparseBooleanArray sparseBooleanArray = new SparseBooleanArray();
|
||||||
|
sparseBooleanArray.put(mid, true);
|
||||||
|
getMessagesController().checkUnreadReactions(dialogId, sparseBooleanArray);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (added) {
|
if (added) {
|
||||||
|
@ -873,9 +882,6 @@ public class NotificationsController extends BaseController {
|
||||||
boolean canAddValue;
|
boolean canAddValue;
|
||||||
if (notifyOverride == -1) {
|
if (notifyOverride == -1) {
|
||||||
canAddValue = isGlobalNotificationsEnabled(dialog_id, isChannel);
|
canAddValue = isGlobalNotificationsEnabled(dialog_id, isChannel);
|
||||||
/*if (BuildVars.DEBUG_PRIVATE_VERSION && BuildVars.LOGS_ENABLED) {
|
|
||||||
FileLog.d("global notify settings for " + dialog_id + " = " + canAddValue);
|
|
||||||
}*/
|
|
||||||
} else {
|
} else {
|
||||||
canAddValue = notifyOverride != 2;
|
canAddValue = notifyOverride != 2;
|
||||||
}
|
}
|
||||||
|
@ -3913,6 +3919,7 @@ public class NotificationsController extends BaseController {
|
||||||
arrayList.add(messageObject);
|
arrayList.add(messageObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
LongSparseArray<Integer> oldIdsWear = new LongSparseArray<>();
|
LongSparseArray<Integer> oldIdsWear = new LongSparseArray<>();
|
||||||
for (int i = 0; i < wearNotificationsIds.size(); i++) {
|
for (int i = 0; i < wearNotificationsIds.size(); i++) {
|
||||||
oldIdsWear.put(wearNotificationsIds.keyAt(i), wearNotificationsIds.valueAt(i));
|
oldIdsWear.put(wearNotificationsIds.keyAt(i), wearNotificationsIds.valueAt(i));
|
||||||
|
@ -3977,7 +3984,13 @@ public class NotificationsController extends BaseController {
|
||||||
}
|
}
|
||||||
|
|
||||||
MessageObject lastMessageObject = messageObjects.get(0);
|
MessageObject lastMessageObject = messageObjects.get(0);
|
||||||
int maxDate = lastMessageObject.messageOwner.date;
|
int maxDate = 0;
|
||||||
|
for (int i = 0; i < messageObjects.size(); i++) {
|
||||||
|
if (maxDate < messageObjects.get(i).messageOwner.date) {
|
||||||
|
maxDate = messageObjects.get(i).messageOwner.date;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
TLRPC.Chat chat = null;
|
TLRPC.Chat chat = null;
|
||||||
TLRPC.User user = null;
|
TLRPC.User user = null;
|
||||||
boolean isChannel = false;
|
boolean isChannel = false;
|
||||||
|
|
|
@ -94,7 +94,7 @@ public class SharedConfig {
|
||||||
public static boolean chatBubbles = Build.VERSION.SDK_INT >= 30;
|
public static boolean chatBubbles = Build.VERSION.SDK_INT >= 30;
|
||||||
public static boolean autoplayGifs = true;
|
public static boolean autoplayGifs = true;
|
||||||
public static boolean autoplayVideo = true;
|
public static boolean autoplayVideo = true;
|
||||||
public static boolean raiseToSpeak = true;
|
public static boolean raiseToSpeak = false;
|
||||||
public static boolean customTabs = true;
|
public static boolean customTabs = true;
|
||||||
public static boolean directShare = true;
|
public static boolean directShare = true;
|
||||||
public static boolean inappCamera = true;
|
public static boolean inappCamera = true;
|
||||||
|
@ -331,7 +331,7 @@ public class SharedConfig {
|
||||||
autoplayGifs = preferences.getBoolean("autoplay_gif", true);
|
autoplayGifs = preferences.getBoolean("autoplay_gif", true);
|
||||||
autoplayVideo = preferences.getBoolean("autoplay_video", true);
|
autoplayVideo = preferences.getBoolean("autoplay_video", true);
|
||||||
mapPreviewType = preferences.getInt("mapPreviewType", 2);
|
mapPreviewType = preferences.getInt("mapPreviewType", 2);
|
||||||
raiseToSpeak = preferences.getBoolean("raise_to_speak", true);
|
raiseToSpeak = preferences.getBoolean("raise_to_speak", false);
|
||||||
customTabs = preferences.getBoolean("custom_tabs", true);
|
customTabs = preferences.getBoolean("custom_tabs", true);
|
||||||
directShare = preferences.getBoolean("direct_share", true);
|
directShare = preferences.getBoolean("direct_share", true);
|
||||||
shuffleMusic = preferences.getBoolean("shuffleMusic", false);
|
shuffleMusic = preferences.getBoolean("shuffleMusic", false);
|
||||||
|
|
|
@ -172,10 +172,21 @@ public class Browser {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isTelegraphUrl(String url, boolean equals) {
|
public static boolean isTelegraphUrl(String url, boolean equals) {
|
||||||
|
return isTelegraphUrl(url, equals, false);
|
||||||
|
}
|
||||||
|
public static boolean isTelegraphUrl(String url, boolean equals, boolean forceHttps) {
|
||||||
if (equals) {
|
if (equals) {
|
||||||
return url.equals("telegra.ph") || url.equals("te.legra.ph") || url.equals("graph.org");
|
return url.equals("telegra.ph") || url.equals("te.legra.ph") || url.equals("graph.org");
|
||||||
}
|
}
|
||||||
return url.matches("^(https?://)?(te\\.?legra\\.ph|graph\\.org).*"); // telegra.ph, te.legra.ph, graph.org
|
return url.matches("^(https" + (forceHttps ? "" : "?") + "://)?(te\\.?legra\\.ph|graph\\.org).*"); // telegra.ph, te.legra.ph, graph.org
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean urlMustNotHaveConfirmation(String url) {
|
||||||
|
return (
|
||||||
|
isTelegraphUrl(url, false, true) ||
|
||||||
|
url.matches("^(https://)?t\\.me/iv\\??.*") || // t.me/iv?
|
||||||
|
url.matches("^(https://)?telegram\\.org/(blog|tour)/?.*") // telegram.org/blog, telegram.org/tour
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void openUrl(final Context context, Uri uri, final boolean allowCustom, boolean tryTelegraph) {
|
public static void openUrl(final Context context, Uri uri, final boolean allowCustom, boolean tryTelegraph) {
|
||||||
|
|
|
@ -12,6 +12,7 @@ import android.graphics.drawable.BitmapDrawable;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
|
|
||||||
|
import org.telegram.messenger.FileLoader;
|
||||||
import org.telegram.messenger.FileLog;
|
import org.telegram.messenger.FileLog;
|
||||||
import org.telegram.messenger.ImageLoader;
|
import org.telegram.messenger.ImageLoader;
|
||||||
import org.telegram.messenger.Utilities;
|
import org.telegram.messenger.Utilities;
|
||||||
|
@ -24200,6 +24201,7 @@ public class TLRPC {
|
||||||
public byte[] key;
|
public byte[] key;
|
||||||
public byte[] iv;
|
public byte[] iv;
|
||||||
public ArrayList<DocumentAttribute> attributes = new ArrayList<>();
|
public ArrayList<DocumentAttribute> attributes = new ArrayList<>();
|
||||||
|
public String file_name_fixed; //custom
|
||||||
|
|
||||||
public static Document TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) {
|
public static Document TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) {
|
||||||
Document result = null;
|
Document result = null;
|
||||||
|
@ -24237,6 +24239,7 @@ public class TLRPC {
|
||||||
}
|
}
|
||||||
if (result != null) {
|
if (result != null) {
|
||||||
result.readParams(stream, exception);
|
result.readParams(stream, exception);
|
||||||
|
result.file_name_fixed = FileLoader.getDocumentFileName(result);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,8 +14,6 @@ import android.widget.TextView;
|
||||||
|
|
||||||
import org.telegram.messenger.AndroidUtilities;
|
import org.telegram.messenger.AndroidUtilities;
|
||||||
import org.telegram.messenger.LocaleController;
|
import org.telegram.messenger.LocaleController;
|
||||||
import org.telegram.messenger.R;
|
|
||||||
import org.telegram.ui.Components.CheckBox;
|
|
||||||
import org.telegram.ui.Components.CheckBox2;
|
import org.telegram.ui.Components.CheckBox2;
|
||||||
import org.telegram.ui.Components.LayoutHelper;
|
import org.telegram.ui.Components.LayoutHelper;
|
||||||
|
|
||||||
|
@ -128,6 +126,7 @@ public class ActionBarMenuSubItem extends FrameLayout {
|
||||||
textView.setLines(2);
|
textView.setLines(2);
|
||||||
textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14);
|
textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14);
|
||||||
textView.setSingleLine(false);
|
textView.setSingleLine(false);
|
||||||
|
textView.setGravity(Gravity.CENTER_VERTICAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTextAndIcon(CharSequence text, int icon, Drawable iconDrawable) {
|
public void setTextAndIcon(CharSequence text, int icon, Drawable iconDrawable) {
|
||||||
|
|
|
@ -868,6 +868,9 @@ public class AlertDialog extends Dialog implements Drawable.Callback {
|
||||||
if (dimEnabled) {
|
if (dimEnabled) {
|
||||||
params.dimAmount = 0.6f;
|
params.dimAmount = 0.6f;
|
||||||
params.flags |= WindowManager.LayoutParams.FLAG_DIM_BEHIND;
|
params.flags |= WindowManager.LayoutParams.FLAG_DIM_BEHIND;
|
||||||
|
} else {
|
||||||
|
params.dimAmount = 0f;
|
||||||
|
params.flags ^= WindowManager.LayoutParams.FLAG_DIM_BEHIND;
|
||||||
}
|
}
|
||||||
|
|
||||||
lastScreenWidth = AndroidUtilities.displaySize.x;
|
lastScreenWidth = AndroidUtilities.displaySize.x;
|
||||||
|
|
|
@ -842,12 +842,7 @@ public final class FloatingToolbar {
|
||||||
if (menuItemButton instanceof LinearLayout) {
|
if (menuItemButton instanceof LinearLayout) {
|
||||||
((LinearLayout) menuItemButton).setGravity(Gravity.CENTER);
|
((LinearLayout) menuItemButton).setGravity(Gravity.CENTER);
|
||||||
}
|
}
|
||||||
if (isFirstItem) {
|
menuItemButton.setPaddingRelative((int) ((isFirstItem ? 1.5 : 1) * menuItemButton.getPaddingStart()), menuItemButton.getPaddingTop(), (int) ((isLastItem ? 1.5 : 1) * menuItemButton.getPaddingEnd()), menuItemButton.getPaddingBottom());
|
||||||
menuItemButton.setPaddingRelative((int) (1.5 * menuItemButton.getPaddingStart()), menuItemButton.getPaddingTop(), menuItemButton.getPaddingEnd(), menuItemButton.getPaddingBottom());
|
|
||||||
}
|
|
||||||
if (isLastItem) {
|
|
||||||
menuItemButton.setPaddingRelative(menuItemButton.getPaddingStart(), menuItemButton.getPaddingTop(), (int) (1.5 * menuItemButton.getPaddingEnd()), menuItemButton.getPaddingBottom());
|
|
||||||
}
|
|
||||||
menuItemButton.measure(MeasureSpec.UNSPECIFIED, MeasureSpec.UNSPECIFIED);
|
menuItemButton.measure(MeasureSpec.UNSPECIFIED, MeasureSpec.UNSPECIFIED);
|
||||||
final int menuItemButtonWidth = Math.min(menuItemButton.getMeasuredWidth(), toolbarWidth);
|
final int menuItemButtonWidth = Math.min(menuItemButton.getMeasuredWidth(), toolbarWidth);
|
||||||
final boolean canFitWithOverflow = menuItemButtonWidth <= availableWidth - mOverflowButtonSize.getWidth();
|
final boolean canFitWithOverflow = menuItemButtonWidth <= availableWidth - mOverflowButtonSize.getWidth();
|
||||||
|
@ -873,6 +868,10 @@ public final class FloatingToolbar {
|
||||||
return remainingMenuItems;
|
return remainingMenuItems;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void updateMainPanelItemsSelectors() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
private void layoutOverflowPanelItems(List<MenuItem> menuItems) {
|
private void layoutOverflowPanelItems(List<MenuItem> menuItems) {
|
||||||
ArrayAdapter<MenuItem> overflowPanelAdapter = (ArrayAdapter<MenuItem>) mOverflowPanel.getAdapter();
|
ArrayAdapter<MenuItem> overflowPanelAdapter = (ArrayAdapter<MenuItem>) mOverflowPanel.getAdapter();
|
||||||
|
@ -1216,8 +1215,8 @@ public final class FloatingToolbar {
|
||||||
} else if (currentStyle == STYLE_THEME) {
|
} else if (currentStyle == STYLE_THEME) {
|
||||||
textView.setTextColor(getThemedColor(Theme.key_windowBackgroundWhiteBlackText));
|
textView.setTextColor(getThemedColor(Theme.key_windowBackgroundWhiteBlackText));
|
||||||
}
|
}
|
||||||
if (first) {
|
if (first || last) {
|
||||||
menuItemButton.setBackgroundDrawable(Theme.createRadSelectorDrawable(selectorColor, first ? 6 : 0, 0, 0, first ? 6 : 0));
|
menuItemButton.setBackgroundDrawable(Theme.createRadSelectorDrawable(selectorColor, first ? 6 : 0, last ? 6 : 0, last ? 6 : 0, first ? 6 : 0));
|
||||||
} else {
|
} else {
|
||||||
menuItemButton.setBackgroundDrawable(Theme.getSelectorDrawable(selectorColor, false));
|
menuItemButton.setBackgroundDrawable(Theme.getSelectorDrawable(selectorColor, false));
|
||||||
}
|
}
|
||||||
|
|
|
@ -95,6 +95,7 @@ import org.telegram.ui.Components.ChatThemeBottomSheet;
|
||||||
import org.telegram.ui.Components.ChoosingStickerStatusDrawable;
|
import org.telegram.ui.Components.ChoosingStickerStatusDrawable;
|
||||||
import org.telegram.ui.Components.CombinedDrawable;
|
import org.telegram.ui.Components.CombinedDrawable;
|
||||||
import org.telegram.ui.Components.FragmentContextViewWavesDrawable;
|
import org.telegram.ui.Components.FragmentContextViewWavesDrawable;
|
||||||
|
import org.telegram.ui.Components.LinkPath;
|
||||||
import org.telegram.ui.Components.MotionBackgroundDrawable;
|
import org.telegram.ui.Components.MotionBackgroundDrawable;
|
||||||
import org.telegram.ui.Components.MsgClockDrawable;
|
import org.telegram.ui.Components.MsgClockDrawable;
|
||||||
import org.telegram.ui.Components.PathAnimator;
|
import org.telegram.ui.Components.PathAnimator;
|
||||||
|
@ -1517,9 +1518,129 @@ public class Theme {
|
||||||
if (backgroundRotation != 45) {
|
if (backgroundRotation != 45) {
|
||||||
currentColors.put(key_chat_wallpaper_gradient_rotation, backgroundRotation);
|
currentColors.put(key_chat_wallpaper_gradient_rotation, backgroundRotation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!isDarkTheme) {
|
||||||
|
int outBubble;
|
||||||
|
if (isDarkTheme) {
|
||||||
|
outBubble = averageColor(currentColors, key_chat_outBubbleGradient1, key_chat_outBubbleGradient2, key_chat_outBubbleGradient3);
|
||||||
|
} else if (currentColors.containsKey(key_chat_outBubble)) {
|
||||||
|
outBubble = currentColors.get(key_chat_outBubble);
|
||||||
|
} else {
|
||||||
|
outBubble = getColor(key_chat_outBubble);
|
||||||
|
}
|
||||||
|
int inBubbleSelected;
|
||||||
|
if (currentColors.containsKey(key_chat_inBubbleSelected)) {
|
||||||
|
inBubbleSelected = currentColors.get(key_chat_inBubbleSelected);
|
||||||
|
} else {
|
||||||
|
inBubbleSelected = getColor(key_chat_inBubbleSelected);
|
||||||
|
}
|
||||||
|
int gradientAverageColor = 0;
|
||||||
|
if (isDarkTheme) {
|
||||||
|
gradientAverageColor = outBubble;
|
||||||
|
}
|
||||||
|
if (gradientAverageColor == 0) {
|
||||||
|
gradientAverageColor = averageColor(currentColors, key_chat_wallpaper_gradient_to1, key_chat_wallpaper_gradient_to2, key_chat_wallpaper_gradient_to3);
|
||||||
|
}
|
||||||
|
if (gradientAverageColor == 0) {
|
||||||
|
gradientAverageColor = averageColor(currentColors, key_chat_wallpaper);
|
||||||
|
}
|
||||||
|
int selectedBackground = currentColors.containsKey(key_chat_selectedBackground) ? currentColors.get(key_chat_selectedBackground) : getColor(key_chat_selectedBackground);
|
||||||
|
selectedBackground = applyHue(selectedBackground, gradientAverageColor);
|
||||||
|
selectedBackground = darkenColor(selectedBackground, .1f);
|
||||||
|
selectedBackground = Color.argb((int) (Color.alpha(selectedBackground) * 0.8f), Color.red(selectedBackground), Color.green(selectedBackground), Color.blue(selectedBackground));
|
||||||
|
currentColors.put(key_chat_selectedBackground, selectedBackground);
|
||||||
|
int outBubbleOverlay = bubbleSelectedOverlay(outBubble);
|
||||||
|
currentColors.put(key_chat_outBubbleGradientSelectedOverlay, outBubbleOverlay);
|
||||||
|
|
||||||
|
inBubbleSelected = applyHue(inBubbleSelected, gradientAverageColor);
|
||||||
|
inBubbleSelected = shiftHSV(inBubbleSelected, 0, .04f, 0);
|
||||||
|
currentColors.put(key_chat_inBubbleSelected, inBubbleSelected);
|
||||||
|
|
||||||
|
final String[] inTextSelectedKeys = new String[] {
|
||||||
|
key_chat_inTimeSelectedText, key_chat_inAdminSelectedText, key_chat_inAudioDurationSelectedText,
|
||||||
|
key_chat_inAudioPerformerSelectedText, key_chat_inFileInfoSelectedText, key_chat_inContactPhoneSelectedText,
|
||||||
|
key_chat_inPreviewInstantSelectedText, key_chat_inVenueInfoSelectedText, key_chat_inReplyMediaMessageSelectedText
|
||||||
|
};
|
||||||
|
for (String inTextSelectedKey : inTextSelectedKeys) {
|
||||||
|
int color = currentColors.containsKey(inTextSelectedKey) ? currentColors.get(inTextSelectedKey) : getColor(inTextSelectedKey);
|
||||||
|
currentColors.put(inTextSelectedKey, applyHue(color, gradientAverageColor));
|
||||||
|
}
|
||||||
|
|
||||||
|
int outTimeSelected = currentColors.containsKey(key_chat_outTimeSelectedText) ? currentColors.get(key_chat_outTimeSelectedText) : getColor(key_chat_outTimeSelectedText);
|
||||||
|
double contrast = ColorUtils.calculateContrast(outTimeSelected, mix(outBubble, outBubbleOverlay));
|
||||||
|
currentColors.put(key_chat_outTimeSelectedText, shiftHSV(outTimeSelected, .02f, .01f, contrast < 1.9d ? -.1f : 0f));
|
||||||
|
// currentColors.put(key_chat_outTimeSelectedText, applyHue(outTimeSelected, gradientAverageColor));
|
||||||
|
}
|
||||||
|
|
||||||
return !isMyMessagesGradientColorsNear;
|
return !isMyMessagesGradientColorsNear;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private float[] tempHSV = new float[3];
|
||||||
|
private int bubbleSelectedOverlay(int bubble) {
|
||||||
|
Color.colorToHSV(bubble, tempHSV);
|
||||||
|
if (tempHSV[1] > 0) {
|
||||||
|
tempHSV[1] = Math.max(0, Math.min(1, tempHSV[1] + .6f));
|
||||||
|
tempHSV[2] = Math.max(0, Math.min(1, tempHSV[2] - .05f));
|
||||||
|
} else {
|
||||||
|
tempHSV[2] = Math.max(0, Math.min(1, tempHSV[2] - .6f));
|
||||||
|
}
|
||||||
|
return Color.HSVToColor(30, tempHSV);
|
||||||
|
}
|
||||||
|
private int applyHue(int base, int colorWithHue) {
|
||||||
|
Color.colorToHSV(colorWithHue, tempHSV);
|
||||||
|
float h = tempHSV[0];
|
||||||
|
Color.colorToHSV(base, tempHSV);
|
||||||
|
tempHSV[0] = h;
|
||||||
|
return Color.HSVToColor(Color.alpha(base), tempHSV);
|
||||||
|
}
|
||||||
|
private int shiftHSV(int color, float hue, float sat, float val) {
|
||||||
|
Color.colorToHSV(color, tempHSV);
|
||||||
|
tempHSV[0] += hue;
|
||||||
|
tempHSV[1] += sat;
|
||||||
|
tempHSV[2] += val;
|
||||||
|
return Color.HSVToColor(Color.alpha(color), tempHSV);
|
||||||
|
}
|
||||||
|
private int darkenColor(int color, float subtractValue) {
|
||||||
|
Color.colorToHSV(color, tempHSV);
|
||||||
|
tempHSV[2] = Math.max(0, Math.min(1, tempHSV[2] - subtractValue));
|
||||||
|
return Color.HSVToColor(Color.alpha(color), tempHSV);
|
||||||
|
}
|
||||||
|
private int mix(int y, int x) {
|
||||||
|
float ax = Color.alpha(x) / 255f,
|
||||||
|
ay = Color.alpha(y) / 255f,
|
||||||
|
az = (ax + ay * (1 - ax));
|
||||||
|
if (az == 0f)
|
||||||
|
return 0;
|
||||||
|
return Color.argb(
|
||||||
|
(int) (az * 255),
|
||||||
|
(int) ((Color.red(x) * ax + Color.red(y) * ay * (1 - ax)) / az),
|
||||||
|
(int) ((Color.green(x) * ax + Color.green(y) * ay * (1 - ax)) / az),
|
||||||
|
(int) ((Color.blue(x) * ax + Color.blue(y) * ay * (1 - ax)) / az)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
private int averageColor(HashMap<String, Integer> colors, int alpha, String ...keys) {
|
||||||
|
int r = 0, g = 0, b = 0, c = 0;
|
||||||
|
for (int i = 0; i < keys.length; ++i) {
|
||||||
|
if (!colors.containsKey(keys[i])) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
int color = colors.get(keys[i]);
|
||||||
|
r += Color.red(color);
|
||||||
|
g += Color.green(color);
|
||||||
|
b += Color.blue(color);
|
||||||
|
c++;
|
||||||
|
} catch (Exception ignore) {}
|
||||||
|
}
|
||||||
|
if (c == 0) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return Color.argb(alpha, r / c, g / c, b / c);
|
||||||
|
}
|
||||||
|
private int averageColor(HashMap<String, Integer> colors, String ...keys) {
|
||||||
|
return averageColor(colors, 255, keys);
|
||||||
|
}
|
||||||
|
|
||||||
public File getPathToWallpaper() {
|
public File getPathToWallpaper() {
|
||||||
if (id < 100) {
|
if (id < 100) {
|
||||||
return !TextUtils.isEmpty(patternSlug) ? new File(ApplicationLoader.getFilesDirFixed(), String.format(Locale.US, "%s_%d_%s_v5.jpg", parentTheme.getKey(), id, patternSlug)) : null;
|
return !TextUtils.isEmpty(patternSlug) ? new File(ApplicationLoader.getFilesDirFixed(), String.format(Locale.US, "%s_%d_%s_v5.jpg", parentTheme.getKey(), id, patternSlug)) : null;
|
||||||
|
@ -2375,6 +2496,9 @@ public class Theme {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
ThemeAccent accent = themeAccentsMap.get(currentAccentId);
|
ThemeAccent accent = themeAccentsMap.get(currentAccentId);
|
||||||
|
if (accent == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
if (createNew) {
|
if (createNew) {
|
||||||
int id = ++lastAccentId;
|
int id = ++lastAccentId;
|
||||||
ThemeAccent themeAccent = new ThemeAccent();
|
ThemeAccent themeAccent = new ThemeAccent();
|
||||||
|
@ -2663,6 +2787,7 @@ public class Theme {
|
||||||
public static Paint dialogs_errorPaint;
|
public static Paint dialogs_errorPaint;
|
||||||
public static Paint dialogs_countGrayPaint;
|
public static Paint dialogs_countGrayPaint;
|
||||||
public static Paint dialogs_actionMessagePaint;
|
public static Paint dialogs_actionMessagePaint;
|
||||||
|
public static Paint dialogs_reactionsCountPaint;
|
||||||
public static TextPaint[] dialogs_namePaint;
|
public static TextPaint[] dialogs_namePaint;
|
||||||
public static TextPaint[] dialogs_nameEncryptedPaint;
|
public static TextPaint[] dialogs_nameEncryptedPaint;
|
||||||
public static TextPaint dialogs_searchNamePaint;
|
public static TextPaint dialogs_searchNamePaint;
|
||||||
|
@ -2937,6 +3062,7 @@ public class Theme {
|
||||||
public static final String key_dialogEmptyImage = "dialogEmptyImage";
|
public static final String key_dialogEmptyImage = "dialogEmptyImage";
|
||||||
public static final String key_dialogEmptyText = "dialogEmptyText";
|
public static final String key_dialogEmptyText = "dialogEmptyText";
|
||||||
public static final String key_dialogSwipeRemove = "dialogSwipeRemove";
|
public static final String key_dialogSwipeRemove = "dialogSwipeRemove";
|
||||||
|
public static final String key_dialogReactionMentionBackground = "dialogReactionMentionBackground";
|
||||||
|
|
||||||
public static final String key_windowBackgroundWhite = "windowBackgroundWhite";
|
public static final String key_windowBackgroundWhite = "windowBackgroundWhite";
|
||||||
public static final String key_windowBackgroundUnchecked = "windowBackgroundUnchecked";
|
public static final String key_windowBackgroundUnchecked = "windowBackgroundUnchecked";
|
||||||
|
@ -3818,6 +3944,8 @@ public class Theme {
|
||||||
defaultColors.put(key_dialogEmptyImage, 0xff9fa4a8);
|
defaultColors.put(key_dialogEmptyImage, 0xff9fa4a8);
|
||||||
defaultColors.put(key_dialogEmptyText, 0xff8c9094);
|
defaultColors.put(key_dialogEmptyText, 0xff8c9094);
|
||||||
defaultColors.put(key_dialogSwipeRemove, 0xffe56555);
|
defaultColors.put(key_dialogSwipeRemove, 0xffe56555);
|
||||||
|
defaultColors.put(key_dialogSwipeRemove, 0xffe56555);
|
||||||
|
defaultColors.put(key_dialogReactionMentionBackground, 0xffF05459);
|
||||||
|
|
||||||
defaultColors.put(key_windowBackgroundWhite, 0xffffffff);
|
defaultColors.put(key_windowBackgroundWhite, 0xffffffff);
|
||||||
defaultColors.put(key_windowBackgroundUnchecked, 0xff9da7b1);
|
defaultColors.put(key_windowBackgroundUnchecked, 0xff9da7b1);
|
||||||
|
@ -4689,6 +4817,7 @@ public class Theme {
|
||||||
fallbackKeys.put(key_chat_outReactionButtonText, key_chat_outPreviewInstantText);
|
fallbackKeys.put(key_chat_outReactionButtonText, key_chat_outPreviewInstantText);
|
||||||
fallbackKeys.put(key_chat_inReactionButtonTextSelected, key_windowBackgroundWhite);
|
fallbackKeys.put(key_chat_inReactionButtonTextSelected, key_windowBackgroundWhite);
|
||||||
fallbackKeys.put(key_chat_outReactionButtonTextSelected, key_windowBackgroundWhite);
|
fallbackKeys.put(key_chat_outReactionButtonTextSelected, key_windowBackgroundWhite);
|
||||||
|
fallbackKeys.put(key_dialogReactionMentionBackground, key_voipgroup_mutedByAdminGradient2);
|
||||||
|
|
||||||
themeAccentExclusionKeys.addAll(Arrays.asList(keys_avatar_background));
|
themeAccentExclusionKeys.addAll(Arrays.asList(keys_avatar_background));
|
||||||
themeAccentExclusionKeys.addAll(Arrays.asList(keys_avatar_nameInMessage));
|
themeAccentExclusionKeys.addAll(Arrays.asList(keys_avatar_nameInMessage));
|
||||||
|
@ -7943,6 +8072,7 @@ public class Theme {
|
||||||
checkboxSquare_backgroundPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
|
checkboxSquare_backgroundPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
|
||||||
|
|
||||||
linkSelectionPaint = new Paint();
|
linkSelectionPaint = new Paint();
|
||||||
|
linkSelectionPaint.setPathEffect(LinkPath.roundedEffect);
|
||||||
|
|
||||||
Resources resources = context.getResources();
|
Resources resources = context.getResources();
|
||||||
|
|
||||||
|
@ -8057,9 +8187,8 @@ public class Theme {
|
||||||
if (dialogs_countTextPaint == null) {
|
if (dialogs_countTextPaint == null) {
|
||||||
dialogs_countTextPaint = new TextPaint(TextPaint.ANTI_ALIAS_FLAG);
|
dialogs_countTextPaint = new TextPaint(TextPaint.ANTI_ALIAS_FLAG);
|
||||||
dialogs_countTextPaint.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
|
dialogs_countTextPaint.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
|
||||||
|
|
||||||
dialogs_countPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
|
dialogs_countPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
|
||||||
|
dialogs_reactionsCountPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
|
||||||
dialogs_onlineCirclePaint = new Paint(Paint.ANTI_ALIAS_FLAG);
|
dialogs_onlineCirclePaint = new Paint(Paint.ANTI_ALIAS_FLAG);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8177,6 +8306,7 @@ public class Theme {
|
||||||
dialogs_archiveTextPaint.setColor(getColor(key_chats_archiveText));
|
dialogs_archiveTextPaint.setColor(getColor(key_chats_archiveText));
|
||||||
dialogs_archiveTextPaintSmall.setColor(getColor(key_chats_archiveText));
|
dialogs_archiveTextPaintSmall.setColor(getColor(key_chats_archiveText));
|
||||||
dialogs_countPaint.setColor(getColor(key_chats_unreadCounter));
|
dialogs_countPaint.setColor(getColor(key_chats_unreadCounter));
|
||||||
|
dialogs_reactionsCountPaint.setColor(getColor(key_dialogReactionMentionBackground));
|
||||||
dialogs_countGrayPaint.setColor(getColor(key_chats_unreadCounterMuted));
|
dialogs_countGrayPaint.setColor(getColor(key_chats_unreadCounterMuted));
|
||||||
dialogs_actionMessagePaint.setColor(getColor(key_chats_actionMessage));
|
dialogs_actionMessagePaint.setColor(getColor(key_chats_actionMessage));
|
||||||
dialogs_errorPaint.setColor(getColor(key_chats_sentError));
|
dialogs_errorPaint.setColor(getColor(key_chats_sentError));
|
||||||
|
@ -8264,7 +8394,9 @@ public class Theme {
|
||||||
chat_locationTitlePaint.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
|
chat_locationTitlePaint.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
|
||||||
chat_locationAddressPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG);
|
chat_locationAddressPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG);
|
||||||
chat_urlPaint = new Paint();
|
chat_urlPaint = new Paint();
|
||||||
|
chat_urlPaint.setPathEffect(LinkPath.roundedEffect);
|
||||||
chat_textSearchSelectionPaint = new Paint();
|
chat_textSearchSelectionPaint = new Paint();
|
||||||
|
chat_textSearchSelectionPaint.setPathEffect(LinkPath.roundedEffect);
|
||||||
chat_radialProgressPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
|
chat_radialProgressPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
|
||||||
chat_radialProgressPaint.setStrokeCap(Paint.Cap.ROUND);
|
chat_radialProgressPaint.setStrokeCap(Paint.Cap.ROUND);
|
||||||
chat_radialProgressPaint.setStyle(Paint.Style.STROKE);
|
chat_radialProgressPaint.setStyle(Paint.Style.STROKE);
|
||||||
|
|
|
@ -177,7 +177,7 @@ public class SearchAdapterHelper {
|
||||||
if (query.length() > 0) {
|
if (query.length() > 0) {
|
||||||
TLRPC.TL_contacts_search req = new TLRPC.TL_contacts_search();
|
TLRPC.TL_contacts_search req = new TLRPC.TL_contacts_search();
|
||||||
req.q = query;
|
req.q = query;
|
||||||
req.limit = 10;
|
req.limit = 20;
|
||||||
requests.add(new Pair<>(req, (response, error) -> {
|
requests.add(new Pair<>(req, (response, error) -> {
|
||||||
if (delegate.canApplySearchResults(searchId)) {
|
if (delegate.canApplySearchResults(searchId)) {
|
||||||
if (error == null) {
|
if (error == null) {
|
||||||
|
|
|
@ -401,7 +401,6 @@ public class ArticleViewer implements NotificationCenter.NotificationCenterDeleg
|
||||||
searchPath.setCurrentLayout(textLayout, result.index, 0);
|
searchPath.setCurrentLayout(textLayout, result.index, 0);
|
||||||
searchPath.setBaselineShift(0);
|
searchPath.setBaselineShift(0);
|
||||||
textLayout.getSelectionPath(result.index, result.index + searchText.length(), searchPath);
|
textLayout.getSelectionPath(result.index, result.index + searchText.length(), searchPath);
|
||||||
searchPath.onPathEnd();
|
|
||||||
searchPath.setAllowReset(true);
|
searchPath.setAllowReset(true);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -1147,13 +1146,16 @@ public class ArticleViewer implements NotificationCenter.NotificationCenterDeleg
|
||||||
float lightness = (0.2126f * Color.red(color2) + 0.7152f * Color.green(color2) + 0.0722f * Color.blue(color2)) / 255.0f;
|
float lightness = (0.2126f * Color.red(color2) + 0.7152f * Color.green(color2) + 0.0722f * Color.blue(color2)) / 255.0f;
|
||||||
webpageSearchPaint.setColor(lightness <= 0.705f ? 0xffd1982e : 0xffffe669);
|
webpageSearchPaint.setColor(lightness <= 0.705f ? 0xffd1982e : 0xffffe669);
|
||||||
webpageUrlPaint.setColor(Theme.getColor(Theme.key_windowBackgroundWhiteLinkSelection) & 0x33ffffff);
|
webpageUrlPaint.setColor(Theme.getColor(Theme.key_windowBackgroundWhiteLinkSelection) & 0x33ffffff);
|
||||||
|
webpageUrlPaint.setPathEffect(LinkPath.roundedEffect);
|
||||||
urlPaint.setColor(Theme.getColor(Theme.key_windowBackgroundWhiteLinkSelection) & 0x33ffffff);
|
urlPaint.setColor(Theme.getColor(Theme.key_windowBackgroundWhiteLinkSelection) & 0x33ffffff);
|
||||||
|
urlPaint.setPathEffect(LinkPath.roundedEffect);
|
||||||
tableHalfLinePaint.setColor(Theme.getColor(Theme.key_windowBackgroundWhiteInputField));
|
tableHalfLinePaint.setColor(Theme.getColor(Theme.key_windowBackgroundWhiteInputField));
|
||||||
tableLinePaint.setColor(Theme.getColor(Theme.key_windowBackgroundWhiteInputField));
|
tableLinePaint.setColor(Theme.getColor(Theme.key_windowBackgroundWhiteInputField));
|
||||||
|
|
||||||
photoBackgroundPaint.setColor(0x0f000000);
|
photoBackgroundPaint.setColor(0x0f000000);
|
||||||
dividerPaint.setColor(Theme.getColor(Theme.key_divider));
|
dividerPaint.setColor(Theme.getColor(Theme.key_divider));
|
||||||
webpageMarkPaint.setColor(Theme.getColor(Theme.key_windowBackgroundWhiteLinkSelection) & 0x33ffffff);
|
webpageMarkPaint.setColor(Theme.getColor(Theme.key_windowBackgroundWhiteLinkSelection) & 0x33ffffff);
|
||||||
|
webpageMarkPaint.setPathEffect(LinkPath.roundedEffect);
|
||||||
|
|
||||||
int color = Theme.getColor(Theme.key_switchTrack);
|
int color = Theme.getColor(Theme.key_switchTrack);
|
||||||
int r = Color.red(color);
|
int r = Color.red(color);
|
||||||
|
@ -2537,7 +2539,6 @@ public class ArticleViewer implements NotificationCenter.NotificationCenterDeleg
|
||||||
int shift = innerSpans[a].getTextPaint() != null ? innerSpans[a].getTextPaint().baselineShift : 0;
|
int shift = innerSpans[a].getTextPaint() != null ? innerSpans[a].getTextPaint().baselineShift : 0;
|
||||||
textPath.setBaselineShift(shift != 0 ? shift + AndroidUtilities.dp(shift > 0 ? 5 : -2) : 0);
|
textPath.setBaselineShift(shift != 0 ? shift + AndroidUtilities.dp(shift > 0 ? 5 : -2) : 0);
|
||||||
result.getSelectionPath(start, end, textPath);
|
result.getSelectionPath(start, end, textPath);
|
||||||
textPath.onPathEnd();
|
|
||||||
}
|
}
|
||||||
textPath.setAllowReset(true);
|
textPath.setAllowReset(true);
|
||||||
}
|
}
|
||||||
|
@ -2556,7 +2557,6 @@ public class ArticleViewer implements NotificationCenter.NotificationCenterDeleg
|
||||||
int shift = innerSpans[a].getTextPaint() != null ? innerSpans[a].getTextPaint().baselineShift : 0;
|
int shift = innerSpans[a].getTextPaint() != null ? innerSpans[a].getTextPaint().baselineShift : 0;
|
||||||
markPath.setBaselineShift(shift != 0 ? shift + AndroidUtilities.dp(shift > 0 ? 5 : -2) : 0);
|
markPath.setBaselineShift(shift != 0 ? shift + AndroidUtilities.dp(shift > 0 ? 5 : -2) : 0);
|
||||||
result.getSelectionPath(start, end, markPath);
|
result.getSelectionPath(start, end, markPath);
|
||||||
markPath.onPathEnd();
|
|
||||||
}
|
}
|
||||||
markPath.setAllowReset(true);
|
markPath.setAllowReset(true);
|
||||||
}
|
}
|
||||||
|
@ -2645,7 +2645,6 @@ public class ArticleViewer implements NotificationCenter.NotificationCenterDeleg
|
||||||
int shift = pressedLink.getTextPaint() != null ? pressedLink.getTextPaint().baselineShift : 0;
|
int shift = pressedLink.getTextPaint() != null ? pressedLink.getTextPaint().baselineShift : 0;
|
||||||
urlPath.setBaselineShift(shift != 0 ? shift + AndroidUtilities.dp(shift > 0 ? 5 : -2) : 0);
|
urlPath.setBaselineShift(shift != 0 ? shift + AndroidUtilities.dp(shift > 0 ? 5 : -2) : 0);
|
||||||
layout.getSelectionPath(pressedStart, pressedEnd, urlPath);
|
layout.getSelectionPath(pressedStart, pressedEnd, urlPath);
|
||||||
urlPath.onPathEnd();
|
|
||||||
parentView.invalidate();
|
parentView.invalidate();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
FileLog.e(e);
|
FileLog.e(e);
|
||||||
|
|
|
@ -390,7 +390,6 @@ public class CameraScanActivity extends BaseFragment implements Camera.PreviewCa
|
||||||
int shift = getText() != null ? getPaint().baselineShift : 0;
|
int shift = getText() != null ? getPaint().baselineShift : 0;
|
||||||
textPath.setBaselineShift(shift != 0 ? shift + AndroidUtilities.dp(shift > 0 ? 5 : -2) : 0);
|
textPath.setBaselineShift(shift != 0 ? shift + AndroidUtilities.dp(shift > 0 ? 5 : -2) : 0);
|
||||||
getLayout().getSelectionPath(start, end, textPath);
|
getLayout().getSelectionPath(start, end, textPath);
|
||||||
textPath.onPathEnd();
|
|
||||||
}
|
}
|
||||||
textPath.setAllowReset(true);
|
textPath.setAllowReset(true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -353,12 +353,16 @@ public class AboutLinkCell extends FrameLayout {
|
||||||
}
|
}
|
||||||
checkTextLayout(lastMaxWidth, true);
|
checkTextLayout(lastMaxWidth, true);
|
||||||
updateHeight();
|
updateHeight();
|
||||||
|
int wasValueVisibility = valueTextView.getVisibility();
|
||||||
if (TextUtils.isEmpty(value)) {
|
if (TextUtils.isEmpty(value)) {
|
||||||
valueTextView.setVisibility(GONE);
|
valueTextView.setVisibility(GONE);
|
||||||
} else {
|
} else {
|
||||||
valueTextView.setText(value);
|
valueTextView.setText(value);
|
||||||
valueTextView.setVisibility(VISIBLE);
|
valueTextView.setVisibility(VISIBLE);
|
||||||
}
|
}
|
||||||
|
if (wasValueVisibility != valueTextView.getVisibility()) {
|
||||||
|
checkTextLayout(lastMaxWidth, true);
|
||||||
|
}
|
||||||
requestLayout();
|
requestLayout();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -419,7 +423,6 @@ public class AboutLinkCell extends FrameLayout {
|
||||||
urlPathOffset.set(textX, textY);
|
urlPathOffset.set(textX, textY);
|
||||||
urlPath.setCurrentLayout(textLayout, start, 0);
|
urlPath.setCurrentLayout(textLayout, start, 0);
|
||||||
textLayout.getSelectionPath(start, buffer.getSpanEnd(pressedLink), urlPath);
|
textLayout.getSelectionPath(start, buffer.getSpanEnd(pressedLink), urlPath);
|
||||||
urlPath.onPathEnd();
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
FileLog.e(e);
|
FileLog.e(e);
|
||||||
}
|
}
|
||||||
|
@ -559,9 +562,12 @@ public class AboutLinkCell extends FrameLayout {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private int fromHeight() {
|
||||||
|
return Math.min(COLLAPSED_HEIGHT + (valueTextView.getVisibility() == View.VISIBLE ? AndroidUtilities.dp(20) : 0), textHeight());
|
||||||
|
}
|
||||||
private int updateHeight() {
|
private int updateHeight() {
|
||||||
int textHeight = textHeight();
|
int textHeight = textHeight();
|
||||||
float fromHeight = Math.min(COLLAPSED_HEIGHT, textHeight);
|
float fromHeight = fromHeight();
|
||||||
int height = shouldExpand ? (int) AndroidUtilities.lerp(fromHeight, textHeight, expandT) : textHeight;
|
int height = shouldExpand ? (int) AndroidUtilities.lerp(fromHeight, textHeight, expandT) : textHeight;
|
||||||
setHeight(height);
|
setHeight(height);
|
||||||
return height;
|
return height;
|
||||||
|
@ -618,7 +624,7 @@ public class AboutLinkCell extends FrameLayout {
|
||||||
private void checkTextLayout(int maxWidth, boolean force) {
|
private void checkTextLayout(int maxWidth, boolean force) {
|
||||||
if (stringBuilder != null && (maxWidth != lastMaxWidth || force)) {
|
if (stringBuilder != null && (maxWidth != lastMaxWidth || force)) {
|
||||||
textLayout = makeTextLayout(stringBuilder, maxWidth);
|
textLayout = makeTextLayout(stringBuilder, maxWidth);
|
||||||
shouldExpand = textLayout.getLineCount() >= 4 && valueTextView.getVisibility() != View.VISIBLE;
|
shouldExpand = textLayout.getLineCount() >= 4; // && valueTextView.getVisibility() != View.VISIBLE;
|
||||||
|
|
||||||
if (textLayout.getLineCount() >= 3 && shouldExpand) {
|
if (textLayout.getLineCount() >= 3 && shouldExpand) {
|
||||||
int end = Math.max(textLayout.getLineStart(2), textLayout.getLineEnd(2));
|
int end = Math.max(textLayout.getLineStart(2), textLayout.getLineEnd(2));
|
||||||
|
@ -658,8 +664,15 @@ public class AboutLinkCell extends FrameLayout {
|
||||||
|
|
||||||
container.setMinimumHeight(textHeight());
|
container.setMinimumHeight(textHeight());
|
||||||
|
|
||||||
if (shouldExpand) {
|
if (shouldExpand && firstThreeLinesLayout != null) {
|
||||||
setShowMoreMarginBottom(textHeight() - AndroidUtilities.dp(8) - textLayout.getLineBottom(textLayout.getLineCount() - 1) - showMoreTextBackgroundView.getPaddingBottom());
|
setShowMoreMarginBottom(
|
||||||
|
fromHeight()
|
||||||
|
-AndroidUtilities.dp(8)
|
||||||
|
-firstThreeLinesLayout.getLineBottom(firstThreeLinesLayout.getLineCount() - 1)
|
||||||
|
-showMoreTextBackgroundView.getPaddingBottom()
|
||||||
|
-showMoreTextView.getPaddingBottom()
|
||||||
|
-(showMoreTextView.getLayout() == null ? 0 : showMoreTextView.getLayout().getHeight() - showMoreTextView.getLayout().getLineBottom(showMoreTextView.getLineCount() - 1))
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
showMoreTextView.setVisibility(shouldExpand ? View.VISIBLE : View.GONE);
|
showMoreTextView.setVisibility(shouldExpand ? View.VISIBLE : View.GONE);
|
||||||
|
|
|
@ -151,7 +151,6 @@ public class BotHelpCell extends View {
|
||||||
int start = buffer.getSpanStart(pressedLink);
|
int start = buffer.getSpanStart(pressedLink);
|
||||||
urlPath.setCurrentLayout(textLayout, start, 0);
|
urlPath.setCurrentLayout(textLayout, start, 0);
|
||||||
textLayout.getSelectionPath(start, buffer.getSpanEnd(pressedLink), urlPath);
|
textLayout.getSelectionPath(start, buffer.getSpanEnd(pressedLink), urlPath);
|
||||||
urlPath.onPathEnd();
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
FileLog.e(e);
|
FileLog.e(e);
|
||||||
}
|
}
|
||||||
|
|
|
@ -179,10 +179,10 @@ public class ChatActionCell extends BaseCell implements DownloadController.FileD
|
||||||
} else {
|
} else {
|
||||||
newText = LocaleController.formatDateChat(date);
|
newText = LocaleController.formatDateChat(date);
|
||||||
}
|
}
|
||||||
|
customDate = date;
|
||||||
if (customText != null && TextUtils.equals(newText, customText)) {
|
if (customText != null && TextUtils.equals(newText, customText)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
customDate = date;
|
|
||||||
customText = newText;
|
customText = newText;
|
||||||
updateTextInternal(inLayout);
|
updateTextInternal(inLayout);
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,8 +69,6 @@ import android.widget.Toast;
|
||||||
|
|
||||||
import androidx.core.graphics.ColorUtils;
|
import androidx.core.graphics.ColorUtils;
|
||||||
|
|
||||||
import com.google.android.exoplayer2.util.Log;
|
|
||||||
|
|
||||||
import org.telegram.PhoneFormat.PhoneFormat;
|
import org.telegram.PhoneFormat.PhoneFormat;
|
||||||
import org.telegram.messenger.AndroidUtilities;
|
import org.telegram.messenger.AndroidUtilities;
|
||||||
import org.telegram.messenger.ChatObject;
|
import org.telegram.messenger.ChatObject;
|
||||||
|
@ -398,6 +396,10 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||||
}
|
}
|
||||||
|
|
||||||
default void invalidateBlur() { }
|
default void invalidateBlur() { }
|
||||||
|
|
||||||
|
default boolean canDrawOutboundsContent() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private final static int DOCUMENT_ATTACH_TYPE_NONE = 0;
|
private final static int DOCUMENT_ATTACH_TYPE_NONE = 0;
|
||||||
|
@ -1192,7 +1194,6 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||||
pos[1] -= block.charactersOffset;
|
pos[1] -= block.charactersOffset;
|
||||||
path.setCurrentLayout(block.textLayout, pos[0], 0);
|
path.setCurrentLayout(block.textLayout, pos[0], 0);
|
||||||
block.textLayout.getSelectionPath(pos[0], pos[1], path);
|
block.textLayout.getSelectionPath(pos[0], pos[1], path);
|
||||||
path.onPathEnd();
|
|
||||||
if (pos[1] >= block.charactersEnd) {
|
if (pos[1] >= block.charactersEnd) {
|
||||||
for (int a = blockNum + 1; a < currentMessageObject.textLayoutBlocks.size(); a++) {
|
for (int a = blockNum + 1; a < currentMessageObject.textLayoutBlocks.size(); a++) {
|
||||||
MessageObject.TextLayoutBlock nextBlock = currentMessageObject.textLayoutBlocks.get(a);
|
MessageObject.TextLayoutBlock nextBlock = currentMessageObject.textLayoutBlocks.get(a);
|
||||||
|
@ -1209,7 +1210,6 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||||
path.setCurrentLayout(nextBlock.textLayout, 0, nextBlock.textYOffset - block.textYOffset);
|
path.setCurrentLayout(nextBlock.textLayout, 0, nextBlock.textYOffset - block.textYOffset);
|
||||||
int p1 = pos[1] + block.charactersOffset - nextBlock.charactersOffset;
|
int p1 = pos[1] + block.charactersOffset - nextBlock.charactersOffset;
|
||||||
nextBlock.textLayout.getSelectionPath(0, p1, path);
|
nextBlock.textLayout.getSelectionPath(0, p1, path);
|
||||||
path.onPathEnd();
|
|
||||||
if (p1 < nextBlock.charactersEnd - 1) {
|
if (p1 < nextBlock.charactersEnd - 1) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1234,7 +1234,6 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||||
int p1 = pos[1] + block.charactersOffset - nextBlock.charactersOffset;
|
int p1 = pos[1] + block.charactersOffset - nextBlock.charactersOffset;
|
||||||
path.setCurrentLayout(nextBlock.textLayout, p0, offsetY);
|
path.setCurrentLayout(nextBlock.textLayout, p0, offsetY);
|
||||||
nextBlock.textLayout.getSelectionPath(p0, p1, path);
|
nextBlock.textLayout.getSelectionPath(p0, p1, path);
|
||||||
path.onPathEnd();
|
|
||||||
if (p0 > nextBlock.charactersOffset) {
|
if (p0 > nextBlock.charactersOffset) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1299,7 +1298,6 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||||
int[] pos = getRealSpanStartAndEnd(buffer, pressedLink);
|
int[] pos = getRealSpanStartAndEnd(buffer, pressedLink);
|
||||||
path.setCurrentLayout(captionLayout, pos[0], 0);
|
path.setCurrentLayout(captionLayout, pos[0], 0);
|
||||||
captionLayout.getSelectionPath(pos[0], pos[1], path);
|
captionLayout.getSelectionPath(pos[0], pos[1], path);
|
||||||
path.onPathEnd();
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
FileLog.e(e);
|
FileLog.e(e);
|
||||||
}
|
}
|
||||||
|
@ -1362,7 +1360,6 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||||
int[] pos = getRealSpanStartAndEnd(buffer, pressedLink);
|
int[] pos = getRealSpanStartAndEnd(buffer, pressedLink);
|
||||||
path.setCurrentLayout(descriptionLayout, pos[0], 0);
|
path.setCurrentLayout(descriptionLayout, pos[0], 0);
|
||||||
descriptionLayout.getSelectionPath(pos[0], pos[1], path);
|
descriptionLayout.getSelectionPath(pos[0], pos[1], path);
|
||||||
path.onPathEnd();
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
FileLog.e(e);
|
FileLog.e(e);
|
||||||
}
|
}
|
||||||
|
@ -1445,7 +1442,6 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||||
int[] pos = getRealSpanStartAndEnd(buffer, pressedLink);
|
int[] pos = getRealSpanStartAndEnd(buffer, pressedLink);
|
||||||
path.setCurrentLayout(descriptionLayout, pos[0], 0);
|
path.setCurrentLayout(descriptionLayout, pos[0], 0);
|
||||||
descriptionLayout.getSelectionPath(pos[0], pos[1], path);
|
descriptionLayout.getSelectionPath(pos[0], pos[1], path);
|
||||||
path.onPathEnd();
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
FileLog.e(e);
|
FileLog.e(e);
|
||||||
}
|
}
|
||||||
|
@ -2881,7 +2877,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||||
parentHeight = parentH;
|
parentHeight = parentH;
|
||||||
backgroundHeight = parentH;
|
backgroundHeight = parentH;
|
||||||
|
|
||||||
if (currentMessageObject != null && (hasGradientService() && currentMessageObject.shouldDrawWithoutBackground() || drawSideButton != 0 || !botButtons.isEmpty()) || currentBackgroundDrawable != null && currentBackgroundDrawable.getGradientShader() != null) {
|
if (currentMessageObject != null && (hasGradientService() && currentMessageObject.shouldDrawWithoutBackground()) || currentBackgroundDrawable != null && currentBackgroundDrawable.getGradientShader() != null) {
|
||||||
invalidate();
|
invalidate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2896,7 +2892,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||||
this.parentViewTopOffset = parentOffset;
|
this.parentViewTopOffset = parentOffset;
|
||||||
parentHeight = parent;
|
parentHeight = parent;
|
||||||
}
|
}
|
||||||
if (currentMessageObject != null && (hasGradientService() && currentMessageObject.shouldDrawWithoutBackground() || drawSideButton != 0 || !botButtons.isEmpty())) {
|
if (currentMessageObject != null && (hasGradientService() && currentMessageObject.shouldDrawWithoutBackground())) {
|
||||||
invalidate();
|
invalidate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4011,6 +4007,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||||
int duration;
|
int duration;
|
||||||
boolean smallImage;
|
boolean smallImage;
|
||||||
String type;
|
String type;
|
||||||
|
final int smallImageSide = AndroidUtilities.dp(48), smallSideMargin = AndroidUtilities.dp(10);
|
||||||
if (hasLinkPreview) {
|
if (hasLinkPreview) {
|
||||||
TLRPC.TL_webPage webPage = (TLRPC.TL_webPage) messageObject.messageOwner.media.webpage;
|
TLRPC.TL_webPage webPage = (TLRPC.TL_webPage) messageObject.messageOwner.media.webpage;
|
||||||
site_name = webPage.site_name;
|
site_name = webPage.site_name;
|
||||||
|
@ -4036,9 +4033,10 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||||
boolean isSmallImageType = "app".equals(type) || "profile".equals(type) ||
|
boolean isSmallImageType = "app".equals(type) || "profile".equals(type) ||
|
||||||
"article".equals(type) || "telegram_bot".equals(type) ||
|
"article".equals(type) || "telegram_bot".equals(type) ||
|
||||||
"telegram_user".equals(type) || "telegram_channel".equals(type) ||
|
"telegram_user".equals(type) || "telegram_channel".equals(type) ||
|
||||||
"telegram_megagroup".equals(type) || "telegram_voicechat".equals(type);
|
"telegram_megagroup".equals(type) || "telegram_voicechat".equals(type) ||
|
||||||
|
"telegram_livestream".equals(type);
|
||||||
smallImage = !slideshow && (!drawInstantView || drawInstantViewType == 1 || drawInstantViewType == 9 || drawInstantViewType == 11 || drawInstantViewType == 13) && document == null && isSmallImageType;
|
smallImage = !slideshow && (!drawInstantView || drawInstantViewType == 1 || drawInstantViewType == 9 || drawInstantViewType == 11 || drawInstantViewType == 13) && document == null && isSmallImageType;
|
||||||
isSmallImage = smallImage && (drawInstantViewType == 13 || description != null) && type != null && currentMessageObject.photoThumbs != null;
|
isSmallImage = smallImage && type != null && currentMessageObject.photoThumbs != null;
|
||||||
} else if (hasInvoicePreview) {
|
} else if (hasInvoicePreview) {
|
||||||
TLRPC.TL_messageMediaInvoice invoice = (TLRPC.TL_messageMediaInvoice) messageObject.messageOwner.media;
|
TLRPC.TL_messageMediaInvoice invoice = (TLRPC.TL_messageMediaInvoice) messageObject.messageOwner.media;
|
||||||
site_name = messageObject.messageOwner.media.title;
|
site_name = messageObject.messageOwner.media.title;
|
||||||
|
@ -4091,17 +4089,37 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||||
if (site_name != null) {
|
if (site_name != null) {
|
||||||
try {
|
try {
|
||||||
int width = (int) Math.ceil(Theme.chat_replyNamePaint.measureText(site_name) + 1);
|
int width = (int) Math.ceil(Theme.chat_replyNamePaint.measureText(site_name) + 1);
|
||||||
if (!isSmallImage || description == null) {
|
int restLines = 0;
|
||||||
|
if (!isSmallImage) {
|
||||||
siteNameLayout = new StaticLayout(site_name, Theme.chat_replyNamePaint, Math.min(width, linkPreviewMaxWidth), Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false);
|
siteNameLayout = new StaticLayout(site_name, Theme.chat_replyNamePaint, Math.min(width, linkPreviewMaxWidth), Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false);
|
||||||
} else {
|
} else {
|
||||||
siteNameLayout = generateStaticLayout(site_name, Theme.chat_replyNamePaint, linkPreviewMaxWidth, linkPreviewMaxWidth - AndroidUtilities.dp(48 + 4), restLinesCount, 1);
|
restLines = restLinesCount;
|
||||||
|
siteNameLayout = generateStaticLayout(site_name, Theme.chat_replyNamePaint, linkPreviewMaxWidth, linkPreviewMaxWidth - smallImageSide - smallSideMargin, restLinesCount, 1);
|
||||||
restLinesCount -= siteNameLayout.getLineCount();
|
restLinesCount -= siteNameLayout.getLineCount();
|
||||||
}
|
}
|
||||||
siteNameRtl = Math.max(siteNameLayout.getLineLeft(0), 0) != 0;
|
siteNameRtl = Math.max(siteNameLayout.getLineLeft(0), 0) != 0;
|
||||||
int height = siteNameLayout.getLineBottom(siteNameLayout.getLineCount() - 1);
|
int height = siteNameLayout.getLineBottom(siteNameLayout.getLineCount() - 1);
|
||||||
linkPreviewHeight += height;
|
linkPreviewHeight += height;
|
||||||
totalHeight += height;
|
totalHeight += height;
|
||||||
siteNameWidth = width = siteNameLayout.getWidth();
|
int layoutWidth = 0;
|
||||||
|
for (int a = 0; a < siteNameLayout.getLineCount(); ++a) {
|
||||||
|
int lineLeft = (int) Math.max(0, siteNameLayout.getLineLeft(a));
|
||||||
|
int lineWidth;
|
||||||
|
if (lineLeft != 0) {
|
||||||
|
lineWidth = siteNameLayout.getWidth() - lineLeft;
|
||||||
|
} else {
|
||||||
|
int max = linkPreviewMaxWidth;
|
||||||
|
if (a < restLines || lineLeft != 0 && isSmallImage) {
|
||||||
|
max -= smallImageSide + smallSideMargin;
|
||||||
|
}
|
||||||
|
lineWidth = (int) Math.min(max, Math.ceil(siteNameLayout.getLineWidth(a)));
|
||||||
|
}
|
||||||
|
if (a < restLines || lineLeft != 0 && isSmallImage) {
|
||||||
|
lineWidth += smallImageSide + smallSideMargin;
|
||||||
|
}
|
||||||
|
layoutWidth = Math.max(layoutWidth, lineWidth);
|
||||||
|
}
|
||||||
|
siteNameWidth = width = layoutWidth;
|
||||||
maxChildWidth = Math.max(maxChildWidth, width + additinalWidth);
|
maxChildWidth = Math.max(maxChildWidth, width + additinalWidth);
|
||||||
maxWebWidth = Math.max(maxWebWidth, width + additinalWidth);
|
maxWebWidth = Math.max(maxWebWidth, width + additinalWidth);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -4118,11 +4136,11 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||||
totalHeight += AndroidUtilities.dp(2);
|
totalHeight += AndroidUtilities.dp(2);
|
||||||
}
|
}
|
||||||
int restLines = 0;
|
int restLines = 0;
|
||||||
if (!isSmallImage || description == null) {
|
if (!isSmallImage) {
|
||||||
titleLayout = StaticLayoutEx.createStaticLayout(title, Theme.chat_replyNamePaint, linkPreviewMaxWidth, Layout.Alignment.ALIGN_NORMAL, 1.0f, AndroidUtilities.dp(1), false, TextUtils.TruncateAt.END, linkPreviewMaxWidth, 4);
|
titleLayout = StaticLayoutEx.createStaticLayout(title, Theme.chat_replyNamePaint, linkPreviewMaxWidth, Layout.Alignment.ALIGN_NORMAL, 1.0f, AndroidUtilities.dp(1), false, TextUtils.TruncateAt.END, linkPreviewMaxWidth, 4);
|
||||||
} else {
|
} else {
|
||||||
restLines = restLinesCount;
|
restLines = restLinesCount;
|
||||||
titleLayout = generateStaticLayout(title, Theme.chat_replyNamePaint, linkPreviewMaxWidth, linkPreviewMaxWidth - AndroidUtilities.dp(48 + 4), restLinesCount, 4);
|
titleLayout = generateStaticLayout(title, Theme.chat_replyNamePaint, linkPreviewMaxWidth, linkPreviewMaxWidth - smallImageSide - smallSideMargin, restLinesCount, 4);
|
||||||
restLinesCount -= titleLayout.getLineCount();
|
restLinesCount -= titleLayout.getLineCount();
|
||||||
}
|
}
|
||||||
int height = titleLayout.getLineBottom(titleLayout.getLineCount() - 1);
|
int height = titleLayout.getLineBottom(titleLayout.getLineCount() - 1);
|
||||||
|
@ -4144,12 +4162,12 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||||
} else {
|
} else {
|
||||||
int max = linkPreviewMaxWidth;
|
int max = linkPreviewMaxWidth;
|
||||||
if (a < restLines || lineLeft != 0 && isSmallImage) {
|
if (a < restLines || lineLeft != 0 && isSmallImage) {
|
||||||
max -= AndroidUtilities.dp(48 + 4);
|
max -= smallImageSide + smallSideMargin;
|
||||||
}
|
}
|
||||||
width = (int) Math.min(max, Math.ceil(titleLayout.getLineWidth(a)));
|
width = (int) Math.min(max, Math.ceil(titleLayout.getLineWidth(a)));
|
||||||
}
|
}
|
||||||
if (a < restLines || lineLeft != 0 && isSmallImage) {
|
if (a < restLines || lineLeft != 0 && isSmallImage) {
|
||||||
width += AndroidUtilities.dp(48 + 4);
|
width += smallImageSide + smallSideMargin;
|
||||||
}
|
}
|
||||||
maxChildWidth = Math.max(maxChildWidth, width + additinalWidth);
|
maxChildWidth = Math.max(maxChildWidth, width + additinalWidth);
|
||||||
maxWebWidth = Math.max(maxWebWidth, width + additinalWidth);
|
maxWebWidth = Math.max(maxWebWidth, width + additinalWidth);
|
||||||
|
@ -4172,7 +4190,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||||
if (restLinesCount == 3 && (!isSmallImage || description == null)) {
|
if (restLinesCount == 3 && (!isSmallImage || description == null)) {
|
||||||
authorLayout = new StaticLayout(author, Theme.chat_replyNamePaint, linkPreviewMaxWidth, Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false);
|
authorLayout = new StaticLayout(author, Theme.chat_replyNamePaint, linkPreviewMaxWidth, Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false);
|
||||||
} else {
|
} else {
|
||||||
authorLayout = generateStaticLayout(author, Theme.chat_replyNamePaint, linkPreviewMaxWidth, linkPreviewMaxWidth - AndroidUtilities.dp(48 + 4), restLinesCount, 1);
|
authorLayout = generateStaticLayout(author, Theme.chat_replyNamePaint, linkPreviewMaxWidth, linkPreviewMaxWidth - smallImageSide - smallSideMargin, restLinesCount, 1);
|
||||||
restLinesCount -= authorLayout.getLineCount();
|
restLinesCount -= authorLayout.getLineCount();
|
||||||
}
|
}
|
||||||
int height = authorLayout.getLineBottom(authorLayout.getLineCount() - 1);
|
int height = authorLayout.getLineBottom(authorLayout.getLineCount() - 1);
|
||||||
|
@ -4208,7 +4226,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||||
descriptionLayout = StaticLayoutEx.createStaticLayout(messageObject.linkDescription, Theme.chat_replyTextPaint, linkPreviewMaxWidth, Layout.Alignment.ALIGN_NORMAL, 1.0f, AndroidUtilities.dp(1), false, TextUtils.TruncateAt.END, linkPreviewMaxWidth, allowAllLines ? 100 : 6);
|
descriptionLayout = StaticLayoutEx.createStaticLayout(messageObject.linkDescription, Theme.chat_replyTextPaint, linkPreviewMaxWidth, Layout.Alignment.ALIGN_NORMAL, 1.0f, AndroidUtilities.dp(1), false, TextUtils.TruncateAt.END, linkPreviewMaxWidth, allowAllLines ? 100 : 6);
|
||||||
} else {
|
} else {
|
||||||
restLines = restLinesCount;
|
restLines = restLinesCount;
|
||||||
descriptionLayout = generateStaticLayout(messageObject.linkDescription, Theme.chat_replyTextPaint, linkPreviewMaxWidth, linkPreviewMaxWidth - AndroidUtilities.dp(48 + 4), restLinesCount, allowAllLines ? 100 : 6);
|
descriptionLayout = generateStaticLayout(messageObject.linkDescription, Theme.chat_replyTextPaint, linkPreviewMaxWidth, linkPreviewMaxWidth - smallImageSide - smallSideMargin, restLinesCount, allowAllLines ? 100 : 6);
|
||||||
}
|
}
|
||||||
int height = descriptionLayout.getLineBottom(descriptionLayout.getLineCount() - 1);
|
int height = descriptionLayout.getLineBottom(descriptionLayout.getLineCount() - 1);
|
||||||
linkPreviewHeight += height;
|
linkPreviewHeight += height;
|
||||||
|
@ -4245,7 +4263,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (a < restLines || restLines != 0 && lineLeft != 0 && isSmallImage) {
|
if (a < restLines || restLines != 0 && lineLeft != 0 && isSmallImage) {
|
||||||
width += AndroidUtilities.dp(48 + 4);
|
width += smallImageSide + smallSideMargin;
|
||||||
}
|
}
|
||||||
if (maxWebWidth < width + additinalWidth) {
|
if (maxWebWidth < width + additinalWidth) {
|
||||||
if (titleIsRTL) {
|
if (titleIsRTL) {
|
||||||
|
@ -4267,7 +4285,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||||
smallImage = false;
|
smallImage = false;
|
||||||
isSmallImage = false;
|
isSmallImage = false;
|
||||||
}
|
}
|
||||||
int maxPhotoWidth = smallImage ? AndroidUtilities.dp(48) : linkPreviewMaxWidth;
|
int maxPhotoWidth = smallImage ? smallImageSide : linkPreviewMaxWidth;
|
||||||
|
|
||||||
if (document != null) {
|
if (document != null) {
|
||||||
if (MessageObject.isRoundVideoDocument(document)) {
|
if (MessageObject.isRoundVideoDocument(document)) {
|
||||||
|
@ -4614,7 +4632,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||||
}
|
}
|
||||||
} else if (documentAttachType == DOCUMENT_ATTACH_TYPE_STICKER) {
|
} else if (documentAttachType == DOCUMENT_ATTACH_TYPE_STICKER) {
|
||||||
boolean isWebpSticker = messageObject.isSticker();
|
boolean isWebpSticker = messageObject.isSticker();
|
||||||
if (SharedConfig.loopStickers || isWebpSticker) {
|
if (SharedConfig.loopStickers || (isWebpSticker && !messageObject.isVideoSticker())) {
|
||||||
photoImage.setAutoRepeat(1);
|
photoImage.setAutoRepeat(1);
|
||||||
} else {
|
} else {
|
||||||
currentPhotoFilter = String.format(Locale.US, "%d_%d_nr_%s", w, h, messageObject.toString());
|
currentPhotoFilter = String.format(Locale.US, "%d_%d_nr_%s", w, h, messageObject.toString());
|
||||||
|
@ -5647,7 +5665,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||||
filter = String.format(Locale.US, "%d_%d_nr_%s" + messageObject.emojiAnimatedStickerColor, w, h, messageObject.toString());
|
filter = String.format(Locale.US, "%d_%d_nr_%s" + messageObject.emojiAnimatedStickerColor, w, h, messageObject.toString());
|
||||||
photoImage.setAutoRepeat(shouldRepeatSticker ? 2 : 3);
|
photoImage.setAutoRepeat(shouldRepeatSticker ? 2 : 3);
|
||||||
parentObject = MessageObject.getInputStickerSet(messageObject.emojiAnimatedSticker);
|
parentObject = MessageObject.getInputStickerSet(messageObject.emojiAnimatedSticker);
|
||||||
} else if (SharedConfig.loopStickers || isWebpSticker) {
|
} else if (SharedConfig.loopStickers || (isWebpSticker && !messageObject.isVideoSticker())) {
|
||||||
filter = String.format(Locale.US, "%d_%d", w, h);
|
filter = String.format(Locale.US, "%d_%d", w, h);
|
||||||
photoImage.setAutoRepeat(1);
|
photoImage.setAutoRepeat(1);
|
||||||
} else {
|
} else {
|
||||||
|
@ -5684,7 +5702,8 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||||
if (!reactionsLayoutInBubble.isSmall) {
|
if (!reactionsLayoutInBubble.isSmall) {
|
||||||
reactionsLayoutInBubble.measure(maxWidth);
|
reactionsLayoutInBubble.measure(maxWidth);
|
||||||
reactionsLayoutInBubble.drawServiceShaderBackground = true;
|
reactionsLayoutInBubble.drawServiceShaderBackground = true;
|
||||||
additionHeight += reactionsLayoutInBubble.height + AndroidUtilities.dp(8);
|
reactionsLayoutInBubble.totalHeight = reactionsLayoutInBubble.height + AndroidUtilities.dp(8);
|
||||||
|
additionHeight += reactionsLayoutInBubble.totalHeight;
|
||||||
reactionsLayoutInBubble.positionOffsetY += AndroidUtilities.dp(4);
|
reactionsLayoutInBubble.positionOffsetY += AndroidUtilities.dp(4);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -7140,11 +7159,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||||
|
|
||||||
if (drawPhotoImage) {
|
if (drawPhotoImage) {
|
||||||
currentPhotoObject = FileLoader.getClosestPhotoSizeWithSize(messageObject.photoThumbs, 320);
|
currentPhotoObject = FileLoader.getClosestPhotoSizeWithSize(messageObject.photoThumbs, 320);
|
||||||
if (currentMessageObject.strippedThumb == null) {
|
currentPhotoObjectThumb = FileLoader.getClosestPhotoSizeWithSize(messageObject.photoThumbs, 40);
|
||||||
currentPhotoObjectThumb = FileLoader.getClosestPhotoSizeWithSize(messageObject.photoThumbs, 40);
|
|
||||||
} else {
|
|
||||||
currentPhotoObjectThumbStripped = currentMessageObject.strippedThumb;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((DownloadController.getInstance(currentAccount).getAutodownloadMask() & DownloadController.AUTODOWNLOAD_TYPE_PHOTO) == 0) {
|
if ((DownloadController.getInstance(currentAccount).getAutodownloadMask() & DownloadController.AUTODOWNLOAD_TYPE_PHOTO) == 0) {
|
||||||
currentPhotoObject = null;
|
currentPhotoObject = null;
|
||||||
|
@ -7153,6 +7168,9 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||||
currentPhotoObject = null;
|
currentPhotoObject = null;
|
||||||
photoImage.setNeedsQualityThumb(true);
|
photoImage.setNeedsQualityThumb(true);
|
||||||
photoImage.setShouldGenerateQualityThumb(true);
|
photoImage.setShouldGenerateQualityThumb(true);
|
||||||
|
} else if (currentMessageObject.strippedThumb != null) {
|
||||||
|
currentPhotoObjectThumb = null;
|
||||||
|
currentPhotoObjectThumbStripped = currentMessageObject.strippedThumb;
|
||||||
}
|
}
|
||||||
currentPhotoFilter = "86_86_b";
|
currentPhotoFilter = "86_86_b";
|
||||||
photoImage.setImage(ImageLocation.getForObject(currentPhotoObject, messageObject.photoThumbsObject), "86_86", ImageLocation.getForObject(currentPhotoObjectThumb, messageObject.photoThumbsObject), currentPhotoFilter, currentPhotoObjectThumbStripped, 0, null, messageObject, 1);
|
photoImage.setImage(ImageLocation.getForObject(currentPhotoObject, messageObject.photoThumbsObject), "86_86", ImageLocation.getForObject(currentPhotoObjectThumb, messageObject.photoThumbsObject), currentPhotoFilter, currentPhotoObjectThumbStripped, 0, null, messageObject, 1);
|
||||||
|
@ -7242,7 +7260,6 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||||
LinkPath path = obtainNewUrlPath(true);
|
LinkPath path = obtainNewUrlPath(true);
|
||||||
path.setCurrentLayout(captionLayout, start, 0);
|
path.setCurrentLayout(captionLayout, start, 0);
|
||||||
captionLayout.getSelectionPath(start, end, path);
|
captionLayout.getSelectionPath(start, end, path);
|
||||||
path.onPathEnd();
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
FileLog.e(e);
|
FileLog.e(e);
|
||||||
}
|
}
|
||||||
|
@ -7257,7 +7274,6 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||||
LinkPath path = obtainNewUrlPath(true);
|
LinkPath path = obtainNewUrlPath(true);
|
||||||
path.setCurrentLayout(block.textLayout, start, 0);
|
path.setCurrentLayout(block.textLayout, start, 0);
|
||||||
block.textLayout.getSelectionPath(start, end, path);
|
block.textLayout.getSelectionPath(start, end, path);
|
||||||
path.onPathEnd();
|
|
||||||
if (end >= block.charactersOffset + length) {
|
if (end >= block.charactersOffset + length) {
|
||||||
for (int a = c + 1; a < messageObject.textLayoutBlocks.size(); a++) {
|
for (int a = c + 1; a < messageObject.textLayoutBlocks.size(); a++) {
|
||||||
MessageObject.TextLayoutBlock nextBlock = messageObject.textLayoutBlocks.get(a);
|
MessageObject.TextLayoutBlock nextBlock = messageObject.textLayoutBlocks.get(a);
|
||||||
|
@ -7265,7 +7281,6 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||||
path = obtainNewUrlPath(true);
|
path = obtainNewUrlPath(true);
|
||||||
path.setCurrentLayout(nextBlock.textLayout, 0, nextBlock.height);
|
path.setCurrentLayout(nextBlock.textLayout, 0, nextBlock.height);
|
||||||
nextBlock.textLayout.getSelectionPath(0, end - nextBlock.charactersOffset, path);
|
nextBlock.textLayout.getSelectionPath(0, end - nextBlock.charactersOffset, path);
|
||||||
path.onPathEnd();
|
|
||||||
if (end < block.charactersOffset + length - 1) {
|
if (end < block.charactersOffset + length - 1) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -8625,7 +8640,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||||
linkPreviewY += currentMessageObject.textHeight + AndroidUtilities.dp(4);
|
linkPreviewY += currentMessageObject.textHeight + AndroidUtilities.dp(4);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (drawPhotoImage && drawInstantView && drawInstantViewType != 9 && drawInstantViewType != 13 && drawInstantViewType != 1 || drawInstantViewType == 6 && imageBackgroundColor != 0) {
|
if (drawPhotoImage && drawInstantView && drawInstantViewType != 9 && drawInstantViewType != 13 && drawInstantViewType != 11 && drawInstantViewType != 1 || drawInstantViewType == 6 && imageBackgroundColor != 0) {
|
||||||
if (linkPreviewY != startY) {
|
if (linkPreviewY != startY) {
|
||||||
linkPreviewY += AndroidUtilities.dp(2);
|
linkPreviewY += AndroidUtilities.dp(2);
|
||||||
}
|
}
|
||||||
|
@ -8777,7 +8792,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||||
imageDrawn = true;
|
imageDrawn = true;
|
||||||
drawTime = true;
|
drawTime = true;
|
||||||
} else {
|
} else {
|
||||||
if (delegate == null || delegate.getPinchToZoomHelper() == null || !delegate.getPinchToZoomHelper().isInOverlayModeFor(this) && drawInstantViewType != 11) {
|
if (delegate == null || delegate.getPinchToZoomHelper() == null || !delegate.getPinchToZoomHelper().isInOverlayModeFor(this)) {
|
||||||
if (alpha != 1f) {
|
if (alpha != 1f) {
|
||||||
photoImage.setAlpha(alpha);
|
photoImage.setAlpha(alpha);
|
||||||
imageDrawn = photoImage.draw(canvas);
|
imageDrawn = photoImage.draw(canvas);
|
||||||
|
@ -11041,7 +11056,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||||
canvas.restore();
|
canvas.restore();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!clipToGroupBounds) {
|
if (delegate == null || delegate.canDrawOutboundsContent()) {
|
||||||
drawOutboundsContent(canvas);
|
drawOutboundsContent(canvas);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11521,6 +11536,10 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean hasOutboundsContent() {
|
||||||
|
return (!transitionParams.transitionBotButtons.isEmpty() && transitionParams.animateBotButtonsChanged) || !botButtons.isEmpty() || drawSideButton != 0;
|
||||||
|
}
|
||||||
|
|
||||||
public void drawOutboundsContent(Canvas canvas) {
|
public void drawOutboundsContent(Canvas canvas) {
|
||||||
if (!transitionParams.transitionBotButtons.isEmpty() && transitionParams.animateBotButtonsChanged) {
|
if (!transitionParams.transitionBotButtons.isEmpty() && transitionParams.animateBotButtonsChanged) {
|
||||||
drawBotButtons(canvas, transitionParams.transitionBotButtons, 1f - transitionParams.animateChangeProgress);
|
drawBotButtons(canvas, transitionParams.transitionBotButtons, 1f - transitionParams.animateChangeProgress);
|
||||||
|
@ -11534,12 +11553,12 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||||
private void drawSideButton(Canvas canvas) {
|
private void drawSideButton(Canvas canvas) {
|
||||||
if (drawSideButton != 0) {
|
if (drawSideButton != 0) {
|
||||||
if (currentMessageObject.isOutOwner()) {
|
if (currentMessageObject.isOutOwner()) {
|
||||||
sideStartX = getCurrentBackgroundLeft() - AndroidUtilities.dp(8 + 32);
|
sideStartX = transitionParams.lastBackgroundLeft - AndroidUtilities.dp(8 + 32);
|
||||||
if (currentMessagesGroup != null) {
|
if (currentMessagesGroup != null) {
|
||||||
sideStartX += currentMessagesGroup.transitionParams.offsetLeft - animationOffsetX;
|
sideStartX += currentMessagesGroup.transitionParams.offsetLeft - animationOffsetX;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
sideStartX = currentBackgroundDrawable.getBounds().right + AndroidUtilities.dp(8);
|
sideStartX = transitionParams.lastBackgroundRight + AndroidUtilities.dp(8);
|
||||||
if (currentMessagesGroup != null) {
|
if (currentMessagesGroup != null) {
|
||||||
sideStartX += currentMessagesGroup.transitionParams.offsetRight - animationOffsetX;
|
sideStartX += currentMessagesGroup.transitionParams.offsetRight - animationOffsetX;
|
||||||
}
|
}
|
||||||
|
@ -14809,7 +14828,13 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||||
}
|
}
|
||||||
accessibilityText = sb;
|
accessibilityText = sb;
|
||||||
}
|
}
|
||||||
info.setText(accessibilityText);
|
|
||||||
|
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) {
|
||||||
|
info.setContentDescription(accessibilityText.toString());
|
||||||
|
} else {
|
||||||
|
info.setText(accessibilityText);
|
||||||
|
}
|
||||||
|
|
||||||
info.setEnabled(true);
|
info.setEnabled(true);
|
||||||
if (Build.VERSION.SDK_INT >= 19) {
|
if (Build.VERSION.SDK_INT >= 19) {
|
||||||
AccessibilityNodeInfo.CollectionItemInfo itemInfo = info.getCollectionItemInfo();
|
AccessibilityNodeInfo.CollectionItemInfo itemInfo = info.getCollectionItemInfo();
|
||||||
|
@ -14857,7 +14882,28 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||||
seekBarAccessibilityDelegate.onInitializeAccessibilityNodeInfoInternal(info);
|
seekBarAccessibilityDelegate.onInitializeAccessibilityNodeInfoInternal(info);
|
||||||
}
|
}
|
||||||
|
|
||||||
int i = 0;
|
int i;
|
||||||
|
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) {
|
||||||
|
if (currentMessageObject.messageText instanceof Spannable) {
|
||||||
|
Spannable buffer = (Spannable) currentMessageObject.messageText;
|
||||||
|
CharacterStyle[] links = buffer.getSpans(0, buffer.length(), ClickableSpan.class);
|
||||||
|
i = 0;
|
||||||
|
for (CharacterStyle link : links) {
|
||||||
|
info.addChild(ChatMessageCell.this, LINK_IDS_START + i);
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (currentMessageObject.caption instanceof Spannable && captionLayout != null) {
|
||||||
|
Spannable buffer = (Spannable) currentMessageObject.caption;
|
||||||
|
CharacterStyle[] links = buffer.getSpans(0, buffer.length(), ClickableSpan.class);
|
||||||
|
i = 0;
|
||||||
|
for (CharacterStyle link : links) {
|
||||||
|
info.addChild(ChatMessageCell.this, LINK_CAPTION_IDS_START + i);
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
i = 0;
|
||||||
for (BotButton button : botButtons) {
|
for (BotButton button : botButtons) {
|
||||||
info.addChild(ChatMessageCell.this, BOT_BUTTONS_START + i);
|
info.addChild(ChatMessageCell.this, BOT_BUTTONS_START + i);
|
||||||
i++;
|
i++;
|
||||||
|
@ -15413,6 +15459,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||||
public int lastTimeX;
|
public int lastTimeX;
|
||||||
public int animateFromTimeX;
|
public int animateFromTimeX;
|
||||||
public boolean shouldAnimateTimeX;
|
public boolean shouldAnimateTimeX;
|
||||||
|
public int lastBackgroundLeft, lastBackgroundRight;
|
||||||
|
|
||||||
public boolean animateDrawingTimeAlpha;
|
public boolean animateDrawingTimeAlpha;
|
||||||
|
|
||||||
|
@ -15478,7 +15525,9 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||||
|
|
||||||
lastDrawingCaptionLayout = captionLayout;
|
lastDrawingCaptionLayout = captionLayout;
|
||||||
lastDrawBotButtons.clear();
|
lastDrawBotButtons.clear();
|
||||||
lastDrawBotButtons.addAll(botButtons);
|
if (!botButtons.isEmpty()) {
|
||||||
|
lastDrawBotButtons.addAll(botButtons);
|
||||||
|
}
|
||||||
|
|
||||||
if (commentLayout != null) {
|
if (commentLayout != null) {
|
||||||
lastCommentsCount = getRepliesCount();
|
lastCommentsCount = getRepliesCount();
|
||||||
|
@ -15524,6 +15573,8 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||||
lastForwardNameX = forwardNameX;
|
lastForwardNameX = forwardNameX;
|
||||||
lastForwardedNamesOffset = namesOffset;
|
lastForwardedNamesOffset = namesOffset;
|
||||||
lastForwardNameWidth = forwardedNameWidth;
|
lastForwardNameWidth = forwardedNameWidth;
|
||||||
|
lastBackgroundLeft = getCurrentBackgroundLeft();
|
||||||
|
lastBackgroundRight = currentBackgroundDrawable.getBounds().right;
|
||||||
|
|
||||||
reactionsLayoutInBubble.recordDrawingState();
|
reactionsLayoutInBubble.recordDrawingState();
|
||||||
}
|
}
|
||||||
|
|
|
@ -358,8 +358,7 @@ public class ContextLinkCell extends FrameLayout implements DownloadController.F
|
||||||
linkImageView.setImage(ImageLocation.getForDocument(currentPhotoObject, documentAttach), currentPhotoFilter, ImageLocation.getForPhoto(currentPhotoObjectThumb, photoAttach), currentPhotoFilterThumb, currentPhotoObject.size, ext, parentObject, 0);
|
linkImageView.setImage(ImageLocation.getForDocument(currentPhotoObject, documentAttach), currentPhotoFilter, ImageLocation.getForPhoto(currentPhotoObjectThumb, photoAttach), currentPhotoFilterThumb, currentPhotoObject.size, ext, parentObject, 0);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
linkImageView.setImage(ImageLocation.getForPhoto(currentPhotoObject, photoAttach), currentPhotoFilter, ImageLocation.getForPhoto(currentPhotoObjectThumb, photoAttach), currentPhotoFilterThumb, currentPhotoObject.size, ext, parentObject, 0);
|
linkImageView.setImage(ImageLocation.getForPhoto(currentPhotoObject, photoAttach), currentPhotoFilter, ImageLocation.getForPhoto(currentPhotoObjectThumb, photoAttach), currentPhotoFilterThumb, currentPhotoObject.size, ext, parentObject, 0); }
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else if (webFile != null) {
|
} else if (webFile != null) {
|
||||||
linkImageView.setImage(ImageLocation.getForWebFile(webFile), currentPhotoFilter, ImageLocation.getForPhoto(currentPhotoObjectThumb, photoAttach), currentPhotoFilterThumb, -1, ext, parentObject, 1);
|
linkImageView.setImage(ImageLocation.getForWebFile(webFile), currentPhotoFilter, ImageLocation.getForPhoto(currentPhotoObjectThumb, photoAttach), currentPhotoFilterThumb, -1, ext, parentObject, 1);
|
||||||
|
@ -579,9 +578,8 @@ public class ContextLinkCell extends FrameLayout implements DownloadController.F
|
||||||
@Override
|
@Override
|
||||||
protected void onDetachedFromWindow() {
|
protected void onDetachedFromWindow() {
|
||||||
super.onDetachedFromWindow();
|
super.onDetachedFromWindow();
|
||||||
if (drawLinkImageView) {
|
linkImageView.onDetachedFromWindow();
|
||||||
linkImageView.onDetachedFromWindow();
|
|
||||||
}
|
|
||||||
radialProgress.onDetachedFromWindow();
|
radialProgress.onDetachedFromWindow();
|
||||||
DownloadController.getInstance(currentAccount).removeLoadingFileObserver(this);
|
DownloadController.getInstance(currentAccount).removeLoadingFileObserver(this);
|
||||||
}
|
}
|
||||||
|
@ -589,10 +587,8 @@ public class ContextLinkCell extends FrameLayout implements DownloadController.F
|
||||||
@Override
|
@Override
|
||||||
protected void onAttachedToWindow() {
|
protected void onAttachedToWindow() {
|
||||||
super.onAttachedToWindow();
|
super.onAttachedToWindow();
|
||||||
if (drawLinkImageView) {
|
if (linkImageView.onAttachedToWindow()) {
|
||||||
if (linkImageView.onAttachedToWindow()) {
|
updateButtonState(false, false);
|
||||||
updateButtonState(false, false);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
radialProgress.onAttachedToWindow();
|
radialProgress.onAttachedToWindow();
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,8 +27,10 @@ import android.text.Spanned;
|
||||||
import android.text.StaticLayout;
|
import android.text.StaticLayout;
|
||||||
import android.text.TextPaint;
|
import android.text.TextPaint;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
|
import android.text.style.CharacterStyle;
|
||||||
import android.text.style.ClickableSpan;
|
import android.text.style.ClickableSpan;
|
||||||
import android.text.style.ReplacementSpan;
|
import android.text.style.ReplacementSpan;
|
||||||
|
import android.text.style.StyleSpan;
|
||||||
import android.view.HapticFeedbackConstants;
|
import android.view.HapticFeedbackConstants;
|
||||||
import android.view.accessibility.AccessibilityEvent;
|
import android.view.accessibility.AccessibilityEvent;
|
||||||
import android.view.accessibility.AccessibilityNodeInfo;
|
import android.view.accessibility.AccessibilityNodeInfo;
|
||||||
|
@ -1327,6 +1329,7 @@ public class DialogCell extends BaseCell {
|
||||||
drawCount = false;
|
drawCount = false;
|
||||||
drawMention = false;
|
drawMention = false;
|
||||||
}
|
}
|
||||||
|
drawReactionMention = false;
|
||||||
} else {
|
} else {
|
||||||
if (clearingDialog) {
|
if (clearingDialog) {
|
||||||
drawCount = false;
|
drawCount = false;
|
||||||
|
@ -1627,7 +1630,7 @@ public class DialogCell extends BaseCell {
|
||||||
int w = AndroidUtilities.dp(24);
|
int w = AndroidUtilities.dp(24);
|
||||||
messageWidth -= w;
|
messageWidth -= w;
|
||||||
if (!LocaleController.isRTL) {
|
if (!LocaleController.isRTL) {
|
||||||
reactionMentionLeft = getMeasuredWidth() - AndroidUtilities.dp(32) - (mentionWidth != 0 ? (mentionWidth + AndroidUtilities.dp(20)) : 0) - (countWidth != 0 ? countWidth + AndroidUtilities.dp(18) : 0);
|
reactionMentionLeft = getMeasuredWidth() - AndroidUtilities.dp(32) - (mentionWidth != 0 ? (mentionWidth + AndroidUtilities.dp(18)) : 0) - (countWidth != 0 ? countWidth + AndroidUtilities.dp(18) : 0);
|
||||||
} else {
|
} else {
|
||||||
reactionMentionLeft = AndroidUtilities.dp(20) + (countWidth != 0 ? countWidth + AndroidUtilities.dp(18) : 0);
|
reactionMentionLeft = AndroidUtilities.dp(20) + (countWidth != 0 ? countWidth + AndroidUtilities.dp(18) : 0);
|
||||||
messageLeft += w;
|
messageLeft += w;
|
||||||
|
@ -1704,12 +1707,13 @@ public class DialogCell extends BaseCell {
|
||||||
} else {
|
} else {
|
||||||
messageStringFinal = messageString;
|
messageStringFinal = messageString;
|
||||||
}
|
}
|
||||||
// Removing links to get rid of underlining
|
// Removing links and bold spans to get rid of underlining and boldness
|
||||||
if (messageStringFinal instanceof Spannable) {
|
if (messageStringFinal instanceof Spannable) {
|
||||||
Spannable messageStringSpannable = (Spannable) messageStringFinal;
|
Spannable messageStringSpannable = (Spannable) messageStringFinal;
|
||||||
ClickableSpan[] spans = messageStringSpannable.getSpans(0, messageStringSpannable.length(), ClickableSpan.class);
|
for (CharacterStyle span : messageStringSpannable.getSpans(0, messageStringSpannable.length(), CharacterStyle.class)) {
|
||||||
for (ClickableSpan span : spans) {
|
if (span instanceof ClickableSpan || (span instanceof StyleSpan && ((StyleSpan) span).getStyle() == android.graphics.Typeface.BOLD)) {
|
||||||
messageStringSpannable.removeSpan(span);
|
messageStringSpannable.removeSpan(span);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2057,6 +2061,7 @@ public class DialogCell extends BaseCell {
|
||||||
if (dialog instanceof TLRPC.TL_dialogFolder) {
|
if (dialog instanceof TLRPC.TL_dialogFolder) {
|
||||||
unreadCount = MessagesStorage.getInstance(currentAccount).getArchiveUnreadCount();
|
unreadCount = MessagesStorage.getInstance(currentAccount).getArchiveUnreadCount();
|
||||||
mentionCount = 0;
|
mentionCount = 0;
|
||||||
|
reactionMentionCount = 0;
|
||||||
} else {
|
} else {
|
||||||
unreadCount = dialog.unread_count;
|
unreadCount = dialog.unread_count;
|
||||||
mentionCount = dialog.unread_mentions_count;
|
mentionCount = dialog.unread_mentions_count;
|
||||||
|
@ -2078,6 +2083,7 @@ public class DialogCell extends BaseCell {
|
||||||
} else {
|
} else {
|
||||||
unreadCount = 0;
|
unreadCount = 0;
|
||||||
mentionCount = 0;
|
mentionCount = 0;
|
||||||
|
reactionMentionCount = 0;
|
||||||
currentEditDate = 0;
|
currentEditDate = 0;
|
||||||
lastMessageDate = 0;
|
lastMessageDate = 0;
|
||||||
clearingDialog = false;
|
clearingDialog = false;
|
||||||
|
@ -2140,20 +2146,23 @@ public class DialogCell extends BaseCell {
|
||||||
TLRPC.Dialog dialog = MessagesController.getInstance(currentAccount).dialogs_dict.get(currentDialogId);
|
TLRPC.Dialog dialog = MessagesController.getInstance(currentAccount).dialogs_dict.get(currentDialogId);
|
||||||
int newCount;
|
int newCount;
|
||||||
int newMentionCount;
|
int newMentionCount;
|
||||||
|
int newReactionCout = 0;
|
||||||
if (dialog instanceof TLRPC.TL_dialogFolder) {
|
if (dialog instanceof TLRPC.TL_dialogFolder) {
|
||||||
newCount = MessagesStorage.getInstance(currentAccount).getArchiveUnreadCount();
|
newCount = MessagesStorage.getInstance(currentAccount).getArchiveUnreadCount();
|
||||||
newMentionCount = 0;
|
newMentionCount = 0;
|
||||||
} else if (dialog != null) {
|
} else if (dialog != null) {
|
||||||
newCount = dialog.unread_count;
|
newCount = dialog.unread_count;
|
||||||
newMentionCount = dialog.unread_mentions_count;
|
newMentionCount = dialog.unread_mentions_count;
|
||||||
|
newReactionCout = dialog.unread_reactions_count;
|
||||||
} else {
|
} else {
|
||||||
newCount = 0;
|
newCount = 0;
|
||||||
newMentionCount = 0;
|
newMentionCount = 0;
|
||||||
}
|
}
|
||||||
if (dialog != null && (unreadCount != newCount || markUnread != dialog.unread_mark || mentionCount != newMentionCount)) {
|
if (dialog != null && (unreadCount != newCount || markUnread != dialog.unread_mark || mentionCount != newMentionCount || reactionMentionCount != newReactionCout)) {
|
||||||
unreadCount = newCount;
|
unreadCount = newCount;
|
||||||
mentionCount = newMentionCount;
|
mentionCount = newMentionCount;
|
||||||
markUnread = dialog.unread_mark;
|
markUnread = dialog.unread_mark;
|
||||||
|
reactionMentionCount = newReactionCout;
|
||||||
continueUpdate = true;
|
continueUpdate = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2914,11 +2923,11 @@ public class DialogCell extends BaseCell {
|
||||||
|
|
||||||
if (drawReactionMention || reactionsMentionsChangeProgress != 1f) {
|
if (drawReactionMention || reactionsMentionsChangeProgress != 1f) {
|
||||||
|
|
||||||
Theme.dialogs_countPaint.setAlpha((int) ((1.0f - reorderIconProgress) * 255));
|
Theme.dialogs_reactionsCountPaint.setAlpha((int) ((1.0f - reorderIconProgress) * 255));
|
||||||
|
|
||||||
int x = reactionMentionLeft - AndroidUtilities.dp(5.5f);
|
int x = reactionMentionLeft - AndroidUtilities.dp(5.5f);
|
||||||
rect.set(x, countTop, x + AndroidUtilities.dp(23), countTop + AndroidUtilities.dp(23));
|
rect.set(x, countTop, x + AndroidUtilities.dp(23), countTop + AndroidUtilities.dp(23));
|
||||||
Paint paint = dialogMuted && folderId != 0 ? Theme.dialogs_countGrayPaint : Theme.dialogs_countPaint;
|
Paint paint = Theme.dialogs_reactionsCountPaint;
|
||||||
|
|
||||||
canvas.save();
|
canvas.save();
|
||||||
if (reactionsMentionsChangeProgress != 1f) {
|
if (reactionsMentionsChangeProgress != 1f) {
|
||||||
|
|
|
@ -90,6 +90,8 @@ public class ShareDialogCell extends FrameLayout {
|
||||||
invalidate();
|
invalidate();
|
||||||
});
|
});
|
||||||
addView(checkBox, LayoutHelper.createFrame(24, 24, Gravity.CENTER_HORIZONTAL | Gravity.TOP, 19, currentType == TYPE_CREATE ? -40 : 42, 0, 0));
|
addView(checkBox, LayoutHelper.createFrame(24, 24, Gravity.CENTER_HORIZONTAL | Gravity.TOP, 19, currentType == TYPE_CREATE ? -40 : 42, 0, 0));
|
||||||
|
|
||||||
|
setBackground(Theme.createRadSelectorDrawable(Theme.getColor(Theme.key_listSelector), AndroidUtilities.dp(2), AndroidUtilities.dp(2)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -196,6 +198,7 @@ public class ShareDialogCell extends FrameLayout {
|
||||||
Theme.checkboxSquare_checkPaint.setColor(getThemedColor(Theme.key_dialogRoundCheckBox));
|
Theme.checkboxSquare_checkPaint.setColor(getThemedColor(Theme.key_dialogRoundCheckBox));
|
||||||
Theme.checkboxSquare_checkPaint.setAlpha((int) (checkBox.getProgress() * 255));
|
Theme.checkboxSquare_checkPaint.setAlpha((int) (checkBox.getProgress() * 255));
|
||||||
canvas.drawCircle(cx, cy, AndroidUtilities.dp(currentType == TYPE_CREATE ? 24 : 28), Theme.checkboxSquare_checkPaint);
|
canvas.drawCircle(cx, cy, AndroidUtilities.dp(currentType == TYPE_CREATE ? 24 : 28), Theme.checkboxSquare_checkPaint);
|
||||||
|
super.onDraw(canvas);
|
||||||
}
|
}
|
||||||
|
|
||||||
private int getThemedColor(String key) {
|
private int getThemedColor(String key) {
|
||||||
|
|
|
@ -580,7 +580,6 @@ public class SharedLinkCell extends FrameLayout {
|
||||||
try {
|
try {
|
||||||
urlPath.setCurrentLayout(layout, 0, 0);
|
urlPath.setCurrentLayout(layout, 0, 0);
|
||||||
layout.getSelectionPath(0, layout.getText().length(), urlPath);
|
layout.getSelectionPath(0, layout.getText().length(), urlPath);
|
||||||
urlPath.onPathEnd();
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
FileLog.e(e);
|
FileLog.e(e);
|
||||||
}
|
}
|
||||||
|
@ -809,7 +808,9 @@ public class SharedLinkCell extends FrameLayout {
|
||||||
}
|
}
|
||||||
canvas.save();
|
canvas.save();
|
||||||
canvas.clipPath(path, Region.Op.DIFFERENCE);
|
canvas.clipPath(path, Region.Op.DIFFERENCE);
|
||||||
if (pressedLink == a) canvas.drawPath(urlPath, Theme.linkSelectionPaint);
|
if (pressedLink == a) {
|
||||||
|
canvas.drawPath(urlPath, Theme.linkSelectionPaint);
|
||||||
|
}
|
||||||
layout.draw(canvas);
|
layout.draw(canvas);
|
||||||
canvas.restore();
|
canvas.restore();
|
||||||
|
|
||||||
|
@ -820,7 +821,9 @@ public class SharedLinkCell extends FrameLayout {
|
||||||
spoilers.get(0).getRipplePath(path);
|
spoilers.get(0).getRipplePath(path);
|
||||||
canvas.clipPath(path);
|
canvas.clipPath(path);
|
||||||
|
|
||||||
if (pressedLink == a) canvas.drawPath(urlPath, Theme.linkSelectionPaint);
|
if (pressedLink == a) {
|
||||||
|
canvas.drawPath(urlPath, Theme.linkSelectionPaint);
|
||||||
|
}
|
||||||
layout.draw(canvas);
|
layout.draw(canvas);
|
||||||
canvas.restore();
|
canvas.restore();
|
||||||
|
|
||||||
|
|
|
@ -137,7 +137,7 @@ public class StickerEmojiCell extends FrameLayout {
|
||||||
sticker = document;
|
sticker = document;
|
||||||
parentObject = parent;
|
parentObject = parent;
|
||||||
boolean isVideoSticker = MessageObject.isVideoSticker(document);
|
boolean isVideoSticker = MessageObject.isVideoSticker(document);
|
||||||
TLRPC.PhotoSize thumb = isVideoSticker ? null : FileLoader.getClosestPhotoSizeWithSize(document.thumbs, 90);
|
TLRPC.PhotoSize thumb = (isVideoSticker && MessageObject.canAutoplayAnimatedSticker(document)) ? null : FileLoader.getClosestPhotoSizeWithSize(document.thumbs, 90);
|
||||||
SvgHelper.SvgDrawable svgThumb = DocumentObject.getSvgThumb(document, fromEmojiPanel ? Theme.key_emptyListPlaceholder : Theme.key_windowBackgroundGray, fromEmojiPanel ? 0.2f : 1.0f);
|
SvgHelper.SvgDrawable svgThumb = DocumentObject.getSvgThumb(document, fromEmojiPanel ? Theme.key_emptyListPlaceholder : Theme.key_windowBackgroundGray, fromEmojiPanel ? 0.2f : 1.0f);
|
||||||
if (MessageObject.canAutoplayAnimatedSticker(document)) {
|
if (MessageObject.canAutoplayAnimatedSticker(document)) {
|
||||||
if (svgThumb != null) {
|
if (svgThumb != null) {
|
||||||
|
|
|
@ -1245,7 +1245,7 @@ public abstract class TextSelectionHelper<Cell extends TextSelectionHelper.Selec
|
||||||
menu.getItem(1).setVisible(true);
|
menu.getItem(1).setVisible(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (LanguageDetector.hasSupport() && getSelectedText() != null) {
|
if (onTranslateListener != null && LanguageDetector.hasSupport() && getSelectedText() != null) {
|
||||||
LanguageDetector.detectLanguage(getSelectedText().toString(), lng -> {
|
LanguageDetector.detectLanguage(getSelectedText().toString(), lng -> {
|
||||||
translateFromLanguage = lng;
|
translateFromLanguage = lng;
|
||||||
updateTranslateButton(menu);
|
updateTranslateButton(menu);
|
||||||
|
@ -1360,7 +1360,6 @@ public abstract class TextSelectionHelper<Cell extends TextSelectionHelper.Selec
|
||||||
if (selectedView != null) {
|
if (selectedView != null) {
|
||||||
int[] coords = offsetToCord(selectionEnd);
|
int[] coords = offsetToCord(selectionEnd);
|
||||||
x2 = coords[0] + textX;
|
x2 = coords[0] + textX;
|
||||||
|
|
||||||
}
|
}
|
||||||
outRect.set(
|
outRect.set(
|
||||||
Math.min(x1, x2), y1,
|
Math.min(x1, x2), y1,
|
||||||
|
|
|
@ -172,7 +172,7 @@ public class ThemePreviewMessagesCell extends LinearLayout {
|
||||||
private GestureDetector gestureDetector = new GestureDetector(context, new GestureDetector.SimpleOnGestureListener() {
|
private GestureDetector gestureDetector = new GestureDetector(context, new GestureDetector.SimpleOnGestureListener() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onDoubleTap(MotionEvent e) {
|
public boolean onDoubleTap(MotionEvent e) {
|
||||||
boolean added = getMessageObject().selectReaction(MediaDataController.getInstance(currentAccount).getDoubleTapReaction(), false);
|
boolean added = getMessageObject().selectReaction(MediaDataController.getInstance(currentAccount).getDoubleTapReaction(), false, false);
|
||||||
setMessageObject(getMessageObject(), null, false, false);
|
setMessageObject(getMessageObject(), null, false, false);
|
||||||
requestLayout();
|
requestLayout();
|
||||||
ReactionsEffectOverlay.removeCurrent(false);
|
ReactionsEffectOverlay.removeCurrent(false);
|
||||||
|
|
|
@ -2164,7 +2164,7 @@ public class ChannelAdminLogActivity extends BaseFragment implements Notificatio
|
||||||
Toast.makeText(getParentActivity(), LocaleController.getString("TextCopied", R.string.TextCopied), Toast.LENGTH_SHORT).show();
|
Toast.makeText(getParentActivity(), LocaleController.getString("TextCopied", R.string.TextCopied), Toast.LENGTH_SHORT).show();
|
||||||
}
|
}
|
||||||
} else if (url instanceof URLSpanUserMention) {
|
} else if (url instanceof URLSpanUserMention) {
|
||||||
long peerId = Utilities.parseInt(((URLSpanUserMention) url).getURL());
|
long peerId = Utilities.parseLong(((URLSpanUserMention) url).getURL());
|
||||||
if (peerId > 0) {
|
if (peerId > 0) {
|
||||||
TLRPC.User user = MessagesController.getInstance(currentAccount).getUser(peerId);
|
TLRPC.User user = MessagesController.getInstance(currentAccount).getUser(peerId);
|
||||||
if (user != null) {
|
if (user != null) {
|
||||||
|
|
|
@ -121,6 +121,7 @@ public class AnimatedFileDrawable extends BitmapDrawable implements Animatable {
|
||||||
private int renderingWidth;
|
private int renderingWidth;
|
||||||
private float scaleFactor = 1f;
|
private float scaleFactor = 1f;
|
||||||
public final boolean isWebmSticker;
|
public final boolean isWebmSticker;
|
||||||
|
private final TLRPC.Document document;
|
||||||
|
|
||||||
private View parentView;
|
private View parentView;
|
||||||
private ArrayList<View> secondParentViews = new ArrayList<>();
|
private ArrayList<View> secondParentViews = new ArrayList<>();
|
||||||
|
@ -171,6 +172,9 @@ public class AnimatedFileDrawable extends BitmapDrawable implements Animatable {
|
||||||
}
|
}
|
||||||
loadFrameTask = null;
|
loadFrameTask = null;
|
||||||
scheduleNextGetFrame();
|
scheduleNextGetFrame();
|
||||||
|
for (int i = 0; i < parents.size(); i++) {
|
||||||
|
parents.get(i).invalidate();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -229,8 +233,8 @@ public class AnimatedFileDrawable extends BitmapDrawable implements Animatable {
|
||||||
secondParentViews.get(a).invalidate();
|
secondParentViews.get(a).invalidate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ((secondParentViews.isEmpty() || invalidateParentViewWithSecond) && parentView != null) {
|
for (int i = 0; i < parents.size(); i++) {
|
||||||
parentView.invalidate();
|
parents.get(i).invalidate();
|
||||||
}
|
}
|
||||||
scheduleNextGetFrame();
|
scheduleNextGetFrame();
|
||||||
}
|
}
|
||||||
|
@ -331,7 +335,8 @@ public class AnimatedFileDrawable extends BitmapDrawable implements Animatable {
|
||||||
currentAccount = account;
|
currentAccount = account;
|
||||||
renderingHeight = h;
|
renderingHeight = h;
|
||||||
renderingWidth = w;
|
renderingWidth = w;
|
||||||
isWebmSticker = MessageObject.isVideoSticker(document);
|
this.document = document;
|
||||||
|
isWebmSticker = MessageObject.isWebM(document) || MessageObject.isVideoSticker(document);
|
||||||
if (isWebmSticker) {
|
if (isWebmSticker) {
|
||||||
useSharedQueue = true;
|
useSharedQueue = true;
|
||||||
}
|
}
|
||||||
|
@ -388,7 +393,7 @@ public class AnimatedFileDrawable extends BitmapDrawable implements Animatable {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addParent(View view) {
|
public void addParent(View view) {
|
||||||
if (!parents.contains(view)) {
|
if (view != null && !parents.contains(view)) {
|
||||||
parents.add(view);
|
parents.add(view);
|
||||||
if (isRunning) {
|
if (isRunning) {
|
||||||
scheduleNextGetFrame();
|
scheduleNextGetFrame();
|
||||||
|
@ -482,6 +487,7 @@ public class AnimatedFileDrawable extends BitmapDrawable implements Animatable {
|
||||||
decodeQueue.recycle();
|
decodeQueue.recycle();
|
||||||
decodeQueue = null;
|
decodeQueue = null;
|
||||||
}
|
}
|
||||||
|
getPaint().setShader(null);
|
||||||
} else {
|
} else {
|
||||||
destroyWhenDone = true;
|
destroyWhenDone = true;
|
||||||
}
|
}
|
||||||
|
@ -534,7 +540,7 @@ public class AnimatedFileDrawable extends BitmapDrawable implements Animatable {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void start() {
|
public void start() {
|
||||||
if (isRunning) {
|
if (isRunning || parents.size() == 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
isRunning = true;
|
isRunning = true;
|
||||||
|
@ -623,8 +629,6 @@ public class AnimatedFileDrawable extends BitmapDrawable implements Animatable {
|
||||||
applyTransformation = true;
|
applyTransformation = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Paint paint;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void draw(Canvas canvas) {
|
public void draw(Canvas canvas) {
|
||||||
if (nativePtr == 0 && decoderCreated || destroyWhenDone) {
|
if (nativePtr == 0 && decoderCreated || destroyWhenDone) {
|
||||||
|
@ -714,12 +718,6 @@ public class AnimatedFileDrawable extends BitmapDrawable implements Animatable {
|
||||||
canvas.scale(scaleX, scaleY);
|
canvas.scale(scaleX, scaleY);
|
||||||
canvas.drawBitmap(renderingBitmap, 0, 0, getPaint());
|
canvas.drawBitmap(renderingBitmap, 0, 0, getPaint());
|
||||||
}
|
}
|
||||||
if (isRunning && !invalidateTaskIsRunning) {
|
|
||||||
invalidateTaskIsRunning = true;
|
|
||||||
long timeToNextFrame = Math.max(1, invalidateAfter - (now - lastFrameTime) - 17);
|
|
||||||
uiHandler.removeCallbacks(mInvalidateTask);
|
|
||||||
uiHandler.postDelayed(mInvalidateTask, Math.min(timeToNextFrame, invalidateAfter));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -808,7 +806,7 @@ public class AnimatedFileDrawable extends BitmapDrawable implements Animatable {
|
||||||
if (stream != null) {
|
if (stream != null) {
|
||||||
drawable = new AnimatedFileDrawable(path, false, streamFileSize, stream.getDocument(), stream.getLocation(), stream.getParentObject(), pendingSeekToUI, currentAccount, stream != null && stream.isPreview());
|
drawable = new AnimatedFileDrawable(path, false, streamFileSize, stream.getDocument(), stream.getLocation(), stream.getParentObject(), pendingSeekToUI, currentAccount, stream != null && stream.isPreview());
|
||||||
} else {
|
} else {
|
||||||
drawable = new AnimatedFileDrawable(path, false, streamFileSize, null, null, null, pendingSeekToUI, currentAccount, stream != null && stream.isPreview());
|
drawable = new AnimatedFileDrawable(path, false, streamFileSize, document, null, null, pendingSeekToUI, currentAccount, stream != null && stream.isPreview());
|
||||||
}
|
}
|
||||||
drawable.metaData[0] = metaData[0];
|
drawable.metaData[0] = metaData[0];
|
||||||
drawable.metaData[1] = metaData[1];
|
drawable.metaData[1] = metaData[1];
|
||||||
|
|
|
@ -10,6 +10,7 @@ import android.graphics.PorterDuffXfermode;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.os.SystemClock;
|
import android.os.SystemClock;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
import android.view.animation.Interpolator;
|
||||||
|
|
||||||
import androidx.core.graphics.ColorUtils;
|
import androidx.core.graphics.ColorUtils;
|
||||||
|
|
||||||
|
@ -57,6 +58,8 @@ public class AvatarsDarawable {
|
||||||
View parent;
|
View parent;
|
||||||
private int overrideSize;
|
private int overrideSize;
|
||||||
private float overrideAlpha = 1f;
|
private float overrideAlpha = 1f;
|
||||||
|
public long transitionDuration = 220;
|
||||||
|
public Interpolator transitionInterpolator = CubicBezierInterpolator.DEFAULT;
|
||||||
|
|
||||||
public void commitTransition(boolean animated) {
|
public void commitTransition(boolean animated) {
|
||||||
if (!wasDraw || !animated) {
|
if (!wasDraw || !animated) {
|
||||||
|
@ -133,7 +136,7 @@ public class AvatarsDarawable {
|
||||||
transitionProgressAnimator = null;
|
transitionProgressAnimator = null;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
transitionProgressAnimator.setDuration(220);
|
transitionProgressAnimator.setDuration(transitionDuration);
|
||||||
transitionProgressAnimator.setInterpolator(CubicBezierInterpolator.DEFAULT);
|
transitionProgressAnimator.setInterpolator(CubicBezierInterpolator.DEFAULT);
|
||||||
transitionProgressAnimator.start();
|
transitionProgressAnimator.start();
|
||||||
invalidate();
|
invalidate();
|
||||||
|
|
|
@ -0,0 +1,337 @@
|
||||||
|
package org.telegram.ui.Components;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.graphics.Rect;
|
||||||
|
import android.graphics.drawable.Drawable;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.text.TextUtils;
|
||||||
|
import android.util.TypedValue;
|
||||||
|
import android.view.Gravity;
|
||||||
|
import android.view.HapticFeedbackConstants;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.WindowManager;
|
||||||
|
import android.widget.FrameLayout;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import org.telegram.messenger.AndroidUtilities;
|
||||||
|
import org.telegram.messenger.ImageLocation;
|
||||||
|
import org.telegram.messenger.LocaleController;
|
||||||
|
import org.telegram.messenger.R;
|
||||||
|
import org.telegram.messenger.UserObject;
|
||||||
|
import org.telegram.tgnet.TLRPC;
|
||||||
|
import org.telegram.ui.ActionBar.ActionBarLayout;
|
||||||
|
import org.telegram.ui.ActionBar.ActionBarPopupWindow;
|
||||||
|
import org.telegram.ui.ActionBar.BaseFragment;
|
||||||
|
import org.telegram.ui.ActionBar.Theme;
|
||||||
|
import org.telegram.ui.ChatActivity;
|
||||||
|
import org.telegram.ui.ProfileActivity;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.concurrent.atomic.AtomicReference;
|
||||||
|
|
||||||
|
public class BackButtonMenu {
|
||||||
|
public static class PulledDialog<T> {
|
||||||
|
Class<T> activity;
|
||||||
|
int stackIndex;
|
||||||
|
TLRPC.Chat chat;
|
||||||
|
TLRPC.User user;
|
||||||
|
long dialogId;
|
||||||
|
int folderId;
|
||||||
|
int filterId;
|
||||||
|
}
|
||||||
|
private static HashMap<Integer, ArrayList<PulledDialog>> pulledDialogs;
|
||||||
|
|
||||||
|
public static ActionBarPopupWindow show(BaseFragment fragment, View backButton, long currentDialogId) {
|
||||||
|
if (fragment == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
final ActionBarLayout parentLayout = fragment.getParentLayout();
|
||||||
|
ArrayList<PulledDialog> dialogs = getStackedHistoryDialogs(fragment.getCurrentAccount(), parentLayout == null ? null : parentLayout.fragmentsStack, currentDialogId);
|
||||||
|
if (dialogs.size() <= 0) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
Context context = fragment.getParentActivity();
|
||||||
|
ActionBarPopupWindow.ActionBarPopupWindowLayout layout = new ActionBarPopupWindow.ActionBarPopupWindowLayout(context);
|
||||||
|
android.graphics.Rect backgroundPaddings = new Rect();
|
||||||
|
Drawable shadowDrawable = fragment.getParentActivity().getResources().getDrawable(R.drawable.popup_fixed_alert).mutate();
|
||||||
|
shadowDrawable.getPadding(backgroundPaddings);
|
||||||
|
layout.setBackgroundColor(Theme.getColor(Theme.key_actionBarDefaultSubmenuBackground));
|
||||||
|
|
||||||
|
AtomicReference<ActionBarPopupWindow> scrimPopupWindowRef = new AtomicReference<>();
|
||||||
|
|
||||||
|
for (int i = 0; i < dialogs.size(); ++i) {
|
||||||
|
final PulledDialog pDialog = dialogs.get(i);
|
||||||
|
final TLRPC.Chat chat = pDialog.chat;
|
||||||
|
final TLRPC.User user = pDialog.user;
|
||||||
|
FrameLayout cell = new FrameLayout(context);
|
||||||
|
cell.setMinimumWidth(AndroidUtilities.dp(200));
|
||||||
|
|
||||||
|
BackupImageView imageView = new BackupImageView(context);
|
||||||
|
imageView.setRoundRadius(AndroidUtilities.dp(32));
|
||||||
|
cell.addView(imageView, LayoutHelper.createFrameRelatively(32, 32, Gravity.START | Gravity.CENTER_VERTICAL, 13, 0, 0, 0));
|
||||||
|
|
||||||
|
TextView titleView = new TextView(context);
|
||||||
|
titleView.setLines(1);
|
||||||
|
titleView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16);
|
||||||
|
titleView.setTextColor(Theme.getColor(Theme.key_actionBarDefaultSubmenuItem));
|
||||||
|
titleView.setEllipsize(TextUtils.TruncateAt.END);
|
||||||
|
cell.addView(titleView, LayoutHelper.createFrameRelatively(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.START | Gravity.CENTER_VERTICAL, 59, 0, 12, 0));
|
||||||
|
|
||||||
|
AvatarDrawable avatarDrawable = new AvatarDrawable();
|
||||||
|
avatarDrawable.setSmallSize(true);
|
||||||
|
if (chat != null) {
|
||||||
|
avatarDrawable.setInfo(chat);
|
||||||
|
imageView.setImage(ImageLocation.getForChat(chat, ImageLocation.TYPE_SMALL), "50_50", avatarDrawable, chat);
|
||||||
|
titleView.setText(chat.title);
|
||||||
|
} else if (user != null) {
|
||||||
|
String name;
|
||||||
|
if (pDialog.activity == ChatActivity.class && UserObject.isUserSelf(user)) {
|
||||||
|
name = LocaleController.getString("SavedMessages", R.string.SavedMessages);
|
||||||
|
avatarDrawable.setAvatarType(AvatarDrawable.AVATAR_TYPE_SAVED);
|
||||||
|
imageView.setImageDrawable(avatarDrawable);
|
||||||
|
} else if (UserObject.isReplyUser(user)) {
|
||||||
|
name = LocaleController.getString("RepliesTitle", R.string.RepliesTitle);
|
||||||
|
avatarDrawable.setAvatarType(AvatarDrawable.AVATAR_TYPE_REPLIES);
|
||||||
|
imageView.setImageDrawable(avatarDrawable);
|
||||||
|
} else if (UserObject.isDeleted(user)) {
|
||||||
|
name = LocaleController.getString("HiddenName", R.string.HiddenName);
|
||||||
|
avatarDrawable.setInfo(user);
|
||||||
|
imageView.setImage(ImageLocation.getForUser(user, ImageLocation.TYPE_SMALL), "50_50", avatarDrawable, user);
|
||||||
|
} else {
|
||||||
|
name = UserObject.getUserName(user);
|
||||||
|
avatarDrawable.setInfo(user);
|
||||||
|
imageView.setImage(ImageLocation.getForUser(user, ImageLocation.TYPE_SMALL), "50_50", avatarDrawable, user);
|
||||||
|
}
|
||||||
|
titleView.setText(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
cell.setBackground(Theme.getSelectorDrawable(Theme.getColor(Theme.key_listSelector), false));
|
||||||
|
cell.setOnClickListener(e2 -> {
|
||||||
|
if (scrimPopupWindowRef.get() != null) {
|
||||||
|
scrimPopupWindowRef.getAndSet(null).dismiss();
|
||||||
|
}
|
||||||
|
if (pDialog.stackIndex >= 0) {
|
||||||
|
Long nextFragmentDialogId = null;
|
||||||
|
if (parentLayout == null || parentLayout.fragmentsStack == null || pDialog.stackIndex >= parentLayout.fragmentsStack.size()) {
|
||||||
|
nextFragmentDialogId = null;
|
||||||
|
} else {
|
||||||
|
BaseFragment nextFragment = parentLayout.fragmentsStack.get(pDialog.stackIndex);
|
||||||
|
if (nextFragment instanceof ChatActivity) {
|
||||||
|
nextFragmentDialogId = ((ChatActivity) nextFragment).getDialogId();
|
||||||
|
} else if (nextFragment instanceof ProfileActivity) {
|
||||||
|
nextFragmentDialogId = ((ProfileActivity) nextFragment).getDialogId();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (nextFragmentDialogId != null && nextFragmentDialogId != pDialog.dialogId) {
|
||||||
|
for (int j = parentLayout.fragmentsStack.size() - 2; j > pDialog.stackIndex; --j) {
|
||||||
|
parentLayout.removeFragmentFromStack(j);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (parentLayout != null && parentLayout.fragmentsStack != null) {
|
||||||
|
for (int j = parentLayout.fragmentsStack.size() - 2; j > pDialog.stackIndex; --j) {
|
||||||
|
if (j >= 0 && j < parentLayout.fragmentsStack.size()) {
|
||||||
|
parentLayout.removeFragmentFromStack(j);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (pDialog.stackIndex < parentLayout.fragmentsStack.size()) {
|
||||||
|
parentLayout.showFragment(pDialog.stackIndex);
|
||||||
|
parentLayout.closeLastFragment(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
goToPulledDialog(fragment, pDialog);
|
||||||
|
});
|
||||||
|
layout.addView(cell, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, 48));
|
||||||
|
}
|
||||||
|
|
||||||
|
ActionBarPopupWindow scrimPopupWindow = new ActionBarPopupWindow(layout, LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT);
|
||||||
|
scrimPopupWindowRef.set(scrimPopupWindow);
|
||||||
|
scrimPopupWindow.setPauseNotifications(true);
|
||||||
|
scrimPopupWindow.setDismissAnimationDuration(220);
|
||||||
|
scrimPopupWindow.setOutsideTouchable(true);
|
||||||
|
scrimPopupWindow.setClippingEnabled(true);
|
||||||
|
scrimPopupWindow.setAnimationStyle(R.style.PopupContextAnimation);
|
||||||
|
scrimPopupWindow.setFocusable(true);
|
||||||
|
layout.measure(View.MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(1000), View.MeasureSpec.AT_MOST), View.MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(1000), View.MeasureSpec.AT_MOST));
|
||||||
|
scrimPopupWindow.setInputMethodMode(ActionBarPopupWindow.INPUT_METHOD_NOT_NEEDED);
|
||||||
|
scrimPopupWindow.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_UNSPECIFIED);
|
||||||
|
scrimPopupWindow.getContentView().setFocusableInTouchMode(true);
|
||||||
|
layout.setFitItems(true);
|
||||||
|
|
||||||
|
View fragmentView = fragment.getFragmentView();
|
||||||
|
if (fragmentView != null) {
|
||||||
|
int popupX = AndroidUtilities.dp(8) - backgroundPaddings.left;
|
||||||
|
if (AndroidUtilities.isTablet()) {
|
||||||
|
int[] location = new int[2];
|
||||||
|
fragmentView.getLocationInWindow(location);
|
||||||
|
popupX += location[0];
|
||||||
|
}
|
||||||
|
int popupY = (int) (backButton.getBottom() - backgroundPaddings.top - AndroidUtilities.dp(8));
|
||||||
|
scrimPopupWindow.showAtLocation(fragmentView, Gravity.LEFT | Gravity.TOP, popupX, popupY);
|
||||||
|
|
||||||
|
try {
|
||||||
|
fragmentView.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
|
||||||
|
} catch (Exception ignore) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
return scrimPopupWindow;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void goToPulledDialog(BaseFragment fragment, PulledDialog dialog) {
|
||||||
|
if (dialog == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (dialog.activity == ChatActivity.class) {
|
||||||
|
Bundle bundle = new Bundle();
|
||||||
|
if (dialog.chat != null) {
|
||||||
|
bundle.putLong("chat_id", dialog.chat.id);
|
||||||
|
} else if (dialog.user != null) {
|
||||||
|
bundle.putLong("user_id", dialog.user.id);
|
||||||
|
}
|
||||||
|
bundle.putInt("dialog_folder_id", dialog.folderId);
|
||||||
|
bundle.putInt("dialog_filter_id", dialog.filterId);
|
||||||
|
fragment.presentFragment(new ChatActivity(bundle), true);
|
||||||
|
} else if (dialog.activity == ProfileActivity.class) {
|
||||||
|
Bundle bundle = new Bundle();
|
||||||
|
bundle.putLong("dialog_id", dialog.dialogId);
|
||||||
|
fragment.presentFragment(new ProfileActivity(bundle), true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ArrayList<PulledDialog> getStackedHistoryDialogs(int account, ArrayList<BaseFragment> fragmentsStack, long ignoreDialogId) {
|
||||||
|
ArrayList<PulledDialog> dialogs = new ArrayList<>();
|
||||||
|
if (fragmentsStack != null) {
|
||||||
|
final int count = fragmentsStack.size();
|
||||||
|
for (int i = 0; i < count; ++i) {
|
||||||
|
BaseFragment fragment = fragmentsStack.get(i);
|
||||||
|
Class activity;
|
||||||
|
TLRPC.Chat chat;
|
||||||
|
TLRPC.User user = null;
|
||||||
|
long dialogId;
|
||||||
|
int folderId, filterId;
|
||||||
|
if (fragment instanceof ChatActivity) {
|
||||||
|
activity = ChatActivity.class;
|
||||||
|
ChatActivity chatActivity = (ChatActivity) fragment;
|
||||||
|
if (chatActivity.getChatMode() != 0 || chatActivity.isReport()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
chat = chatActivity.getCurrentChat();
|
||||||
|
user = chatActivity.getCurrentUser();
|
||||||
|
dialogId = chatActivity.getDialogId();
|
||||||
|
folderId = chatActivity.getDialogFolderId();
|
||||||
|
filterId = chatActivity.getDialogFilterId();
|
||||||
|
} else if (fragment instanceof ProfileActivity) {
|
||||||
|
activity = ProfileActivity.class;
|
||||||
|
ProfileActivity profileActivity = (ProfileActivity) fragment;
|
||||||
|
chat = profileActivity.getCurrentChat();
|
||||||
|
try {
|
||||||
|
user = profileActivity.getUserInfo().user;
|
||||||
|
} catch (Exception ignore) {}
|
||||||
|
dialogId = profileActivity.getDialogId();
|
||||||
|
folderId = 0;
|
||||||
|
filterId = 0;
|
||||||
|
} else {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (dialogId != ignoreDialogId && !(ignoreDialogId == 0 && UserObject.isUserSelf(user))) {
|
||||||
|
boolean alreadyAddedDialog = false;
|
||||||
|
for (int d = 0; d < dialogs.size(); ++d) {
|
||||||
|
if (dialogs.get(d).dialogId == dialogId) {
|
||||||
|
alreadyAddedDialog = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!alreadyAddedDialog) {
|
||||||
|
PulledDialog pDialog = new PulledDialog();
|
||||||
|
pDialog.activity = activity;
|
||||||
|
pDialog.stackIndex = i;
|
||||||
|
pDialog.chat = chat;
|
||||||
|
pDialog.user = user;
|
||||||
|
pDialog.dialogId = dialogId;
|
||||||
|
pDialog.folderId = folderId;
|
||||||
|
pDialog.filterId = filterId;
|
||||||
|
if (pDialog.chat != null || pDialog.user != null) {
|
||||||
|
dialogs.add(pDialog);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (pulledDialogs != null) {
|
||||||
|
ArrayList<PulledDialog> pulledDialogsAccount = pulledDialogs.get(account);
|
||||||
|
if (pulledDialogsAccount != null) {
|
||||||
|
for (PulledDialog pulledDialog : pulledDialogsAccount) {
|
||||||
|
if (pulledDialog.dialogId == ignoreDialogId) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
boolean alreadyAddedDialog = false;
|
||||||
|
for (int d = 0; d < dialogs.size(); ++d) {
|
||||||
|
if (dialogs.get(d).dialogId == pulledDialog.dialogId) {
|
||||||
|
alreadyAddedDialog = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!alreadyAddedDialog) {
|
||||||
|
dialogs.add(pulledDialog);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Collections.sort(dialogs, (d1, d2) -> d2.stackIndex - d1.stackIndex);
|
||||||
|
return dialogs;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void addToPulledDialogs(int account, int stackIndex, TLRPC.Chat chat, TLRPC.User user, long dialogId, int folderId, int filterId) {
|
||||||
|
if (chat == null && user == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (pulledDialogs == null) {
|
||||||
|
pulledDialogs = new HashMap<>();
|
||||||
|
}
|
||||||
|
ArrayList<PulledDialog> dialogs = null;
|
||||||
|
if (pulledDialogs.containsKey(account)) {
|
||||||
|
dialogs = pulledDialogs.get(account);
|
||||||
|
}
|
||||||
|
if (dialogs == null) {
|
||||||
|
pulledDialogs.put(account, dialogs = new ArrayList<>());
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean alreadyAdded = false;
|
||||||
|
for (PulledDialog d : dialogs) {
|
||||||
|
if (d.dialogId == dialogId) {
|
||||||
|
alreadyAdded = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!alreadyAdded) {
|
||||||
|
PulledDialog d = new PulledDialog();
|
||||||
|
d.activity = ChatActivity.class;
|
||||||
|
d.stackIndex = stackIndex;
|
||||||
|
d.dialogId = dialogId;
|
||||||
|
d.filterId = filterId;
|
||||||
|
d.folderId = folderId;
|
||||||
|
d.chat = chat;
|
||||||
|
d.user = user;
|
||||||
|
dialogs.add(d);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public static void clearPulledDialogs(int account, int fromIndex) {
|
||||||
|
if (pulledDialogs != null && pulledDialogs.containsKey(account)) {
|
||||||
|
ArrayList<PulledDialog> dialogs = pulledDialogs.get(account);
|
||||||
|
if (dialogs != null) {
|
||||||
|
for (int i = 0; i < dialogs.size(); ++i) {
|
||||||
|
if (dialogs.get(i).stackIndex > fromIndex) {
|
||||||
|
dialogs.remove(i);
|
||||||
|
i--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -44,7 +44,8 @@ public final class BulletinFactory {
|
||||||
PHOTO_TO_DOWNLOADS("PhotoSavedToDownloadsHint", R.string.PhotoSavedToDownloadsHint, Icon.SAVED_TO_DOWNLOADS),
|
PHOTO_TO_DOWNLOADS("PhotoSavedToDownloadsHint", R.string.PhotoSavedToDownloadsHint, Icon.SAVED_TO_DOWNLOADS),
|
||||||
VIDEO_TO_DOWNLOADS("VideoSavedToDownloadsHint", R.string.VideoSavedToDownloadsHint, Icon.SAVED_TO_DOWNLOADS),
|
VIDEO_TO_DOWNLOADS("VideoSavedToDownloadsHint", R.string.VideoSavedToDownloadsHint, Icon.SAVED_TO_DOWNLOADS),
|
||||||
|
|
||||||
GIF("GifSavedToDownloadsHint", Icon.SAVED_TO_DOWNLOADS),
|
GIF("GifSavedHint", R.string.GifSavedHint, Icon.SAVED_TO_GIFS),
|
||||||
|
GIF_TO_DOWNLOADS("GifSavedToDownloadsHint", R.string.GifSavedToDownloadsHint, Icon.SAVED_TO_DOWNLOADS),
|
||||||
|
|
||||||
AUDIO("AudioSavedHint", R.string.AudioSavedHint, Icon.SAVED_TO_MUSIC),
|
AUDIO("AudioSavedHint", R.string.AudioSavedHint, Icon.SAVED_TO_MUSIC),
|
||||||
AUDIOS("AudiosSavedHint", Icon.SAVED_TO_MUSIC),
|
AUDIOS("AudiosSavedHint", Icon.SAVED_TO_MUSIC),
|
||||||
|
@ -87,7 +88,8 @@ public final class BulletinFactory {
|
||||||
|
|
||||||
SAVED_TO_DOWNLOADS(R.raw.ic_download, 2, "Box", "Arrow"),
|
SAVED_TO_DOWNLOADS(R.raw.ic_download, 2, "Box", "Arrow"),
|
||||||
SAVED_TO_GALLERY(R.raw.ic_save_to_gallery, 0, "Box", "Arrow", "Mask", "Arrow 2", "Splash"),
|
SAVED_TO_GALLERY(R.raw.ic_save_to_gallery, 0, "Box", "Arrow", "Mask", "Arrow 2", "Splash"),
|
||||||
SAVED_TO_MUSIC(R.raw.ic_save_to_music, 2, "Box", "Arrow");
|
SAVED_TO_MUSIC(R.raw.ic_save_to_music, 2, "Box", "Arrow"),
|
||||||
|
SAVED_TO_GIFS(R.raw.ic_save_to_gifs, 0, "gif");
|
||||||
|
|
||||||
private final int resId;
|
private final int resId;
|
||||||
private final String[] layers;
|
private final String[] layers;
|
||||||
|
|
|
@ -99,8 +99,6 @@ import androidx.recyclerview.widget.ChatListItemAnimator;
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
import com.google.android.exoplayer2.util.Log;
|
|
||||||
|
|
||||||
import org.telegram.messenger.AccountInstance;
|
import org.telegram.messenger.AccountInstance;
|
||||||
import org.telegram.messenger.AndroidUtilities;
|
import org.telegram.messenger.AndroidUtilities;
|
||||||
import org.telegram.messenger.ApplicationLoader;
|
import org.telegram.messenger.ApplicationLoader;
|
||||||
|
@ -1965,7 +1963,7 @@ public class ChatActivityEnterView extends ChatBlurredFrameLayout implements Not
|
||||||
}
|
}
|
||||||
|
|
||||||
private void editPhoto(Uri uri, String mime) {
|
private void editPhoto(Uri uri, String mime) {
|
||||||
final File file = AndroidUtilities.generatePicturePath(fragment.isSecretChat(), MimeTypeMap.getSingleton().getExtensionFromMimeType(mime));
|
final File file = AndroidUtilities.generatePicturePath(fragment != null && fragment.isSecretChat(), MimeTypeMap.getSingleton().getExtensionFromMimeType(mime));
|
||||||
Utilities.globalQueue.postRunnable(() -> {
|
Utilities.globalQueue.postRunnable(() -> {
|
||||||
try {
|
try {
|
||||||
InputStream in = context.getContentResolver().openInputStream(uri);
|
InputStream in = context.getContentResolver().openInputStream(uri);
|
||||||
|
@ -6571,6 +6569,10 @@ public class ChatActivityEnterView extends ChatBlurredFrameLayout implements Not
|
||||||
return audioVideoButtonContainer;
|
return audioVideoButtonContainer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public View getEmojiButton() {
|
||||||
|
return emojiButton[0];
|
||||||
|
}
|
||||||
|
|
||||||
public EmojiView getEmojiView() {
|
public EmojiView getEmojiView() {
|
||||||
return emojiView;
|
return emojiView;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2305,8 +2305,25 @@ public class EmojiView extends FrameLayout implements NotificationCenter.Notific
|
||||||
@Override
|
@Override
|
||||||
public void setTranslationY(float translationY) {
|
public void setTranslationY(float translationY) {
|
||||||
super.setTranslationY(translationY);
|
super.setTranslationY(translationY);
|
||||||
updateBottomTabContainerPosition();
|
|
||||||
updateStickerTabsPosition();
|
updateStickerTabsPosition();
|
||||||
|
updateBottomTabContainerPosition();
|
||||||
|
}
|
||||||
|
private void updateBottomTabContainerPosition() {
|
||||||
|
if (bottomTabContainer.getTag() == null && (delegate == null || !delegate.isSearchOpened()) && (pager == null || pager.getCurrentItem() != 0)) {
|
||||||
|
View parent = (View) getParent();
|
||||||
|
if (parent != null) {
|
||||||
|
float y = getY() - parent.getHeight();
|
||||||
|
if (getLayoutParams().height > 0) {
|
||||||
|
y += getLayoutParams().height;
|
||||||
|
} else {
|
||||||
|
y += getMeasuredHeight();
|
||||||
|
}
|
||||||
|
if (bottomTabContainer.getTop() - y < 0) {
|
||||||
|
y = bottomTabContainer.getTop();
|
||||||
|
}
|
||||||
|
bottomTabContainer.setTranslationY(-y);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Rect rect = new Rect();
|
Rect rect = new Rect();
|
||||||
|
@ -2342,24 +2359,6 @@ public class EmojiView extends FrameLayout implements NotificationCenter.Notific
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateBottomTabContainerPosition() {
|
|
||||||
if (bottomTabContainer.getTag() == null && (delegate == null || !delegate.isSearchOpened())) {
|
|
||||||
View parent = (View) getParent();
|
|
||||||
if (parent != null) {
|
|
||||||
float y = getY() - parent.getHeight();
|
|
||||||
if (getLayoutParams().height > 0) {
|
|
||||||
y += getLayoutParams().height;
|
|
||||||
} else {
|
|
||||||
y += getMeasuredHeight();
|
|
||||||
}
|
|
||||||
if (bottomTabContainer.getTop() - y < 0) {
|
|
||||||
y = bottomTabContainer.getTop();
|
|
||||||
}
|
|
||||||
bottomTabContainer.setTranslationY(-y);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void dispatchDraw(Canvas canvas) {
|
protected void dispatchDraw(Canvas canvas) {
|
||||||
updateBottomTabContainerPosition();
|
updateBottomTabContainerPosition();
|
||||||
|
@ -3619,11 +3618,11 @@ public class EmojiView extends FrameLayout implements NotificationCenter.Notific
|
||||||
if (newHeight <= lastNotifyHeight) {
|
if (newHeight <= lastNotifyHeight) {
|
||||||
bottomTabContainer.setTranslationY(0);
|
bottomTabContainer.setTranslationY(0);
|
||||||
} else {
|
} else {
|
||||||
float y = getY() + getMeasuredHeight() - parent.getHeight();
|
// float y = getY() + getMeasuredHeight() - parent.getHeight() - bottomTabContainer.getTop();
|
||||||
if (bottomTabContainer.getTop() - y < 0) {
|
// if (bottomTabContainer.getTop() - y < 0) {
|
||||||
y = bottomTabContainer.getTop();
|
// y = bottomTabContainer.getTop();
|
||||||
}
|
// }
|
||||||
bottomTabContainer.setTranslationY(-y);
|
// bottomTabContainer.setTranslationY(-y);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1043,6 +1043,7 @@ public class FragmentContextView extends FrameLayout implements NotificationCent
|
||||||
} else if (fragment instanceof ChatActivity && ((ChatActivity) fragment).getGroupCall() != null && ((ChatActivity) fragment).getGroupCall().shouldShowPanel() && !GroupCallPip.isShowing() && !isPlayingVoice()) {
|
} else if (fragment instanceof ChatActivity && ((ChatActivity) fragment).getGroupCall() != null && ((ChatActivity) fragment).getGroupCall().shouldShowPanel() && !GroupCallPip.isShowing() && !isPlayingVoice()) {
|
||||||
checkCall(true);
|
checkCall(true);
|
||||||
} else {
|
} else {
|
||||||
|
checkCall(true);
|
||||||
checkPlayer(true);
|
checkPlayer(true);
|
||||||
updatePlaybackButton();
|
updatePlaybackButton();
|
||||||
}
|
}
|
||||||
|
@ -1779,6 +1780,10 @@ public class FragmentContextView extends FrameLayout implements NotificationCent
|
||||||
visible = false;
|
visible = false;
|
||||||
setVisibility(GONE);
|
setVisibility(GONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (create && fragment instanceof ChatActivity && ((ChatActivity) fragment).openedWithLivestream() && !GroupCallPip.isShowing()) {
|
||||||
|
BulletinFactory.of(fragment).createSimpleBulletin(R.raw.linkbroken, LocaleController.getString("InviteExpired", R.string.InviteExpired)).show();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
int newStyle;
|
int newStyle;
|
||||||
if (groupActive) {
|
if (groupActive) {
|
||||||
|
|
|
@ -129,7 +129,7 @@ public class GroupedPhotosListView extends View implements GestureDetector.OnGes
|
||||||
}
|
}
|
||||||
MessageObject messageObject = imagesArr.get(currentIndex);
|
MessageObject messageObject = imagesArr.get(currentIndex);
|
||||||
currentObject = messageObject;
|
currentObject = messageObject;
|
||||||
long localGroupId = delegate.validGroupId(messageObject.getGroupIdForUse()) ? messageObject.getGroupIdForUse() : 0;
|
long localGroupId = messageObject.getGroupIdForUse();
|
||||||
if (localGroupId != currentGroupId) {
|
if (localGroupId != currentGroupId) {
|
||||||
changed = true;
|
changed = true;
|
||||||
currentGroupId = localGroupId;
|
currentGroupId = localGroupId;
|
||||||
|
|
|
@ -437,6 +437,7 @@ public class JoinCallAlert extends BottomSheet {
|
||||||
listView.setVerticalScrollBarEnabled(false);
|
listView.setVerticalScrollBarEnabled(false);
|
||||||
listView.setClipToPadding(false);
|
listView.setClipToPadding(false);
|
||||||
listView.setEnabled(true);
|
listView.setEnabled(true);
|
||||||
|
listView.setSelectorDrawableColor(0);
|
||||||
listView.setGlowColor(Theme.getColor(Theme.key_dialogScrollGlow));
|
listView.setGlowColor(Theme.getColor(Theme.key_dialogScrollGlow));
|
||||||
listView.setOnScrollListener(new RecyclerView.OnScrollListener() {
|
listView.setOnScrollListener(new RecyclerView.OnScrollListener() {
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -8,11 +8,11 @@
|
||||||
|
|
||||||
package org.telegram.ui.Components;
|
package org.telegram.ui.Components;
|
||||||
|
|
||||||
|
import android.graphics.CornerPathEffect;
|
||||||
import android.graphics.Path;
|
import android.graphics.Path;
|
||||||
import android.graphics.RectF;
|
import android.graphics.RectF;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.text.Layout;
|
import android.text.Layout;
|
||||||
import android.text.StaticLayout;
|
|
||||||
|
|
||||||
import org.telegram.messenger.AndroidUtilities;
|
import org.telegram.messenger.AndroidUtilities;
|
||||||
|
|
||||||
|
@ -28,10 +28,10 @@ public class LinkPath extends Path {
|
||||||
private boolean allowReset = true;
|
private boolean allowReset = true;
|
||||||
private int baselineShift;
|
private int baselineShift;
|
||||||
private int lineHeight;
|
private int lineHeight;
|
||||||
private ArrayList<RectF> rects = new ArrayList<>();
|
|
||||||
|
|
||||||
private final int radius = AndroidUtilities.dp(4);
|
private static final int radius = AndroidUtilities.dp(4);
|
||||||
private final int halfRadius = radius >> 1;
|
private static final int halfRadius = radius >> 1;
|
||||||
|
public static final CornerPathEffect roundedEffect = new CornerPathEffect(radius);
|
||||||
|
|
||||||
public LinkPath() {
|
public LinkPath() {
|
||||||
super();
|
super();
|
||||||
|
@ -108,9 +108,7 @@ public class LinkPath extends Path {
|
||||||
y += baselineShift;
|
y += baselineShift;
|
||||||
}
|
}
|
||||||
if (useRoundRect) {
|
if (useRoundRect) {
|
||||||
RectF rect = new RectF();
|
super.addRect(left - halfRadius, y, right + halfRadius, y2, dir);
|
||||||
rect.set(left - halfRadius, y, right + halfRadius, y2);
|
|
||||||
rects.add(rect);
|
|
||||||
} else {
|
} else {
|
||||||
super.addRect(left, y, right, y2, dir);
|
super.addRect(left, y, right, y2, dir);
|
||||||
}
|
}
|
||||||
|
@ -122,34 +120,5 @@ public class LinkPath extends Path {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
super.reset();
|
super.reset();
|
||||||
rects.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean containsPoint(float x, float y) {
|
|
||||||
for (RectF rect : rects) {
|
|
||||||
if (rect.contains(x, y)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onPathEnd() {
|
|
||||||
if (useRoundRect) {
|
|
||||||
super.reset();
|
|
||||||
final int count = rects.size();
|
|
||||||
for (int i = 0; i < count; ++i) {
|
|
||||||
float[] radii = new float[8];
|
|
||||||
|
|
||||||
RectF rect = rects.get(i);
|
|
||||||
|
|
||||||
radii[0] = radii[1] = containsPoint(rect.left, rect.top - radius) ? 0 : radius; // top left
|
|
||||||
radii[2] = radii[3] = containsPoint(rect.right, rect.top - radius) ? 0 : radius; // top right
|
|
||||||
radii[4] = radii[5] = containsPoint(rect.right, rect.bottom + radius) ? 0 : radius; // bottom right
|
|
||||||
radii[6] = radii[7] = containsPoint(rect.left, rect.bottom + radius) ? 0 : radius; // bottom left
|
|
||||||
|
|
||||||
super.addRoundRect(rect, radii, Direction.CW);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,8 +22,6 @@ import android.text.TextUtils;
|
||||||
import android.view.HapticFeedbackConstants;
|
import android.view.HapticFeedbackConstants;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
|
||||||
import com.google.android.exoplayer2.util.Log;
|
|
||||||
|
|
||||||
import org.telegram.messenger.AndroidUtilities;
|
import org.telegram.messenger.AndroidUtilities;
|
||||||
import org.telegram.messenger.ApplicationLoader;
|
import org.telegram.messenger.ApplicationLoader;
|
||||||
import org.telegram.messenger.DispatchQueuePool;
|
import org.telegram.messenger.DispatchQueuePool;
|
||||||
|
@ -211,12 +209,18 @@ public class RLottieDrawable extends BitmapDrawable implements Animatable {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void recycleResources() {
|
protected void recycleResources() {
|
||||||
if (renderingBitmap != null) {
|
try {
|
||||||
renderingBitmap.recycle();
|
if (renderingBitmap != null) {
|
||||||
|
renderingBitmap.recycle();
|
||||||
|
renderingBitmap = null;
|
||||||
|
}
|
||||||
|
if (backgroundBitmap != null) {
|
||||||
|
backgroundBitmap.recycle();
|
||||||
|
backgroundBitmap = null;
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
FileLog.e(e);
|
||||||
renderingBitmap = null;
|
renderingBitmap = null;
|
||||||
}
|
|
||||||
if (backgroundBitmap != null) {
|
|
||||||
backgroundBitmap.recycle();
|
|
||||||
backgroundBitmap = null;
|
backgroundBitmap = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -100,7 +100,7 @@ public class ReactedHeaderView extends FrameLayout {
|
||||||
MessagesController ctrl = MessagesController.getInstance(currentAccount);
|
MessagesController ctrl = MessagesController.getInstance(currentAccount);
|
||||||
TLRPC.Chat chat = ctrl.getChat(message.getChatId());
|
TLRPC.Chat chat = ctrl.getChat(message.getChatId());
|
||||||
TLRPC.ChatFull chatInfo = ctrl.getChatFull(message.getChatId());
|
TLRPC.ChatFull chatInfo = ctrl.getChatFull(message.getChatId());
|
||||||
boolean showSeen = chat != null && message.isOutOwner() && message.isSent() && !message.isEditing() && !message.isSending() && !message.isSendError() && !message.isContentUnread() && !message.isUnread() && (ConnectionsManager.getInstance(currentAccount).getCurrentTime() - message.messageOwner.date < 7 * 86400) && (ChatObject.isMegagroup(chat) || !ChatObject.isChannel(chat)) && chatInfo != null && chatInfo.participants_count < MessagesController.getInstance(currentAccount).chatReadMarkSizeThreshold && !(message.messageOwner.action instanceof TLRPC.TL_messageActionChatJoinedByRequest);
|
boolean showSeen = chat != null && message.isOutOwner() && message.isSent() && !message.isEditing() && !message.isSending() && !message.isSendError() && !message.isContentUnread() && !message.isUnread() && (ConnectionsManager.getInstance(currentAccount).getCurrentTime() - message.messageOwner.date < 7 * 86400) && (ChatObject.isMegagroup(chat) || !ChatObject.isChannel(chat)) && chatInfo != null && chatInfo.participants_count <= MessagesController.getInstance(currentAccount).chatReadMarkSizeThreshold && !(message.messageOwner.action instanceof TLRPC.TL_messageActionChatJoinedByRequest);
|
||||||
|
|
||||||
if (showSeen) {
|
if (showSeen) {
|
||||||
TLRPC.TL_messages_getMessageReadParticipants req = new TLRPC.TL_messages_getMessageReadParticipants();
|
TLRPC.TL_messages_getMessageReadParticipants req = new TLRPC.TL_messages_getMessageReadParticipants();
|
||||||
|
|
|
@ -12,16 +12,23 @@ import android.widget.FrameLayout;
|
||||||
|
|
||||||
import org.telegram.messenger.AndroidUtilities;
|
import org.telegram.messenger.AndroidUtilities;
|
||||||
import org.telegram.messenger.ImageLocation;
|
import org.telegram.messenger.ImageLocation;
|
||||||
|
import org.telegram.messenger.ImageReceiver;
|
||||||
import org.telegram.messenger.MediaDataController;
|
import org.telegram.messenger.MediaDataController;
|
||||||
|
import org.telegram.messenger.MessageObject;
|
||||||
import org.telegram.messenger.MessagesController;
|
import org.telegram.messenger.MessagesController;
|
||||||
import org.telegram.tgnet.TLRPC;
|
import org.telegram.tgnet.TLRPC;
|
||||||
import org.telegram.ui.ActionBar.BaseFragment;
|
import org.telegram.ui.ActionBar.BaseFragment;
|
||||||
import org.telegram.ui.Cells.ChatMessageCell;
|
import org.telegram.ui.Cells.ChatMessageCell;
|
||||||
import org.telegram.ui.ChatActivity;
|
import org.telegram.ui.ChatActivity;
|
||||||
|
import org.telegram.ui.Components.AvatarDrawable;
|
||||||
import org.telegram.ui.Components.BackupImageView;
|
import org.telegram.ui.Components.BackupImageView;
|
||||||
import org.telegram.ui.Components.CubicBezierInterpolator;
|
import org.telegram.ui.Components.CubicBezierInterpolator;
|
||||||
|
import org.telegram.ui.Components.RLottieDrawable;
|
||||||
import org.telegram.ui.Components.ReactionsContainerLayout;
|
import org.telegram.ui.Components.ReactionsContainerLayout;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
public class ReactionsEffectOverlay {
|
public class ReactionsEffectOverlay {
|
||||||
|
|
||||||
public final static int LONG_ANIMATION = 0;
|
public final static int LONG_ANIMATION = 0;
|
||||||
|
@ -31,6 +38,7 @@ public class ReactionsEffectOverlay {
|
||||||
private final int animationType;
|
private final int animationType;
|
||||||
@SuppressLint("StaticFieldLeak")
|
@SuppressLint("StaticFieldLeak")
|
||||||
public static ReactionsEffectOverlay currentOverlay;
|
public static ReactionsEffectOverlay currentOverlay;
|
||||||
|
@SuppressLint("StaticFieldLeak")
|
||||||
public static ReactionsEffectOverlay currentShortOverlay;
|
public static ReactionsEffectOverlay currentShortOverlay;
|
||||||
|
|
||||||
private final AnimationView effectImageView;
|
private final AnimationView effectImageView;
|
||||||
|
@ -63,6 +71,9 @@ public class ReactionsEffectOverlay {
|
||||||
private boolean finished;
|
private boolean finished;
|
||||||
private boolean useWindow;
|
private boolean useWindow;
|
||||||
private ViewGroup decorView;
|
private ViewGroup decorView;
|
||||||
|
private static long lastHapticTime;
|
||||||
|
ArrayList<AvatarParticle> avatars = new ArrayList<>();
|
||||||
|
|
||||||
|
|
||||||
private ReactionsEffectOverlay(Context context, BaseFragment fragment, ReactionsContainerLayout reactionsLayout, ChatMessageCell cell, float x, float y, String reaction, int currentAccount, int animationType) {
|
private ReactionsEffectOverlay(Context context, BaseFragment fragment, ReactionsContainerLayout reactionsLayout, ChatMessageCell cell, float x, float y, String reaction, int currentAccount, int animationType) {
|
||||||
this.fragment = fragment;
|
this.fragment = fragment;
|
||||||
|
@ -83,6 +94,82 @@ public class ReactionsEffectOverlay {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (animationType == SHORT_ANIMATION) {
|
||||||
|
Random random = new Random();
|
||||||
|
ArrayList<TLRPC.TL_messagePeerReaction> recentReactions = null;
|
||||||
|
if (cell.getMessageObject().messageOwner.reactions != null) {
|
||||||
|
recentReactions = cell.getMessageObject().messageOwner.reactions.recent_reactions;
|
||||||
|
}
|
||||||
|
if (recentReactions != null) {
|
||||||
|
for (int i = 0; i < recentReactions.size(); i++) {
|
||||||
|
if (reaction.equals(recentReactions.get(i).reaction) && recentReactions.get(i).unread) {
|
||||||
|
TLRPC.User user;
|
||||||
|
TLRPC.Chat chat;
|
||||||
|
|
||||||
|
AvatarDrawable avatarDrawable = new AvatarDrawable();
|
||||||
|
ImageReceiver imageReceiver = new ImageReceiver();
|
||||||
|
long peerId = MessageObject.getPeerId(recentReactions.get(i).peer_id);
|
||||||
|
if (peerId < 0) {
|
||||||
|
chat = MessagesController.getInstance(currentAccount).getChat(-peerId);
|
||||||
|
if (chat == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
avatarDrawable.setInfo(chat);
|
||||||
|
imageReceiver.setForUserOrChat(chat, avatarDrawable);
|
||||||
|
} else {
|
||||||
|
user = MessagesController.getInstance(currentAccount).getUser(peerId);
|
||||||
|
if (user == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
avatarDrawable.setInfo(user);
|
||||||
|
imageReceiver.setForUserOrChat(user, avatarDrawable);
|
||||||
|
}
|
||||||
|
|
||||||
|
AvatarParticle avatarParticle = new AvatarParticle();
|
||||||
|
avatarParticle.imageReceiver = imageReceiver;
|
||||||
|
avatarParticle.fromX = 0.5f;// + Math.abs(random.nextInt() % 100) / 100f * 0.2f;
|
||||||
|
avatarParticle.fromY = 0.5f;// + Math.abs(random.nextInt() % 100) / 100f * 0.2f;
|
||||||
|
avatarParticle.jumpY = 0.3f + Math.abs(random.nextInt() % 100) / 100f * 0.1f;
|
||||||
|
avatarParticle.randomScale = 0.8f + Math.abs(random.nextInt() % 100) / 100f * 0.4f;
|
||||||
|
avatarParticle.randomRotation = 60 * Math.abs(random.nextInt() % 100) / 100f;
|
||||||
|
avatarParticle.leftTime = (int) (400 + Math.abs(random.nextInt() % 100) / 100f * 200);
|
||||||
|
|
||||||
|
if (avatars.isEmpty()) {
|
||||||
|
avatarParticle.toX = 0.2f + 0.6f * Math.abs(random.nextInt() % 100) / 100f;
|
||||||
|
avatarParticle.toY = 0.4f * Math.abs(random.nextInt() % 100) / 100f;
|
||||||
|
} else {
|
||||||
|
float bestDistance = 0;
|
||||||
|
float bestX = 0;
|
||||||
|
float bestY = 0;
|
||||||
|
for (int k = 0; k < 10; k++) {
|
||||||
|
float randX = 0.2f + 0.6f * Math.abs(random.nextInt() % 100) / 100f;
|
||||||
|
float randY = 0.2f + 0.4f * Math.abs(random.nextInt() % 100) / 100f;
|
||||||
|
float minDistance = Integer.MAX_VALUE;
|
||||||
|
for (int j = 0; j < avatars.size(); j++) {
|
||||||
|
float rx = avatars.get(j).toX - randX;
|
||||||
|
float ry = avatars.get(j).toY - randY;
|
||||||
|
float distance = rx * rx + ry * ry;
|
||||||
|
if (distance < minDistance) {
|
||||||
|
minDistance = distance;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (minDistance > bestDistance) {
|
||||||
|
bestDistance = minDistance;
|
||||||
|
bestX = randX;
|
||||||
|
bestY = randY;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
avatarParticle.toX = bestX;
|
||||||
|
avatarParticle.toY = bestY;
|
||||||
|
}
|
||||||
|
|
||||||
|
avatars.add(avatarParticle);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
boolean fromHolder = holderView != null || (x != 0 && y != 0);
|
boolean fromHolder = holderView != null || (x != 0 && y != 0);
|
||||||
if (holderView != null) {
|
if (holderView != null) {
|
||||||
holderView.getLocationOnScreen(loc);
|
holderView.getLocationOnScreen(loc);
|
||||||
|
@ -306,8 +393,90 @@ public class ReactionsEffectOverlay {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (!avatars.isEmpty() && effectImageView.wasPlaying) {
|
||||||
|
RLottieDrawable animation = effectImageView.getImageReceiver().getLottieAnimation();
|
||||||
|
|
||||||
|
for (int i = 0; i < avatars.size(); i++) {
|
||||||
|
AvatarParticle particle = avatars.get(i);
|
||||||
|
float progress = particle.progress;
|
||||||
|
boolean isLeft;
|
||||||
|
if (animation != null && animation.isRunning()) {
|
||||||
|
long duration = effectImageView.getImageReceiver().getLottieAnimation().getDuration();
|
||||||
|
int totalFramesCount = effectImageView.getImageReceiver().getLottieAnimation().getFramesCount();
|
||||||
|
int currentFrame = effectImageView.getImageReceiver().getLottieAnimation().getCurrentFrame();
|
||||||
|
int timeLeft = (int) (duration - duration * (currentFrame / (float) totalFramesCount));
|
||||||
|
isLeft = timeLeft < particle.leftTime;
|
||||||
|
} else {
|
||||||
|
isLeft = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isLeft && particle.outProgress != 1f) {
|
||||||
|
particle.outProgress += 16f / 150f;
|
||||||
|
if (particle.outProgress > 1f) {
|
||||||
|
particle.outProgress = 1f;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
float jumpProgress = progress < 0.5f ? (progress / 0.5f) : (1f - ((progress - 0.5f) / 0.5f));
|
||||||
|
float avatarX = particle.fromX * (1f - progress) + particle.toX * progress;
|
||||||
|
float avatarY = particle.fromY * (1f - progress) + particle.toY * progress - particle.jumpY * jumpProgress;
|
||||||
|
|
||||||
|
float s = progress * particle.randomScale * (1f - particle.outProgress);
|
||||||
|
float cx = effectImageView.getX() + (effectImageView.getWidth() * effectImageView.getScaleX()) * avatarX;
|
||||||
|
float cy = effectImageView.getY() + (effectImageView.getHeight() * effectImageView.getScaleY()) * avatarY;
|
||||||
|
int size = AndroidUtilities.dp(16);
|
||||||
|
avatars.get(i).imageReceiver.setImageCoords(cx - size / 2f, cy - size / 2f, size, size);
|
||||||
|
avatars.get(i).imageReceiver.setRoundRadius(size >> 1);
|
||||||
|
canvas.save();
|
||||||
|
canvas.translate(0, particle.globalTranslationY);
|
||||||
|
canvas.scale(s, s, cx, cy);
|
||||||
|
canvas.rotate(particle.currentRotation, cx, cy);
|
||||||
|
|
||||||
|
avatars.get(i).imageReceiver.draw(canvas);
|
||||||
|
canvas.restore();
|
||||||
|
|
||||||
|
if (particle.progress < 1f) {
|
||||||
|
particle.progress += 16f / 350f;
|
||||||
|
if (particle.progress > 1f) {
|
||||||
|
particle.progress = 1f;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (progress >= 1f) {
|
||||||
|
particle.globalTranslationY += AndroidUtilities.dp(20) * 16f / 500f;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (particle.incrementRotation) {
|
||||||
|
particle.currentRotation += particle.randomRotation / 250f;
|
||||||
|
if (particle.currentRotation > particle.randomRotation) {
|
||||||
|
particle.incrementRotation = false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
particle.currentRotation -= particle.randomRotation / 250f;
|
||||||
|
if (particle.currentRotation < -particle.randomRotation) {
|
||||||
|
particle.incrementRotation = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
invalidate();
|
invalidate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onAttachedToWindow() {
|
||||||
|
super.onAttachedToWindow();
|
||||||
|
for (int i = 0; i < avatars.size(); i++) {
|
||||||
|
avatars.get(i).imageReceiver.onAttachedToWindow();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onDetachedFromWindow() {
|
||||||
|
super.onDetachedFromWindow();
|
||||||
|
for (int i = 0; i < avatars.size(); i++) {
|
||||||
|
avatars.get(i).imageReceiver.onDetachedFromWindow();
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
effectImageView = new AnimationView(context);
|
effectImageView = new AnimationView(context);
|
||||||
emojiImageView = new AnimationView(context);
|
emojiImageView = new AnimationView(context);
|
||||||
|
@ -461,6 +630,10 @@ public class ReactionsEffectOverlay {
|
||||||
public static void startAnimation() {
|
public static void startAnimation() {
|
||||||
if (currentOverlay != null) {
|
if (currentOverlay != null) {
|
||||||
currentOverlay.started = true;
|
currentOverlay.started = true;
|
||||||
|
if (currentOverlay.animationType == LONG_ANIMATION && System.currentTimeMillis() - lastHapticTime > 200) {
|
||||||
|
lastHapticTime = System.currentTimeMillis();
|
||||||
|
currentOverlay.cell.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
startShortAnimation();
|
startShortAnimation();
|
||||||
if (currentShortOverlay != null) {
|
if (currentShortOverlay != null) {
|
||||||
|
@ -472,7 +645,8 @@ public class ReactionsEffectOverlay {
|
||||||
public static void startShortAnimation() {
|
public static void startShortAnimation() {
|
||||||
if (currentShortOverlay != null && !currentShortOverlay.started) {
|
if (currentShortOverlay != null && !currentShortOverlay.started) {
|
||||||
currentShortOverlay.started = true;
|
currentShortOverlay.started = true;
|
||||||
if (currentShortOverlay.animationType == SHORT_ANIMATION) {
|
if (currentShortOverlay.animationType == SHORT_ANIMATION && System.currentTimeMillis() - lastHapticTime > 200) {
|
||||||
|
lastHapticTime = System.currentTimeMillis();
|
||||||
currentShortOverlay.cell.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP);
|
currentShortOverlay.cell.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -534,4 +708,23 @@ public class ReactionsEffectOverlay {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private class AvatarParticle {
|
||||||
|
ImageReceiver imageReceiver;
|
||||||
|
|
||||||
|
public int leftTime;
|
||||||
|
float progress;
|
||||||
|
float outProgress;
|
||||||
|
float jumpY;
|
||||||
|
float fromX;
|
||||||
|
float fromY;
|
||||||
|
float toX;
|
||||||
|
float toY;
|
||||||
|
float randomScale;
|
||||||
|
float randomRotation;
|
||||||
|
float currentRotation;
|
||||||
|
boolean incrementRotation;
|
||||||
|
float globalTranslationY;
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,8 +9,7 @@ import android.view.MotionEvent;
|
||||||
import android.view.ViewConfiguration;
|
import android.view.ViewConfiguration;
|
||||||
|
|
||||||
import androidx.core.graphics.ColorUtils;
|
import androidx.core.graphics.ColorUtils;
|
||||||
|
import androidx.recyclerview.widget.ChatListItemAnimator;
|
||||||
import com.google.android.exoplayer2.util.Log;
|
|
||||||
|
|
||||||
import org.telegram.messenger.AndroidUtilities;
|
import org.telegram.messenger.AndroidUtilities;
|
||||||
import org.telegram.messenger.ApplicationLoader;
|
import org.telegram.messenger.ApplicationLoader;
|
||||||
|
@ -560,6 +559,8 @@ public class ReactionsLayoutInBubble {
|
||||||
if (users != null) {
|
if (users != null) {
|
||||||
if (avatarsDarawable == null) {
|
if (avatarsDarawable == null) {
|
||||||
avatarsDarawable = new AvatarsDarawable(parentView, false);
|
avatarsDarawable = new AvatarsDarawable(parentView, false);
|
||||||
|
avatarsDarawable.transitionDuration = ChatListItemAnimator.DEFAULT_DURATION;
|
||||||
|
avatarsDarawable.transitionInterpolator = ChatListItemAnimator.DEFAULT_INTERPOLATOR;
|
||||||
avatarsDarawable.setSize(AndroidUtilities.dp(20));
|
avatarsDarawable.setSize(AndroidUtilities.dp(20));
|
||||||
avatarsDarawable.width = AndroidUtilities.dp(100);
|
avatarsDarawable.width = AndroidUtilities.dp(100);
|
||||||
avatarsDarawable.height = height;
|
avatarsDarawable.height = height;
|
||||||
|
|
|
@ -51,7 +51,6 @@ import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
public class ReactionsContainerLayout extends FrameLayout implements NotificationCenter.NotificationCenterDelegate {
|
public class ReactionsContainerLayout extends FrameLayout implements NotificationCenter.NotificationCenterDelegate {
|
||||||
public final static Property<ReactionsContainerLayout, Float> TRANSITION_PROGRESS_VALUE = new Property<ReactionsContainerLayout, Float>(Float.class, "transitionProgress") {
|
public final static Property<ReactionsContainerLayout, Float> TRANSITION_PROGRESS_VALUE = new Property<ReactionsContainerLayout, Float>(Float.class, "transitionProgress") {
|
||||||
|
@ -66,8 +65,6 @@ public class ReactionsContainerLayout extends FrameLayout implements Notificatio
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
private final static Random RANDOM = new Random();
|
|
||||||
|
|
||||||
private final static int ALPHA_DURATION = 150;
|
private final static int ALPHA_DURATION = 150;
|
||||||
private final static float SIDE_SCALE = 0.6f;
|
private final static float SIDE_SCALE = 0.6f;
|
||||||
private final static float SCALE_PROGRESS = 0.75f;
|
private final static float SCALE_PROGRESS = 0.75f;
|
||||||
|
@ -127,7 +124,7 @@ public class ReactionsContainerLayout extends FrameLayout implements Notificatio
|
||||||
recyclerListView = new RecyclerListView(context) {
|
recyclerListView = new RecyclerListView(context) {
|
||||||
@Override
|
@Override
|
||||||
public boolean drawChild(Canvas canvas, View child, long drawingTime) {
|
public boolean drawChild(Canvas canvas, View child, long drawingTime) {
|
||||||
if (pressedReaction != null && ((ReactionHolderView) child).currentReaction.equals(pressedReaction)) {
|
if (pressedReaction != null && ((ReactionHolderView) child).currentReaction.reaction.equals(pressedReaction)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return super.drawChild(canvas, child, drawingTime);
|
return super.drawChild(canvas, child, drawingTime);
|
||||||
|
@ -377,7 +374,17 @@ public class ReactionsContainerLayout extends FrameLayout implements Notificatio
|
||||||
}
|
}
|
||||||
|
|
||||||
canvas.save();
|
canvas.save();
|
||||||
canvas.translate(recyclerListView.getX() + view.getX(), recyclerListView.getY() + view.getY());
|
float x = recyclerListView.getX() + view.getX();
|
||||||
|
float additionalWidth = (view.getMeasuredWidth() * view.getScaleX() - view.getMeasuredWidth()) / 2f;
|
||||||
|
if (x - additionalWidth < 0) {
|
||||||
|
view.setTranslationX(-(x - additionalWidth));
|
||||||
|
} else if (x + view.getMeasuredWidth() + additionalWidth > getMeasuredWidth()) {
|
||||||
|
view.setTranslationX(getMeasuredWidth() - x - view.getMeasuredWidth() - additionalWidth);
|
||||||
|
} else {
|
||||||
|
view.setTranslationX(0);
|
||||||
|
}
|
||||||
|
x = recyclerListView.getX() + view.getX();
|
||||||
|
canvas.translate(x, recyclerListView.getY() + view.getY());
|
||||||
canvas.scale(view.getScaleX(), view.getScaleY(), view.getPivotX(), view.getPivotY());
|
canvas.scale(view.getScaleX(), view.getScaleY(), view.getPivotX(), view.getPivotY());
|
||||||
view.draw(canvas);
|
view.draw(canvas);
|
||||||
canvas.restore();
|
canvas.restore();
|
||||||
|
|
|
@ -912,8 +912,7 @@ public class ShareAlert extends BottomSheet implements NotificationCenter.Notifi
|
||||||
return y >= AndroidUtilities.dp(darkTheme && linkToCopy[1] != null ? 111 : 58) + (Build.VERSION.SDK_INT >= 21 ? AndroidUtilities.statusBarHeight : 0);
|
return y >= AndroidUtilities.dp(darkTheme && linkToCopy[1] != null ? 111 : 58) + (Build.VERSION.SDK_INT >= 21 ? AndroidUtilities.statusBarHeight : 0);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
gridView.setSelectorRadius(AndroidUtilities.dp(8));
|
gridView.setSelectorDrawableColor(0);
|
||||||
gridView.setSelectorDrawableColor(Theme.getColor(Theme.key_listSelector));
|
|
||||||
gridView.setPadding(0, 0, 0, AndroidUtilities.dp(48));
|
gridView.setPadding(0, 0, 0, AndroidUtilities.dp(48));
|
||||||
gridView.setClipToPadding(false);
|
gridView.setClipToPadding(false);
|
||||||
gridView.setLayoutManager(layoutManager = new GridLayoutManager(getContext(), 4));
|
gridView.setLayoutManager(layoutManager = new GridLayoutManager(getContext(), 4));
|
||||||
|
@ -973,6 +972,7 @@ public class ShareAlert extends BottomSheet implements NotificationCenter.Notifi
|
||||||
return y >= AndroidUtilities.dp(darkTheme && linkToCopy[1] != null ? 111 : 58) + (Build.VERSION.SDK_INT >= 21 ? AndroidUtilities.statusBarHeight : 0);
|
return y >= AndroidUtilities.dp(darkTheme && linkToCopy[1] != null ? 111 : 58) + (Build.VERSION.SDK_INT >= 21 ? AndroidUtilities.statusBarHeight : 0);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
searchGridView.setSelectorDrawableColor(0);
|
||||||
searchGridView.setPadding(0, 0, 0, AndroidUtilities.dp(48));
|
searchGridView.setPadding(0, 0, 0, AndroidUtilities.dp(48));
|
||||||
searchGridView.setClipToPadding(false);
|
searchGridView.setClipToPadding(false);
|
||||||
searchGridView.setLayoutManager(searchLayoutManager = new FillLastGridLayoutManager(getContext(), 4, 0, searchGridView));
|
searchGridView.setLayoutManager(searchLayoutManager = new FillLastGridLayoutManager(getContext(), 4, 0, searchGridView));
|
||||||
|
|
|
@ -2220,6 +2220,9 @@ public class SharedMediaLayout extends FrameLayout implements NotificationCenter
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateForwardItem() {
|
private void updateForwardItem() {
|
||||||
|
if (forwardItem == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
boolean noforwards = profileActivity.getMessagesController().isChatNoForwards(-dialog_id) || hasNoforwardsMessage();
|
boolean noforwards = profileActivity.getMessagesController().isChatNoForwards(-dialog_id) || hasNoforwardsMessage();
|
||||||
forwardItem.setAlpha(noforwards ? 0.5f : 1f);
|
forwardItem.setAlpha(noforwards ? 0.5f : 1f);
|
||||||
if (noforwards && forwardItem.getBackground() != null) {
|
if (noforwards && forwardItem.getBackground() != null) {
|
||||||
|
|
|
@ -87,7 +87,6 @@ public class SizeNotifierFrameLayout extends FrameLayout {
|
||||||
@Override
|
@Override
|
||||||
protected void onDraw(Canvas canvas) {
|
protected void onDraw(Canvas canvas) {
|
||||||
if (backgroundDrawable == null || skipBackgroundDrawing) {
|
if (backgroundDrawable == null || skipBackgroundDrawing) {
|
||||||
super.onDraw(canvas);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Drawable newDrawable = getNewDrawable();
|
Drawable newDrawable = getNewDrawable();
|
||||||
|
|
|
@ -172,6 +172,7 @@ public class StaticLayoutEx {
|
||||||
.setAlignment(align)
|
.setAlignment(align)
|
||||||
.setLineSpacing(spacingAdd, spacingMult)
|
.setLineSpacing(spacingAdd, spacingMult)
|
||||||
.setIncludePad(includePad)
|
.setIncludePad(includePad)
|
||||||
|
.setEllipsize(ellipsize)
|
||||||
.setEllipsizedWidth(ellipsisWidth)
|
.setEllipsizedWidth(ellipsisWidth)
|
||||||
.setMaxLines(maxLines)
|
.setMaxLines(maxLines)
|
||||||
.setBreakStrategy(canContainUrl ? StaticLayout.BREAK_STRATEGY_HIGH_QUALITY : StaticLayout.BREAK_STRATEGY_SIMPLE)
|
.setBreakStrategy(canContainUrl ? StaticLayout.BREAK_STRATEGY_HIGH_QUALITY : StaticLayout.BREAK_STRATEGY_SIMPLE)
|
||||||
|
|
|
@ -864,18 +864,22 @@ public class TranslateAlert extends Dialog {
|
||||||
}
|
}
|
||||||
|
|
||||||
public String languageName(String locale) {
|
public String languageName(String locale) {
|
||||||
|
// sorry, no more vodka
|
||||||
if (locale == null || locale.equals("und") || locale.equals("auto")) {
|
if (locale == null || locale.equals("und") || locale.equals("auto")) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
LocaleController.LocaleInfo localeInfo = LocaleController.getInstance().getBuiltinLanguageByPlural(locale);
|
LocaleController.LocaleInfo thisLanguageInfo = LocaleController.getInstance().getBuiltinLanguageByPlural(locale),
|
||||||
if (localeInfo == null) {
|
currentLanguageInfo = LocaleController.getInstance().getCurrentLocaleInfo();
|
||||||
|
if (thisLanguageInfo == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
boolean isCurrentLanguageEnglish = false;
|
boolean isCurrentLanguageEnglish = currentLanguageInfo != null && "en".equals(currentLanguageInfo.pluralLangCode);
|
||||||
try {
|
if (isCurrentLanguageEnglish) {
|
||||||
isCurrentLanguageEnglish = LocaleController.getInstance().getCurrentLocaleInfo().pluralLangCode.equals("en");
|
// trying to show this language in a language of the interface, but there are only names in english and its own
|
||||||
} catch (Exception e) {}
|
return thisLanguageInfo.nameEnglish;
|
||||||
return isCurrentLanguageEnglish ? localeInfo.nameEnglish : localeInfo.name;
|
} else {
|
||||||
|
return thisLanguageInfo.name;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateSourceLanguage() {
|
public void updateSourceLanguage() {
|
||||||
|
|
|
@ -163,7 +163,7 @@ public class VideoPlayer implements ExoPlayer.EventListener, SimpleExoPlayer.Vid
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ensurePleyaerCreated() {
|
private void ensurePlayerCreated() {
|
||||||
DefaultLoadControl loadControl = new DefaultLoadControl(
|
DefaultLoadControl loadControl = new DefaultLoadControl(
|
||||||
new DefaultAllocator(true, C.DEFAULT_BUFFER_SEGMENT_SIZE),
|
new DefaultAllocator(true, C.DEFAULT_BUFFER_SEGMENT_SIZE),
|
||||||
DefaultLoadControl.DEFAULT_MIN_BUFFER_MS,
|
DefaultLoadControl.DEFAULT_MIN_BUFFER_MS,
|
||||||
|
@ -266,7 +266,7 @@ public class VideoPlayer implements ExoPlayer.EventListener, SimpleExoPlayer.Vid
|
||||||
mixedAudio = true;
|
mixedAudio = true;
|
||||||
audioPlayerReady = false;
|
audioPlayerReady = false;
|
||||||
videoPlayerReady = false;
|
videoPlayerReady = false;
|
||||||
ensurePleyaerCreated();
|
ensurePlayerCreated();
|
||||||
MediaSource mediaSource1 = null, mediaSource2 = null;
|
MediaSource mediaSource1 = null, mediaSource2 = null;
|
||||||
for (int a = 0; a < 2; a++) {
|
for (int a = 0; a < 2; a++) {
|
||||||
MediaSource mediaSource;
|
MediaSource mediaSource;
|
||||||
|
@ -316,7 +316,7 @@ public class VideoPlayer implements ExoPlayer.EventListener, SimpleExoPlayer.Vid
|
||||||
currentUri = uri;
|
currentUri = uri;
|
||||||
String scheme = uri.getScheme();
|
String scheme = uri.getScheme();
|
||||||
isStreaming = scheme != null && !scheme.startsWith("file");
|
isStreaming = scheme != null && !scheme.startsWith("file");
|
||||||
ensurePleyaerCreated();
|
ensurePlayerCreated();
|
||||||
MediaSource mediaSource;
|
MediaSource mediaSource;
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case "dash":
|
case "dash":
|
||||||
|
|
|
@ -712,6 +712,7 @@ public class SpoilerEffect extends Drawable {
|
||||||
public static void renderWithRipple(View v, boolean invalidateSpoilersParent, int spoilersColor, int verticalOffset, AtomicReference<Layout> patchedLayoutRef, Layout textLayout, List<SpoilerEffect> spoilers, Canvas canvas) {
|
public static void renderWithRipple(View v, boolean invalidateSpoilersParent, int spoilersColor, int verticalOffset, AtomicReference<Layout> patchedLayoutRef, Layout textLayout, List<SpoilerEffect> spoilers, Canvas canvas) {
|
||||||
if (spoilers.isEmpty()) {
|
if (spoilers.isEmpty()) {
|
||||||
textLayout.draw(canvas);
|
textLayout.draw(canvas);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
Layout pl = patchedLayoutRef.get();
|
Layout pl = patchedLayoutRef.get();
|
||||||
|
|
||||||
|
@ -748,8 +749,9 @@ public class SpoilerEffect extends Drawable {
|
||||||
.setAlignment(Layout.Alignment.ALIGN_NORMAL)
|
.setAlignment(Layout.Alignment.ALIGN_NORMAL)
|
||||||
.setLineSpacing(textLayout.getSpacingAdd(), textLayout.getSpacingMultiplier())
|
.setLineSpacing(textLayout.getSpacingAdd(), textLayout.getSpacingMultiplier())
|
||||||
.build();
|
.build();
|
||||||
} else
|
} else {
|
||||||
layout = new StaticLayout(sb, textLayout.getPaint(), textLayout.getWidth(), textLayout.getAlignment(), textLayout.getSpacingMultiplier(), textLayout.getSpacingAdd(), false);
|
layout = new StaticLayout(sb, textLayout.getPaint(), textLayout.getWidth(), textLayout.getAlignment(), textLayout.getSpacingMultiplier(), textLayout.getSpacingAdd(), false);
|
||||||
|
}
|
||||||
patchedLayoutRef.set(pl = layout);
|
patchedLayoutRef.set(pl = layout);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -213,7 +213,7 @@ public class AcceptDeclineView extends View {
|
||||||
leftAnimator = animator;
|
leftAnimator = animator;
|
||||||
if (listener != null) {
|
if (listener != null) {
|
||||||
if ((!startDrag && Math.abs(dy) < touchSlop && !screenWasWakeup) || leftOffsetX > maxOffset * 0.8f) {
|
if ((!startDrag && Math.abs(dy) < touchSlop && !screenWasWakeup) || leftOffsetX > maxOffset * 0.8f) {
|
||||||
listener.onDicline();
|
listener.onDecline();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -387,7 +387,7 @@ public class AcceptDeclineView extends View {
|
||||||
public interface Listener {
|
public interface Listener {
|
||||||
void onAccept();
|
void onAccept();
|
||||||
|
|
||||||
void onDicline();
|
void onDecline();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRetryMod(boolean retryMod) {
|
public void setRetryMod(boolean retryMod) {
|
||||||
|
@ -481,7 +481,7 @@ public class AcceptDeclineView extends View {
|
||||||
if (virtualViewId == ACCEPT_VIEW_ID) {
|
if (virtualViewId == ACCEPT_VIEW_ID) {
|
||||||
listener.onAccept();
|
listener.onAccept();
|
||||||
} else if (virtualViewId == DECLINE_VIEW_ID) {
|
} else if (virtualViewId == DECLINE_VIEW_ID) {
|
||||||
listener.onDicline();
|
listener.onDecline();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -534,7 +534,7 @@ public class VoIPFloatingLayout extends FrameLayout {
|
||||||
active = b;
|
active = b;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void saveRelatedPosition() {
|
public void saveRelativePosition() {
|
||||||
if (getMeasuredWidth() > 0 && relativePositionToSetX < 0) {
|
if (getMeasuredWidth() > 0 && relativePositionToSetX < 0) {
|
||||||
ViewParent parent = getParent();
|
ViewParent parent = getParent();
|
||||||
if (parent == null) {
|
if (parent == null) {
|
||||||
|
|
|
@ -363,9 +363,7 @@ public class VoIPTextureView extends FrameLayout {
|
||||||
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
|
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
|
||||||
updateRendererSize();
|
updateRendererSize();
|
||||||
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
|
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
|
||||||
if (!applyRotation) {
|
renderer.updateRotation();
|
||||||
renderer.updateRotation();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void updateRendererSize() {
|
protected void updateRendererSize() {
|
||||||
|
|
|
@ -732,7 +732,11 @@ public class ContentPreviewViewer {
|
||||||
}
|
}
|
||||||
currentStickerSet = newSet;
|
currentStickerSet = newSet;
|
||||||
TLRPC.PhotoSize thumb = FileLoader.getClosestPhotoSizeWithSize(document.thumbs, 90);
|
TLRPC.PhotoSize thumb = FileLoader.getClosestPhotoSizeWithSize(document.thumbs, 90);
|
||||||
centerImage.setImage(ImageLocation.getForDocument(document), null, ImageLocation.getForDocument(thumb, document), null, "webp", currentStickerSet, 1);
|
if (MessageObject.isVideoStickerDocument(document)) {
|
||||||
|
centerImage.setImage(ImageLocation.getForDocument(document), null, ImageLocation.getForDocument(thumb, document), null, null, 0, "webp", currentStickerSet, 1);
|
||||||
|
} else {
|
||||||
|
centerImage.setImage(ImageLocation.getForDocument(document), null, ImageLocation.getForDocument(thumb, document), null, "webp", currentStickerSet, 1);
|
||||||
|
}
|
||||||
for (int a = 0; a < document.attributes.size(); a++) {
|
for (int a = 0; a < document.attributes.size(); a++) {
|
||||||
TLRPC.DocumentAttribute attribute = document.attributes.get(a);
|
TLRPC.DocumentAttribute attribute = document.attributes.get(a);
|
||||||
if (attribute instanceof TLRPC.TL_documentAttributeSticker) {
|
if (attribute instanceof TLRPC.TL_documentAttributeSticker) {
|
||||||
|
@ -972,5 +976,4 @@ public class ContentPreviewViewer {
|
||||||
Integer color = resourcesProvider != null ? resourcesProvider.getColor(key) : null;
|
Integer color = resourcesProvider != null ? resourcesProvider.getColor(key) : null;
|
||||||
return color != null ? color : Theme.getColor(key);
|
return color != null ? color : Theme.getColor(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,6 @@ import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
import android.view.Gravity;
|
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
|
@ -32,11 +31,6 @@ import org.telegram.messenger.MessagesController;
|
||||||
import org.telegram.messenger.NotificationCenter;
|
import org.telegram.messenger.NotificationCenter;
|
||||||
import org.telegram.messenger.R;
|
import org.telegram.messenger.R;
|
||||||
import org.telegram.messenger.Utilities;
|
import org.telegram.messenger.Utilities;
|
||||||
import org.telegram.ui.ActionBar.AlertDialog;
|
|
||||||
import org.telegram.ui.ActionBar.Theme;
|
|
||||||
import org.telegram.ui.ActionBar.ThemeDescription;
|
|
||||||
import org.telegram.ui.Cells.HeaderCell;
|
|
||||||
import org.telegram.ui.Cells.LanguageCell;
|
|
||||||
import org.telegram.ui.ActionBar.ActionBar;
|
import org.telegram.ui.ActionBar.ActionBar;
|
||||||
import org.telegram.ui.ActionBar.ActionBarMenu;
|
import org.telegram.ui.ActionBar.ActionBarMenu;
|
||||||
import org.telegram.ui.ActionBar.ActionBarMenuItem;
|
import org.telegram.ui.ActionBar.ActionBarMenuItem;
|
||||||
|
@ -60,7 +54,6 @@ import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Set;
|
|
||||||
import java.util.Timer;
|
import java.util.Timer;
|
||||||
|
|
||||||
public class LanguageSelectActivity extends BaseFragment implements NotificationCenter.NotificationCenterDelegate {
|
public class LanguageSelectActivity extends BaseFragment implements NotificationCenter.NotificationCenterDelegate {
|
||||||
|
@ -175,8 +168,9 @@ public class LanguageSelectActivity extends BaseFragment implements Notification
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
boolean search = listView.getAdapter() == searchListViewAdapter;
|
boolean search = listView.getAdapter() == searchListViewAdapter;
|
||||||
if (!search)
|
if (!search) {
|
||||||
position -= 2;
|
position -= 2;
|
||||||
|
}
|
||||||
LocaleController.LocaleInfo localeInfo;
|
LocaleController.LocaleInfo localeInfo;
|
||||||
if (search) {
|
if (search) {
|
||||||
localeInfo = searchResult.get(position);
|
localeInfo = searchResult.get(position);
|
||||||
|
@ -219,8 +213,9 @@ public class LanguageSelectActivity extends BaseFragment implements Notification
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
boolean search = listView.getAdapter() == searchListViewAdapter;
|
boolean search = listView.getAdapter() == searchListViewAdapter;
|
||||||
if (!search)
|
if (!search) {
|
||||||
position--;
|
position -= 2;
|
||||||
|
}
|
||||||
LocaleController.LocaleInfo localeInfo;
|
LocaleController.LocaleInfo localeInfo;
|
||||||
if (search) {
|
if (search) {
|
||||||
localeInfo = searchResult.get(position);
|
localeInfo = searchResult.get(position);
|
||||||
|
|
|
@ -49,6 +49,7 @@ import android.view.MotionEvent;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewAnimationUtils;
|
import android.view.ViewAnimationUtils;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
import android.view.ViewParent;
|
||||||
import android.view.ViewTreeObserver;
|
import android.view.ViewTreeObserver;
|
||||||
import android.view.Window;
|
import android.view.Window;
|
||||||
import android.view.WindowManager;
|
import android.view.WindowManager;
|
||||||
|
@ -103,6 +104,7 @@ import org.telegram.messenger.camera.CameraController;
|
||||||
import org.telegram.messenger.voip.VideoCapturerDevice;
|
import org.telegram.messenger.voip.VideoCapturerDevice;
|
||||||
import org.telegram.messenger.voip.VoIPPendingCall;
|
import org.telegram.messenger.voip.VoIPPendingCall;
|
||||||
import org.telegram.messenger.voip.VoIPService;
|
import org.telegram.messenger.voip.VoIPService;
|
||||||
|
import org.telegram.tgnet.AbstractSerializedData;
|
||||||
import org.telegram.tgnet.ConnectionsManager;
|
import org.telegram.tgnet.ConnectionsManager;
|
||||||
import org.telegram.tgnet.TLObject;
|
import org.telegram.tgnet.TLObject;
|
||||||
import org.telegram.tgnet.TLRPC;
|
import org.telegram.tgnet.TLRPC;
|
||||||
|
@ -1562,6 +1564,7 @@ public class LaunchActivity extends Activity implements ActionBarLayout.ActionBa
|
||||||
String phone = null;
|
String phone = null;
|
||||||
String game = null;
|
String game = null;
|
||||||
String voicechat = null;
|
String voicechat = null;
|
||||||
|
String livestream = null;
|
||||||
String phoneHash = null;
|
String phoneHash = null;
|
||||||
String lang = null;
|
String lang = null;
|
||||||
String theme = null;
|
String theme = null;
|
||||||
|
@ -1740,6 +1743,7 @@ public class LaunchActivity extends Activity implements ActionBarLayout.ActionBa
|
||||||
botChat = data.getQueryParameter("startgroup");
|
botChat = data.getQueryParameter("startgroup");
|
||||||
game = data.getQueryParameter("game");
|
game = data.getQueryParameter("game");
|
||||||
voicechat = data.getQueryParameter("voicechat");
|
voicechat = data.getQueryParameter("voicechat");
|
||||||
|
livestream = data.getQueryParameter("livestream");
|
||||||
threadId = Utilities.parseInt(data.getQueryParameter("thread"));
|
threadId = Utilities.parseInt(data.getQueryParameter("thread"));
|
||||||
if (threadId == 0) {
|
if (threadId == 0) {
|
||||||
threadId = null;
|
threadId = null;
|
||||||
|
@ -1777,6 +1781,7 @@ public class LaunchActivity extends Activity implements ActionBarLayout.ActionBa
|
||||||
botChat = data.getQueryParameter("startgroup");
|
botChat = data.getQueryParameter("startgroup");
|
||||||
game = data.getQueryParameter("game");
|
game = data.getQueryParameter("game");
|
||||||
voicechat = data.getQueryParameter("voicechat");
|
voicechat = data.getQueryParameter("voicechat");
|
||||||
|
livestream = data.getQueryParameter("livestream");
|
||||||
messageId = Utilities.parseInt(data.getQueryParameter("post"));
|
messageId = Utilities.parseInt(data.getQueryParameter("post"));
|
||||||
if (messageId == 0) {
|
if (messageId == 0) {
|
||||||
messageId = null;
|
messageId = null;
|
||||||
|
@ -2077,7 +2082,7 @@ public class LaunchActivity extends Activity implements ActionBarLayout.ActionBa
|
||||||
if (message != null && message.startsWith("@")) {
|
if (message != null && message.startsWith("@")) {
|
||||||
message = " " + message;
|
message = " " + message;
|
||||||
}
|
}
|
||||||
runLinkRequest(intentAccount[0], username, group, sticker, botUser, botChat, message, hasUrl, messageId, channelId, threadId, commentId, game, auth, lang, unsupportedUrl, code, login, wallPaper, theme, voicechat, 0, videoTimestamp);
|
runLinkRequest(intentAccount[0], username, group, sticker, botUser, botChat, message, hasUrl, messageId, channelId, threadId, commentId, game, auth, lang, unsupportedUrl, code, login, wallPaper, theme, voicechat, livestream, 0, videoTimestamp);
|
||||||
} else {
|
} else {
|
||||||
try (Cursor cursor = getContentResolver().query(intent.getData(), null, null, null, null)) {
|
try (Cursor cursor = getContentResolver().query(intent.getData(), null, null, null, null)) {
|
||||||
if (cursor != null) {
|
if (cursor != null) {
|
||||||
|
@ -2749,6 +2754,7 @@ public class LaunchActivity extends Activity implements ActionBarLayout.ActionBa
|
||||||
final TLRPC.TL_wallPaper wallPaper,
|
final TLRPC.TL_wallPaper wallPaper,
|
||||||
final String theme,
|
final String theme,
|
||||||
final String voicechat,
|
final String voicechat,
|
||||||
|
final String livestream,
|
||||||
final int state,
|
final int state,
|
||||||
final int videoTimestamp) {
|
final int videoTimestamp) {
|
||||||
if (state == 0 && UserConfig.getActivatedAccountsCount() >= 2 && auth != null) {
|
if (state == 0 && UserConfig.getActivatedAccountsCount() >= 2 && auth != null) {
|
||||||
|
@ -2756,7 +2762,7 @@ public class LaunchActivity extends Activity implements ActionBarLayout.ActionBa
|
||||||
if (account != intentAccount) {
|
if (account != intentAccount) {
|
||||||
switchToAccount(account, true);
|
switchToAccount(account, true);
|
||||||
}
|
}
|
||||||
runLinkRequest(account, username, group, sticker, botUser, botChat, message, hasUrl, messageId, channelId, threadId, commentId, game, auth, lang, unsupportedUrl, code, loginToken, wallPaper, theme, voicechat, 1, videoTimestamp);
|
runLinkRequest(account, username, group, sticker, botUser, botChat, message, hasUrl, messageId, channelId, threadId, commentId, game, auth, lang, unsupportedUrl, code, loginToken, wallPaper, theme, voicechat, livestream, 1, videoTimestamp);
|
||||||
}).show();
|
}).show();
|
||||||
return;
|
return;
|
||||||
} else if (code != null) {
|
} else if (code != null) {
|
||||||
|
@ -2789,7 +2795,7 @@ public class LaunchActivity extends Activity implements ActionBarLayout.ActionBa
|
||||||
if (!LaunchActivity.this.isFinishing()) {
|
if (!LaunchActivity.this.isFinishing()) {
|
||||||
boolean hideProgressDialog = true;
|
boolean hideProgressDialog = true;
|
||||||
final TLRPC.TL_contacts_resolvedPeer res = (TLRPC.TL_contacts_resolvedPeer) response;
|
final TLRPC.TL_contacts_resolvedPeer res = (TLRPC.TL_contacts_resolvedPeer) response;
|
||||||
if (error == null && actionBarLayout != null && (game == null && voicechat == null || game != null && !res.users.isEmpty() || voicechat != null && !res.chats.isEmpty())) {
|
if (error == null && actionBarLayout != null && (game == null && voicechat == null || game != null && !res.users.isEmpty() || voicechat != null && !res.chats.isEmpty() || livestream != null && !res.chats.isEmpty())) {
|
||||||
MessagesController.getInstance(intentAccount).putUsers(res.users, false);
|
MessagesController.getInstance(intentAccount).putUsers(res.users, false);
|
||||||
MessagesController.getInstance(intentAccount).putChats(res.chats, false);
|
MessagesController.getInstance(intentAccount).putChats(res.chats, false);
|
||||||
MessagesStorage.getInstance(intentAccount).putUsersAndChats(res.users, res.chats, false, true);
|
MessagesStorage.getInstance(intentAccount).putUsersAndChats(res.users, res.chats, false, true);
|
||||||
|
@ -2902,6 +2908,9 @@ public class LaunchActivity extends Activity implements ActionBarLayout.ActionBa
|
||||||
if (voicechat != null) {
|
if (voicechat != null) {
|
||||||
args.putString("voicechat", voicechat);
|
args.putString("voicechat", voicechat);
|
||||||
}
|
}
|
||||||
|
if (livestream != null) {
|
||||||
|
args.putString("livestream", livestream);
|
||||||
|
}
|
||||||
if (videoTimestamp >= 0) {
|
if (videoTimestamp >= 0) {
|
||||||
args.putInt("video_timestamp", videoTimestamp);
|
args.putInt("video_timestamp", videoTimestamp);
|
||||||
}
|
}
|
||||||
|
@ -3590,23 +3599,25 @@ public class LaunchActivity extends Activity implements ActionBarLayout.ActionBa
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (SharedConfig.isAppUpdateAvailable()) {
|
if (SharedConfig.isAppUpdateAvailable()) {
|
||||||
|
View prevUpdateLayout = updateLayout;
|
||||||
createUpdateUI();
|
createUpdateUI();
|
||||||
updateSizeTextView.setText(AndroidUtilities.formatFileSize(SharedConfig.pendingAppUpdate.document.size));
|
updateSizeTextView.setText(AndroidUtilities.formatFileSize(SharedConfig.pendingAppUpdate.document.size));
|
||||||
String fileName = FileLoader.getAttachFileName(SharedConfig.pendingAppUpdate.document);
|
String fileName = FileLoader.getAttachFileName(SharedConfig.pendingAppUpdate.document);
|
||||||
File path = FileLoader.getPathToAttach(SharedConfig.pendingAppUpdate.document, true);
|
File path = FileLoader.getPathToAttach(SharedConfig.pendingAppUpdate.document, true);
|
||||||
boolean showSize;
|
boolean showSize;
|
||||||
if (path.exists()) {
|
if (path.exists()) {
|
||||||
updateLayoutIcon.setIcon(MediaActionDrawable.ICON_UPDATE, true, animated);
|
updateLayoutIcon.setIcon(MediaActionDrawable.ICON_UPDATE, true, false);
|
||||||
updateTextView.setText(LocaleController.getString("AppUpdateNow", R.string.AppUpdateNow));
|
updateTextView.setText(LocaleController.getString("AppUpdateNow", R.string.AppUpdateNow));
|
||||||
showSize = false;
|
showSize = false;
|
||||||
} else {
|
} else {
|
||||||
if (FileLoader.getInstance(currentAccount).isLoadingFile(fileName)) {
|
if (FileLoader.getInstance(currentAccount).isLoadingFile(fileName)) {
|
||||||
updateLayoutIcon.setIcon(MediaActionDrawable.ICON_CANCEL, true, animated);
|
updateLayoutIcon.setIcon(MediaActionDrawable.ICON_CANCEL, true, false);
|
||||||
|
updateLayoutIcon.setProgress(0, false);
|
||||||
Float p = ImageLoader.getInstance().getFileProgress(fileName);
|
Float p = ImageLoader.getInstance().getFileProgress(fileName);
|
||||||
updateTextView.setText(LocaleController.formatString("AppUpdateDownloading", R.string.AppUpdateDownloading, (int) ((p != null ? p : 0.0f) * 100)));
|
updateTextView.setText(LocaleController.formatString("AppUpdateDownloading", R.string.AppUpdateDownloading, (int) ((p != null ? p : 0.0f) * 100)));
|
||||||
showSize = false;
|
showSize = false;
|
||||||
} else {
|
} else {
|
||||||
updateLayoutIcon.setIcon(MediaActionDrawable.ICON_DOWNLOAD, true, animated);
|
updateLayoutIcon.setIcon(MediaActionDrawable.ICON_DOWNLOAD, true, false);
|
||||||
updateTextView.setText(LocaleController.getString("AppUpdate", R.string.AppUpdate));
|
updateTextView.setText(LocaleController.getString("AppUpdate", R.string.AppUpdate));
|
||||||
showSize = true;
|
showSize = true;
|
||||||
}
|
}
|
||||||
|
@ -3640,9 +3651,18 @@ public class LaunchActivity extends Activity implements ActionBarLayout.ActionBa
|
||||||
updateLayout.setVisibility(View.VISIBLE);
|
updateLayout.setVisibility(View.VISIBLE);
|
||||||
updateLayout.setTag(1);
|
updateLayout.setTag(1);
|
||||||
if (animated) {
|
if (animated) {
|
||||||
updateLayout.animate().translationY(0).setInterpolator(CubicBezierInterpolator.EASE_OUT).setListener(null).setDuration(180).start();
|
updateLayout.animate().translationY(0).setInterpolator(CubicBezierInterpolator.EASE_OUT).setListener(null).setDuration(180).withEndAction(() -> {
|
||||||
|
if (prevUpdateLayout != null) {
|
||||||
|
ViewGroup parent = (ViewGroup) prevUpdateLayout.getParent();
|
||||||
|
parent.removeView(prevUpdateLayout);
|
||||||
|
}
|
||||||
|
}).start();
|
||||||
} else {
|
} else {
|
||||||
updateLayout.setTranslationY(0);
|
updateLayout.setTranslationY(0);
|
||||||
|
if (prevUpdateLayout != null) {
|
||||||
|
ViewGroup parent = (ViewGroup) prevUpdateLayout.getParent();
|
||||||
|
parent.removeView(prevUpdateLayout);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
sideMenu.setPadding(0, 0, 0, AndroidUtilities.dp(44));
|
sideMenu.setPadding(0, 0, 0, AndroidUtilities.dp(44));
|
||||||
} else {
|
} else {
|
||||||
|
@ -3884,11 +3904,17 @@ public class LaunchActivity extends Activity implements ActionBarLayout.ActionBa
|
||||||
final long did = dids.get(i);
|
final long did = dids.get(i);
|
||||||
|
|
||||||
AccountInstance accountInstance = AccountInstance.getInstance(UserConfig.selectedAccount);
|
AccountInstance accountInstance = AccountInstance.getInstance(UserConfig.selectedAccount);
|
||||||
|
boolean photosEditorOpened = false;
|
||||||
if (fragment != null) {
|
if (fragment != null) {
|
||||||
actionBarLayout.presentFragment(fragment, dialogsFragment != null, dialogsFragment == null, true, false);
|
actionBarLayout.presentFragment(fragment, dialogsFragment != null, dialogsFragment == null, true, false);
|
||||||
if (videoPath != null) {
|
if (videoPath != null) {
|
||||||
fragment.openVideoEditor(videoPath, sendingText);
|
fragment.openVideoEditor(videoPath, sendingText);
|
||||||
sendingText = null;
|
sendingText = null;
|
||||||
|
} else if (photoPathsArray != null && photoPathsArray.size() > 0) {
|
||||||
|
photosEditorOpened = fragment.openPhotosEditor(photoPathsArray, message == null || message.length() == 0 ? sendingText : message);
|
||||||
|
if (photosEditorOpened) {
|
||||||
|
sendingText = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (videoPath != null) {
|
if (videoPath != null) {
|
||||||
|
@ -3901,7 +3927,7 @@ public class LaunchActivity extends Activity implements ActionBarLayout.ActionBa
|
||||||
SendMessagesHelper.prepareSendingDocuments(accountInstance, arrayList, arrayList, null, captionToSend, null, did, null, null, null, null, true, 0);
|
SendMessagesHelper.prepareSendingDocuments(accountInstance, arrayList, arrayList, null, captionToSend, null, did, null, null, null, null, true, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (photoPathsArray != null) {
|
if (photoPathsArray != null && !photosEditorOpened) {
|
||||||
if (sendingText != null && sendingText.length() <= 1024 && photoPathsArray.size() == 1) {
|
if (sendingText != null && sendingText.length() <= 1024 && photoPathsArray.size() == 1) {
|
||||||
photoPathsArray.get(0).caption = sendingText;
|
photoPathsArray.get(0).caption = sendingText;
|
||||||
sendingText = null;
|
sendingText = null;
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
package org.telegram.ui;
|
package org.telegram.ui;
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.content.Context;
|
|
||||||
import android.graphics.Canvas;
|
import android.graphics.Canvas;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
import org.telegram.messenger.NotificationCenter;
|
import org.telegram.messenger.NotificationCenter;
|
||||||
|
|
||||||
|
@ -14,11 +14,13 @@ public class MessageEnterTransitionContainer extends View {
|
||||||
|
|
||||||
private ArrayList<Transition> transitions = new ArrayList<>();
|
private ArrayList<Transition> transitions = new ArrayList<>();
|
||||||
private final int currentAccount;
|
private final int currentAccount;
|
||||||
|
private final ViewGroup parent;
|
||||||
|
|
||||||
Runnable hideRunnable = () -> setVisibility(View.GONE);
|
Runnable hideRunnable = () -> setVisibility(View.GONE);
|
||||||
|
|
||||||
public MessageEnterTransitionContainer(Context context, int currentAccount) {
|
public MessageEnterTransitionContainer(ViewGroup parent, int currentAccount) {
|
||||||
super(context);
|
super(parent.getContext());
|
||||||
|
this.parent = parent;
|
||||||
this.currentAccount = currentAccount;
|
this.currentAccount = currentAccount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,11 +31,13 @@ public class MessageEnterTransitionContainer extends View {
|
||||||
void addTransition(Transition transition) {
|
void addTransition(Transition transition) {
|
||||||
transitions.add(transition);
|
transitions.add(transition);
|
||||||
checkVisibility();
|
checkVisibility();
|
||||||
|
parent.invalidate();
|
||||||
}
|
}
|
||||||
|
|
||||||
void removeTransition(Transition transition) {
|
void removeTransition(Transition transition) {
|
||||||
transitions.remove(transition);
|
transitions.remove(transition);
|
||||||
checkVisibility();
|
checkVisibility();
|
||||||
|
parent.invalidate();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -55,4 +59,8 @@ public class MessageEnterTransitionContainer extends View {
|
||||||
setVisibility(View.VISIBLE);
|
setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isRunning() {
|
||||||
|
return transitions.size() > 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -126,7 +126,7 @@ public class MessageSeenView extends FrameLayout {
|
||||||
} else {
|
} else {
|
||||||
if (ChatObject.isChannel(chat)) {
|
if (ChatObject.isChannel(chat)) {
|
||||||
TLRPC.TL_channels_getParticipants usersReq = new TLRPC.TL_channels_getParticipants();
|
TLRPC.TL_channels_getParticipants usersReq = new TLRPC.TL_channels_getParticipants();
|
||||||
usersReq.limit = 50;
|
usersReq.limit = MessagesController.getInstance(currentAccount).chatReadMarkSizeThreshold;
|
||||||
usersReq.offset = 0;
|
usersReq.offset = 0;
|
||||||
usersReq.filter = new TLRPC.TL_channelParticipantsRecent();
|
usersReq.filter = new TLRPC.TL_channelParticipantsRecent();
|
||||||
usersReq.channel = MessagesController.getInstance(currentAccount).getInputChannel(chat.id);
|
usersReq.channel = MessagesController.getInstance(currentAccount).getInputChannel(chat.id);
|
||||||
|
@ -185,6 +185,10 @@ public class MessageSeenView extends FrameLayout {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
||||||
|
View parent = (View) getParent();
|
||||||
|
if (parent != null && parent.getWidth() > 0) {
|
||||||
|
widthMeasureSpec = MeasureSpec.makeMeasureSpec(parent.getWidth(), MeasureSpec.EXACTLY);
|
||||||
|
}
|
||||||
if (flickerLoadingView.getVisibility() == View.VISIBLE) {
|
if (flickerLoadingView.getVisibility() == View.VISIBLE) {
|
||||||
ignoreLayout = true;
|
ignoreLayout = true;
|
||||||
flickerLoadingView.setVisibility(View.GONE);
|
flickerLoadingView.setVisibility(View.GONE);
|
||||||
|
|
|
@ -105,6 +105,7 @@ import android.view.VelocityTracker;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewConfiguration;
|
import android.view.ViewConfiguration;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
import android.view.ViewPropertyAnimator;
|
||||||
import android.view.ViewTreeObserver;
|
import android.view.ViewTreeObserver;
|
||||||
import android.view.WindowInsets;
|
import android.view.WindowInsets;
|
||||||
import android.view.WindowManager;
|
import android.view.WindowManager;
|
||||||
|
@ -419,6 +420,8 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
|
||||||
private View flashView;
|
private View flashView;
|
||||||
private AnimatorSet flashAnimator;
|
private AnimatorSet flashAnimator;
|
||||||
private TextureView videoTextureView;
|
private TextureView videoTextureView;
|
||||||
|
private boolean firstFrameSet = false;
|
||||||
|
private ImageView firstFrameView;
|
||||||
private VideoPlayer videoPlayer;
|
private VideoPlayer videoPlayer;
|
||||||
private boolean manuallyPaused;
|
private boolean manuallyPaused;
|
||||||
private Runnable videoPlayRunnable;
|
private Runnable videoPlayRunnable;
|
||||||
|
@ -797,6 +800,9 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
|
||||||
if (isCurrentVideo) {
|
if (isCurrentVideo) {
|
||||||
if (!videoTimelineView.isDragging()) {
|
if (!videoTimelineView.isDragging()) {
|
||||||
float progress = videoPlayer.getCurrentPosition() / (float) videoPlayer.getDuration();
|
float progress = videoPlayer.getCurrentPosition() / (float) videoPlayer.getDuration();
|
||||||
|
if (shownControlsByEnd && !actionBarWasShownBeforeByEnd) {
|
||||||
|
progress = 0;
|
||||||
|
}
|
||||||
if (!inPreview && (currentEditMode != 0 || videoTimelineView.getVisibility() == View.VISIBLE)) {
|
if (!inPreview && (currentEditMode != 0 || videoTimelineView.getVisibility() == View.VISIBLE)) {
|
||||||
if (progress >= videoTimelineView.getRightProgress()) {
|
if (progress >= videoTimelineView.getRightProgress()) {
|
||||||
videoTimelineView.setProgress(videoTimelineView.getLeftProgress());
|
videoTimelineView.setProgress(videoTimelineView.getLeftProgress());
|
||||||
|
@ -819,6 +825,9 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
float progress = videoPlayer.getCurrentPosition() / (float) videoPlayer.getDuration();
|
float progress = videoPlayer.getCurrentPosition() / (float) videoPlayer.getDuration();
|
||||||
|
if (shownControlsByEnd && !actionBarWasShownBeforeByEnd) {
|
||||||
|
progress = 0;
|
||||||
|
}
|
||||||
float bufferedProgress;
|
float bufferedProgress;
|
||||||
if (currentVideoFinishedLoading) {
|
if (currentVideoFinishedLoading) {
|
||||||
bufferedProgress = 1.0f;
|
bufferedProgress = 1.0f;
|
||||||
|
@ -874,6 +883,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
|
||||||
}
|
}
|
||||||
updateVideoPlayerTime();
|
updateVideoPlayerTime();
|
||||||
}
|
}
|
||||||
|
updateFirstFrameView();
|
||||||
}
|
}
|
||||||
if (isPlaying) {
|
if (isPlaying) {
|
||||||
AndroidUtilities.runOnUIThread(updateProgressRunnable, 17);
|
AndroidUtilities.runOnUIThread(updateProgressRunnable, 17);
|
||||||
|
@ -4256,6 +4266,11 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
|
||||||
MediaDataController.getInstance(currentAccount).addRecentGif(document, (int) (System.currentTimeMillis() / 1000));
|
MediaDataController.getInstance(currentAccount).addRecentGif(document, (int) (System.currentTimeMillis() / 1000));
|
||||||
MessagesController.getInstance(currentAccount).saveGif(pageBlocksAdapter.getParentObject(), document);
|
MessagesController.getInstance(currentAccount).saveGif(pageBlocksAdapter.getParentObject(), document);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (containerView != null) {
|
||||||
|
BulletinFactory.of(containerView, resourcesProvider).createDownloadBulletin(BulletinFactory.FileType.GIF, resourcesProvider).show();
|
||||||
}
|
}
|
||||||
} else if (id == gallery_menu_set_as_main) {
|
} else if (id == gallery_menu_set_as_main) {
|
||||||
TLRPC.Photo photo = avatarsArr.get(currentIndex);
|
TLRPC.Photo photo = avatarsArr.get(currentIndex);
|
||||||
|
@ -6264,6 +6279,9 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
|
||||||
|
|
||||||
textureImageView.setTranslationY(fromY2);
|
textureImageView.setTranslationY(fromY2);
|
||||||
videoTextureView.setTranslationY(fromY);
|
videoTextureView.setTranslationY(fromY);
|
||||||
|
if (firstFrameView != null) {
|
||||||
|
firstFrameView.setTranslationY(fromY);
|
||||||
|
}
|
||||||
|
|
||||||
translationY = 0;
|
translationY = 0;
|
||||||
containerView.invalidate();
|
containerView.invalidate();
|
||||||
|
@ -6286,6 +6304,13 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
|
||||||
|
|
||||||
videoTextureView.setTranslationX(fromX * (1f - xValue) + (toX2) * xValue);
|
videoTextureView.setTranslationX(fromX * (1f - xValue) + (toX2) * xValue);
|
||||||
videoTextureView.setTranslationY(fromY * (1f - yValue) + (toY2) * yValue);
|
videoTextureView.setTranslationY(fromY * (1f - yValue) + (toY2) * yValue);
|
||||||
|
|
||||||
|
if (firstFrameView != null) {
|
||||||
|
firstFrameView.setTranslationX(videoTextureView.getTranslationX());
|
||||||
|
firstFrameView.setTranslationY(videoTextureView.getTranslationY());
|
||||||
|
firstFrameView.setScaleX(videoTextureView.getScaleX());
|
||||||
|
firstFrameView.setScaleY(videoTextureView.getScaleY());
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
AnimatorSet animatorSet = new AnimatorSet();
|
AnimatorSet animatorSet = new AnimatorSet();
|
||||||
|
@ -6378,6 +6403,12 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
|
||||||
videoTextureView.setScaleY(scale);
|
videoTextureView.setScaleY(scale);
|
||||||
videoTextureView.setTranslationX(rect.x - aspectRatioFrameLayout.getX());
|
videoTextureView.setTranslationX(rect.x - aspectRatioFrameLayout.getX());
|
||||||
videoTextureView.setTranslationY(rect.y - aspectRatioFrameLayout.getY());
|
videoTextureView.setTranslationY(rect.y - aspectRatioFrameLayout.getY());
|
||||||
|
if (firstFrameView != null) {
|
||||||
|
firstFrameView.setScaleX(scale);
|
||||||
|
firstFrameView.setScaleY(scale);
|
||||||
|
firstFrameView.setTranslationX(videoTextureView.getTranslationX());
|
||||||
|
firstFrameView.setTranslationY(videoTextureView.getTranslationY());
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
pipVideoView.close();
|
pipVideoView.close();
|
||||||
pipVideoView = null;
|
pipVideoView = null;
|
||||||
|
@ -6795,6 +6826,9 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
|
||||||
Arrays.fill(videoPlayerTotalTime, 0);
|
Arrays.fill(videoPlayerTotalTime, 0);
|
||||||
if (videoPlayer != null) {
|
if (videoPlayer != null) {
|
||||||
long current = Math.max(0, videoPlayer.getCurrentPosition());
|
long current = Math.max(0, videoPlayer.getCurrentPosition());
|
||||||
|
if (shownControlsByEnd && !actionBarWasShownBeforeByEnd) {
|
||||||
|
current = 0;
|
||||||
|
}
|
||||||
long total = Math.max(0, videoPlayer.getDuration());
|
long total = Math.max(0, videoPlayer.getDuration());
|
||||||
if (!inPreview && videoTimelineView.getVisibility() == View.VISIBLE) {
|
if (!inPreview && videoTimelineView.getVisibility() == View.VISIBLE) {
|
||||||
total *= (videoTimelineView.getRightProgress() - videoTimelineView.getLeftProgress());
|
total *= (videoTimelineView.getRightProgress() - videoTimelineView.getLeftProgress());
|
||||||
|
@ -7173,6 +7207,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
|
||||||
if (videoTextureView != null) {
|
if (videoTextureView != null) {
|
||||||
videoPlayer.setTextureView(videoTextureView);
|
videoPlayer.setTextureView(videoTextureView);
|
||||||
}
|
}
|
||||||
|
firstFrameSet = false;
|
||||||
videoPlayer.setDelegate(new VideoPlayer.VideoPlayerDelegate() {
|
videoPlayer.setDelegate(new VideoPlayer.VideoPlayerDelegate() {
|
||||||
@Override
|
@Override
|
||||||
public void onStateChanged(boolean playWhenReady, int playbackState) {
|
public void onStateChanged(boolean playWhenReady, int playbackState) {
|
||||||
|
@ -7228,6 +7263,11 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
|
||||||
textureUploaded = true;
|
textureUploaded = true;
|
||||||
containerView.invalidate();
|
containerView.invalidate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (videoTextureView != null && !firstFrameSet && videoPlayer.getCurrentPosition() <= 60) {
|
||||||
|
firstFrameView.setImageBitmap(videoTextureView.getBitmap());
|
||||||
|
firstFrameSet = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -7273,19 +7313,28 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
|
||||||
pipPosition[1] -= containerView.getTranslationY();
|
pipPosition[1] -= containerView.getTranslationY();
|
||||||
textureImageView.setTranslationX(textureImageView.getTranslationX() + getLeftInset());
|
textureImageView.setTranslationX(textureImageView.getTranslationX() + getLeftInset());
|
||||||
videoTextureView.setTranslationX(videoTextureView.getTranslationX() + getLeftInset() - aspectRatioFrameLayout.getX());
|
videoTextureView.setTranslationX(videoTextureView.getTranslationX() + getLeftInset() - aspectRatioFrameLayout.getX());
|
||||||
|
if (firstFrameView != null) {
|
||||||
|
firstFrameView.setTranslationX(videoTextureView.getTranslationX());
|
||||||
|
}
|
||||||
|
|
||||||
AnimatorSet animatorSet = new AnimatorSet();
|
AnimatorSet animatorSet = new AnimatorSet();
|
||||||
animatorSet.playTogether(
|
ArrayList<Animator> animators = new ArrayList<>();
|
||||||
ObjectAnimator.ofFloat(textureImageView, View.SCALE_X, 1.0f),
|
animators.add(ObjectAnimator.ofFloat(textureImageView, View.SCALE_X, 1.0f));
|
||||||
ObjectAnimator.ofFloat(textureImageView, View.SCALE_Y, 1.0f),
|
animators.add(ObjectAnimator.ofFloat(textureImageView, View.SCALE_Y, 1.0f));
|
||||||
ObjectAnimator.ofFloat(textureImageView, View.TRANSLATION_X, pipPosition[0]),
|
animators.add(ObjectAnimator.ofFloat(textureImageView, View.TRANSLATION_X, pipPosition[0]));
|
||||||
ObjectAnimator.ofFloat(textureImageView, View.TRANSLATION_Y, pipPosition[1]),
|
animators.add(ObjectAnimator.ofFloat(textureImageView, View.TRANSLATION_Y, pipPosition[1]));
|
||||||
ObjectAnimator.ofFloat(videoTextureView, View.SCALE_X, 1.0f),
|
animators.add(ObjectAnimator.ofFloat(videoTextureView, View.SCALE_X, 1.0f));
|
||||||
ObjectAnimator.ofFloat(videoTextureView, View.SCALE_Y, 1.0f),
|
animators.add(ObjectAnimator.ofFloat(videoTextureView, View.SCALE_Y, 1.0f));
|
||||||
ObjectAnimator.ofFloat(videoTextureView, View.TRANSLATION_X, pipPosition[0] - aspectRatioFrameLayout.getX()),
|
animators.add(ObjectAnimator.ofFloat(videoTextureView, View.TRANSLATION_X, pipPosition[0] - aspectRatioFrameLayout.getX()));
|
||||||
ObjectAnimator.ofFloat(videoTextureView, View.TRANSLATION_Y, pipPosition[1] - aspectRatioFrameLayout.getY()),
|
animators.add(ObjectAnimator.ofFloat(videoTextureView, View.TRANSLATION_Y, pipPosition[1] - aspectRatioFrameLayout.getY()));
|
||||||
ObjectAnimator.ofInt(backgroundDrawable, AnimationProperties.COLOR_DRAWABLE_ALPHA, 255)
|
animators.add(ObjectAnimator.ofInt(backgroundDrawable, AnimationProperties.COLOR_DRAWABLE_ALPHA, 255));
|
||||||
);
|
if (firstFrameView != null) {
|
||||||
|
animators.add(ObjectAnimator.ofFloat(firstFrameView, View.SCALE_X, 1.0f));
|
||||||
|
animators.add(ObjectAnimator.ofFloat(firstFrameView, View.SCALE_Y, 1.0f));
|
||||||
|
animators.add(ObjectAnimator.ofFloat(firstFrameView, View.TRANSLATION_X, pipPosition[0] - aspectRatioFrameLayout.getX()));
|
||||||
|
animators.add(ObjectAnimator.ofFloat(firstFrameView, View.TRANSLATION_Y, pipPosition[1] - aspectRatioFrameLayout.getY()));
|
||||||
|
}
|
||||||
|
animatorSet.playTogether(animators);
|
||||||
final DecelerateInterpolator interpolator = new DecelerateInterpolator();
|
final DecelerateInterpolator interpolator = new DecelerateInterpolator();
|
||||||
animatorSet.setInterpolator(interpolator);
|
animatorSet.setInterpolator(interpolator);
|
||||||
animatorSet.setDuration(250);
|
animatorSet.setDuration(250);
|
||||||
|
@ -7477,12 +7526,15 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
|
||||||
}
|
}
|
||||||
if (videoTextureView instanceof VideoEditTextureView) {
|
if (videoTextureView instanceof VideoEditTextureView) {
|
||||||
videoTextureView.setPivotX(videoTextureView.getMeasuredWidth() / 2);
|
videoTextureView.setPivotX(videoTextureView.getMeasuredWidth() / 2);
|
||||||
|
firstFrameView.setPivotX(videoTextureView.getMeasuredWidth() / 2);
|
||||||
} else {
|
} else {
|
||||||
videoTextureView.setPivotX(0);
|
videoTextureView.setPivotX(0);
|
||||||
|
firstFrameView.setPivotX(0);
|
||||||
}
|
}
|
||||||
checkFullscreenButton();
|
checkFullscreenButton();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
aspectRatioFrameLayout.setWillNotDraw(false);
|
||||||
aspectRatioFrameLayout.setVisibility(View.INVISIBLE);
|
aspectRatioFrameLayout.setVisibility(View.INVISIBLE);
|
||||||
containerView.addView(aspectRatioFrameLayout, 0, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, Gravity.CENTER));
|
containerView.addView(aspectRatioFrameLayout, 0, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, Gravity.CENTER));
|
||||||
|
|
||||||
|
@ -7506,6 +7558,12 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
|
||||||
videoTextureView.setOpaque(false);
|
videoTextureView.setOpaque(false);
|
||||||
aspectRatioFrameLayout.addView(videoTextureView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, Gravity.CENTER));
|
aspectRatioFrameLayout.addView(videoTextureView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, Gravity.CENTER));
|
||||||
|
|
||||||
|
firstFrameView = new ImageView(parentActivity);
|
||||||
|
firstFrameView.setPivotX(0);
|
||||||
|
firstFrameView.setPivotY(0);
|
||||||
|
firstFrameView.setScaleType(ImageView.ScaleType.FIT_XY);
|
||||||
|
aspectRatioFrameLayout.addView(firstFrameView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, Gravity.CENTER));
|
||||||
|
|
||||||
if (sendPhotoType == SELECT_TYPE_AVATAR) {
|
if (sendPhotoType == SELECT_TYPE_AVATAR) {
|
||||||
flashView = new View(parentActivity);
|
flashView = new View(parentActivity);
|
||||||
flashView.setBackgroundColor(0xffffffff);
|
flashView.setBackgroundColor(0xffffffff);
|
||||||
|
@ -7514,6 +7572,51 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private final static float firstFrameFadeDuration = 200;
|
||||||
|
private boolean shownControlsByEnd = false;
|
||||||
|
private boolean actionBarWasShownBeforeByEnd = false;
|
||||||
|
private ViewPropertyAnimator firstFrameViewAnimator = null;
|
||||||
|
private void updateFirstFrameView() {
|
||||||
|
if (videoPlayer != null && firstFrameView != null) {
|
||||||
|
long toDuration = videoPlayer.getDuration() - videoPlayer.getCurrentPosition();
|
||||||
|
float alpha = 1f - Math.max(Math.min(toDuration / firstFrameFadeDuration, 1), 0);
|
||||||
|
if (!videoPlayer.isPlaying()) {
|
||||||
|
if (firstFrameViewAnimator != null) {
|
||||||
|
firstFrameViewAnimator.cancel();
|
||||||
|
firstFrameViewAnimator = null;
|
||||||
|
}
|
||||||
|
firstFrameView.clearAnimation();
|
||||||
|
firstFrameView.setAlpha(alpha);
|
||||||
|
} else {
|
||||||
|
if (toDuration <= firstFrameFadeDuration) {
|
||||||
|
if (firstFrameViewAnimator == null) {
|
||||||
|
firstFrameView.setAlpha(alpha);
|
||||||
|
firstFrameViewAnimator = firstFrameView.animate().alpha(1).withEndAction(() -> {
|
||||||
|
if (firstFrameViewAnimator != null) {
|
||||||
|
firstFrameViewAnimator.cancel();
|
||||||
|
firstFrameViewAnimator = null;
|
||||||
|
}
|
||||||
|
}).setDuration(Math.max(0, toDuration));
|
||||||
|
firstFrameViewAnimator.start();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
firstFrameView.setAlpha(alpha);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!videoPlayer.isLooping()) {
|
||||||
|
if (!shownControlsByEnd && videoPlayer.getCurrentPosition() > videoPlayer.getDuration() - firstFrameFadeDuration) {
|
||||||
|
actionBarWasShownBeforeByEnd = isActionBarVisible;
|
||||||
|
shownControlsByEnd = true;
|
||||||
|
toggleActionBar(true, true);
|
||||||
|
checkProgress(0, false, false);
|
||||||
|
} else if (videoPlayer.getCurrentPosition() < videoPlayer.getDuration() - firstFrameFadeDuration) {
|
||||||
|
shownControlsByEnd = false;
|
||||||
|
actionBarWasShownBeforeByEnd = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void releasePlayer(boolean onClose) {
|
private void releasePlayer(boolean onClose) {
|
||||||
if (videoPlayer != null) {
|
if (videoPlayer != null) {
|
||||||
cancelVideoPlayRunnable();
|
cancelVideoPlayRunnable();
|
||||||
|
@ -9638,6 +9741,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
|
||||||
containerView.setTag(1);
|
containerView.setTag(1);
|
||||||
playerAutoStarted = false;
|
playerAutoStarted = false;
|
||||||
isCurrentVideo = false;
|
isCurrentVideo = false;
|
||||||
|
shownControlsByEnd = false;
|
||||||
imagesArr.clear();
|
imagesArr.clear();
|
||||||
imagesArrLocations.clear();
|
imagesArrLocations.clear();
|
||||||
imagesArrLocationsSizes.clear();
|
imagesArrLocationsSizes.clear();
|
||||||
|
@ -10081,6 +10185,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
|
||||||
nameTextView.setText("");
|
nameTextView.setText("");
|
||||||
dateTextView.setText("");
|
dateTextView.setText("");
|
||||||
} else {
|
} else {
|
||||||
|
allowShare = !noforwards;
|
||||||
if (newMessageObject.isNewGif() && allowShare) {
|
if (newMessageObject.isNewGif() && allowShare) {
|
||||||
menuItem.showSubItem(gallery_menu_savegif);
|
menuItem.showSubItem(gallery_menu_savegif);
|
||||||
}
|
}
|
||||||
|
@ -10541,11 +10646,12 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
|
||||||
if (switchingToIndex < 0 || switchingToIndex >= size) {
|
if (switchingToIndex < 0 || switchingToIndex >= size) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
allowShare = !MessagesController.getInstance(currentAccount).isChatNoForwards(-currentDialogId);
|
||||||
TLRPC.PageBlock pageBlock = pageBlocksAdapter.get(switchingToIndex);
|
TLRPC.PageBlock pageBlock = pageBlocksAdapter.get(switchingToIndex);
|
||||||
caption = pageBlocksAdapter.getCaption(switchingToIndex);
|
caption = pageBlocksAdapter.getCaption(switchingToIndex);
|
||||||
isVideo = pageBlocksAdapter.isVideo(switchingToIndex);
|
isVideo = pageBlocksAdapter.isVideo(switchingToIndex);
|
||||||
if (isVideo) {
|
if (isVideo) {
|
||||||
if (!MessagesController.getInstance(currentAccount).isChatNoForwards(-currentDialogId)) {
|
if (allowShare) {
|
||||||
menuItem.showSubItem(gallery_menu_openin);
|
menuItem.showSubItem(gallery_menu_openin);
|
||||||
} else {
|
} else {
|
||||||
menuItem.hideSubItem(gallery_menu_openin);
|
menuItem.hideSubItem(gallery_menu_openin);
|
||||||
|
@ -10567,7 +10673,6 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
|
||||||
}
|
}
|
||||||
bottomLayout.setTag(null);
|
bottomLayout.setTag(null);
|
||||||
|
|
||||||
allowShare = !MessagesController.getInstance(currentAccount).isChatNoForwards(-currentDialogId);
|
|
||||||
shareItem.setVisibility(allowShare ? View.VISIBLE : View.GONE);
|
shareItem.setVisibility(allowShare ? View.VISIBLE : View.GONE);
|
||||||
|
|
||||||
if (currentAnimation != null) {
|
if (currentAnimation != null) {
|
||||||
|
@ -11306,6 +11411,10 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
|
||||||
}
|
}
|
||||||
boolean existsFinal = exists;
|
boolean existsFinal = exists;
|
||||||
AndroidUtilities.runOnUIThread(() -> {
|
AndroidUtilities.runOnUIThread(() -> {
|
||||||
|
if (shownControlsByEnd && !actionBarWasShownBeforeByEnd && isPlaying) {
|
||||||
|
photoProgressViews[a].setBackgroundState(PROGRESS_PLAY, false, false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
if ((f1Final != null || f2Final != null) && (existsFinal || canStreamFinal)) {
|
if ((f1Final != null || f2Final != null) && (existsFinal || canStreamFinal)) {
|
||||||
if (a != 0 || !isPlaying) {
|
if (a != 0 || !isPlaying) {
|
||||||
if (isVideoFinal && (!canAutoPlayFinal || a == 0 && playerWasPlaying)) {
|
if (isVideoFinal && (!canAutoPlayFinal || a == 0 && playerWasPlaying)) {
|
||||||
|
@ -13016,6 +13125,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
|
||||||
selectedPhotosAdapter.notifyDataSetChanged();
|
selectedPhotosAdapter.notifyDataSetChanged();
|
||||||
pageBlocksAdapter = null;
|
pageBlocksAdapter = null;
|
||||||
disableShowCheck = false;
|
disableShowCheck = false;
|
||||||
|
shownControlsByEnd = false;
|
||||||
videoCutStart = 0;
|
videoCutStart = 0;
|
||||||
videoCutEnd = 1f;
|
videoCutEnd = 1f;
|
||||||
if (object != null) {
|
if (object != null) {
|
||||||
|
@ -13975,6 +14085,9 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
|
||||||
if (currentEditMode == 1 || sendPhotoType == SELECT_TYPE_AVATAR) {
|
if (currentEditMode == 1 || sendPhotoType == SELECT_TYPE_AVATAR) {
|
||||||
if (videoTextureView != null) {
|
if (videoTextureView != null) {
|
||||||
videoTextureView.setScaleX(cropTransform.isMirrored() ? -1.0f : 1.0f);
|
videoTextureView.setScaleX(cropTransform.isMirrored() ? -1.0f : 1.0f);
|
||||||
|
if (firstFrameView != null) {
|
||||||
|
firstFrameView.setScaleX(videoTextureView.getScaleX());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
float trueScale = 1.0f + (cropTransform.getTrueCropScale() - 1.0f) * (1.0f - cropAnimationValue);
|
float trueScale = 1.0f + (cropTransform.getTrueCropScale() - 1.0f) * (1.0f - cropAnimationValue);
|
||||||
cropScale = cropTransform.getScale() / trueScale;
|
cropScale = cropTransform.getScale() / trueScale;
|
||||||
|
@ -13993,6 +14106,9 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
|
||||||
} else {
|
} else {
|
||||||
if (videoTextureView != null) {
|
if (videoTextureView != null) {
|
||||||
videoTextureView.setScaleX(editState.cropState != null && editState.cropState.mirrored ? -1.0f : 1.0f);
|
videoTextureView.setScaleX(editState.cropState != null && editState.cropState.mirrored ? -1.0f : 1.0f);
|
||||||
|
if (firstFrameView != null) {
|
||||||
|
firstFrameView.setScaleX(videoTextureView.getScaleX());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
cropScale = editState.cropState != null ? editState.cropState.cropScale : 1.0f;
|
cropScale = editState.cropState != null ? editState.cropState.cropScale : 1.0f;
|
||||||
float trueScale = 1.0f + (cropScale - 1.0f) * (1.0f - cropAnimationValue);
|
float trueScale = 1.0f + (cropScale - 1.0f) * (1.0f - cropAnimationValue);
|
||||||
|
@ -14015,6 +14131,10 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
|
||||||
if (videoTextureView != null) {
|
if (videoTextureView != null) {
|
||||||
videoTextureView.setScaleX(1.0f);
|
videoTextureView.setScaleX(1.0f);
|
||||||
videoTextureView.setScaleY(1.0f);
|
videoTextureView.setScaleY(1.0f);
|
||||||
|
if (firstFrameView != null) {
|
||||||
|
firstFrameView.setScaleX(1);
|
||||||
|
firstFrameView.setScaleY(1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -140,6 +140,7 @@ import org.telegram.ui.Components.AnimatedFileDrawable;
|
||||||
import org.telegram.ui.Components.AnimationProperties;
|
import org.telegram.ui.Components.AnimationProperties;
|
||||||
import org.telegram.ui.Components.AudioPlayerAlert;
|
import org.telegram.ui.Components.AudioPlayerAlert;
|
||||||
import org.telegram.ui.Components.AvatarDrawable;
|
import org.telegram.ui.Components.AvatarDrawable;
|
||||||
|
import org.telegram.ui.Components.BackButtonMenu;
|
||||||
import org.telegram.ui.Components.BackupImageView;
|
import org.telegram.ui.Components.BackupImageView;
|
||||||
import org.telegram.ui.Components.BulletinFactory;
|
import org.telegram.ui.Components.BulletinFactory;
|
||||||
import org.telegram.ui.Components.ChatAvatarContainer;
|
import org.telegram.ui.Components.ChatAvatarContainer;
|
||||||
|
@ -1502,126 +1503,17 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
|
||||||
actionBar.setOccupyStatusBar(Build.VERSION.SDK_INT >= 21 && !AndroidUtilities.isTablet() && !inBubbleMode);
|
actionBar.setOccupyStatusBar(Build.VERSION.SDK_INT >= 21 && !AndroidUtilities.isTablet() && !inBubbleMode);
|
||||||
ImageView backButton = actionBar.getBackButton();
|
ImageView backButton = actionBar.getBackButton();
|
||||||
backButton.setOnLongClickListener(e -> {
|
backButton.setOnLongClickListener(e -> {
|
||||||
ArrayList<ChatActivity.PulledDialog> dialogs = ChatActivity.getStackedHistoryDialogs(currentAccount, getParentLayout().fragmentsStack, dialogId);
|
ActionBarPopupWindow menu = BackButtonMenu.show(this, backButton, getDialogId());
|
||||||
if (dialogs.size() <= 0) {
|
if (menu != null) {
|
||||||
|
menu.setOnDismissListener(() -> dimBehindView(false));
|
||||||
|
dimBehindView(backButton, 0.3f);
|
||||||
|
if (undoView != null) {
|
||||||
|
undoView.hide(true, 1);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
ActionBarPopupWindow.ActionBarPopupWindowLayout layout = new ActionBarPopupWindow.ActionBarPopupWindowLayout(context);
|
|
||||||
Rect backgroundPaddings = new Rect();
|
|
||||||
Drawable shadowDrawable = getParentActivity().getResources().getDrawable(R.drawable.popup_fixed_alert).mutate();
|
|
||||||
shadowDrawable.getPadding(backgroundPaddings);
|
|
||||||
layout.setBackgroundColor(getThemedColor(Theme.key_actionBarDefaultSubmenuBackground));
|
|
||||||
|
|
||||||
for (int i = 0; i < dialogs.size(); ++i) {
|
|
||||||
final ChatActivity.PulledDialog pDialog = dialogs.get(i);
|
|
||||||
final TLRPC.Chat chat = pDialog.chat;
|
|
||||||
final TLRPC.User user = pDialog.user;
|
|
||||||
FrameLayout cell = new FrameLayout(context);
|
|
||||||
cell.setMinimumWidth(AndroidUtilities.dp(200));
|
|
||||||
|
|
||||||
BackupImageView imageView = new BackupImageView(context);
|
|
||||||
imageView.setRoundRadius(AndroidUtilities.dp(32));
|
|
||||||
cell.addView(imageView, LayoutHelper.createFrameRelatively(32, 32, Gravity.START | Gravity.CENTER_VERTICAL, 13, 0, 0, 0));
|
|
||||||
|
|
||||||
TextView titleView = new TextView(context);
|
|
||||||
titleView.setLines(1);
|
|
||||||
titleView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16);
|
|
||||||
titleView.setTextColor(Theme.getColor(Theme.key_actionBarDefaultSubmenuItem));
|
|
||||||
titleView.setEllipsize(TextUtils.TruncateAt.END);
|
|
||||||
cell.addView(titleView, LayoutHelper.createFrameRelatively(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.START | Gravity.CENTER_VERTICAL, 59, 0, 12, 0));
|
|
||||||
|
|
||||||
AvatarDrawable avatarDrawable = new AvatarDrawable();
|
|
||||||
if (chat != null) {
|
|
||||||
avatarDrawable.setInfo(chat);
|
|
||||||
imageView.setImage(ImageLocation.getForChat(chat, ImageLocation.TYPE_SMALL), "50_50", avatarDrawable, chat);
|
|
||||||
titleView.setText(chat.title);
|
|
||||||
} else if (user != null) {
|
|
||||||
avatarDrawable.setInfo(user);
|
|
||||||
imageView.setImage(ImageLocation.getForUser(user, ImageLocation.TYPE_SMALL), "50_50", avatarDrawable, user);
|
|
||||||
titleView.setText(UserObject.getUserName(user));
|
|
||||||
}
|
|
||||||
|
|
||||||
boolean isFirst = i == 0, isLast = i == dialogs.size() - 1;
|
|
||||||
cell.setBackground(Theme.getSelectorDrawable(Theme.getColor(Theme.key_listSelector), false));
|
|
||||||
cell.setOnClickListener(e2 -> {
|
|
||||||
if (scrimPopupWindow != null) {
|
|
||||||
scrimPopupWindow.dismiss();
|
|
||||||
}
|
|
||||||
if (pDialog.stackIndex >= 0) {
|
|
||||||
final ActionBarLayout parentLayout = getParentLayout();
|
|
||||||
BaseFragment fragment;
|
|
||||||
if (parentLayout == null || parentLayout.fragmentsStack == null || pDialog.stackIndex >= parentLayout.fragmentsStack.size()) {
|
|
||||||
fragment = null;
|
|
||||||
} else {
|
|
||||||
fragment = parentLayout.fragmentsStack.get(pDialog.stackIndex);
|
|
||||||
}
|
|
||||||
if (fragment instanceof ChatActivity && ((ChatActivity) fragment).getDialogId() != pDialog.dialogId) {
|
|
||||||
for (int j = parentLayout.fragmentsStack.size() - 2; j > pDialog.stackIndex; --j) {
|
|
||||||
parentLayout.removeFragmentFromStack(j);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (parentLayout != null && parentLayout.fragmentsStack != null) {
|
|
||||||
for (int j = parentLayout.fragmentsStack.size() - 2; j > pDialog.stackIndex; --j) {
|
|
||||||
if (j >= 0 && j < parentLayout.fragmentsStack.size()) {
|
|
||||||
parentLayout.removeFragmentFromStack(j);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (pDialog.stackIndex < parentLayout.fragmentsStack.size()) {
|
|
||||||
parentLayout.showFragment(pDialog.stackIndex);
|
|
||||||
parentLayout.closeLastFragment(true);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ChatActivity.goTo(this, chat != null ? chat : user, pDialog.dialogId, pDialog.folderId, pDialog.filterId);
|
|
||||||
});
|
|
||||||
// layout.addView(cell, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, 44 + (isFirst ? 4 : 0) + (isLast ? 4 : 0)));
|
|
||||||
layout.addView(cell, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, 44, 0, isFirst ? 4 : 0, 0, isLast ? 4 : 0));
|
|
||||||
}
|
|
||||||
|
|
||||||
scrimPopupWindow = new ActionBarPopupWindow(layout, LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT) {
|
|
||||||
@Override
|
|
||||||
public void dismiss() {
|
|
||||||
super.dismiss();
|
|
||||||
if (scrimPopupWindow != this) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
scrimPopupWindow = null;
|
|
||||||
dimBehindView(false);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
scrimPopupWindow.setPauseNotifications(true);
|
|
||||||
scrimPopupWindow.setDismissAnimationDuration(220);
|
|
||||||
scrimPopupWindow.setOutsideTouchable(true);
|
|
||||||
scrimPopupWindow.setClippingEnabled(true);
|
|
||||||
scrimPopupWindow.setAnimationStyle(R.style.PopupContextAnimation);
|
|
||||||
scrimPopupWindow.setFocusable(true);
|
|
||||||
layout.measure(View.MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(1000), View.MeasureSpec.AT_MOST), View.MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(1000), View.MeasureSpec.AT_MOST));
|
|
||||||
scrimPopupWindow.setInputMethodMode(ActionBarPopupWindow.INPUT_METHOD_NOT_NEEDED);
|
|
||||||
scrimPopupWindow.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_UNSPECIFIED);
|
|
||||||
scrimPopupWindow.getContentView().setFocusableInTouchMode(true);
|
|
||||||
layout.setFitItems(true);
|
|
||||||
|
|
||||||
int popupX = AndroidUtilities.dp(8) - backgroundPaddings.left;
|
|
||||||
if (AndroidUtilities.isTablet()) {
|
|
||||||
int[] location = new int[2];
|
|
||||||
fragmentView.getLocationInWindow(location);
|
|
||||||
popupX += location[0];
|
|
||||||
}
|
|
||||||
int popupY = (int) (backButton.getBottom() - backgroundPaddings.top - AndroidUtilities.dp(8));
|
|
||||||
final int finalPopupX = popupX;
|
|
||||||
final int finalPopupY = popupY;
|
|
||||||
scrimPopupWindow.showAtLocation(fragmentView, Gravity.LEFT | Gravity.TOP, finalPopupX, finalPopupY);
|
|
||||||
try {
|
|
||||||
actionBar.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
|
|
||||||
} catch (Exception ignore) {}
|
|
||||||
dimBehindView(backButton, 0.3f);
|
|
||||||
if (undoView != null) {
|
|
||||||
undoView.hide(true, 1);
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
});
|
});
|
||||||
return actionBar;
|
return actionBar;
|
||||||
}
|
}
|
||||||
|
@ -3580,6 +3472,9 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
|
||||||
public TLRPC.Chat getCurrentChat() {
|
public TLRPC.Chat getCurrentChat() {
|
||||||
return currentChat;
|
return currentChat;
|
||||||
}
|
}
|
||||||
|
public TLRPC.UserFull getUserInfo() {
|
||||||
|
return userInfo;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isFragmentOpened() {
|
public boolean isFragmentOpened() {
|
||||||
|
|
|
@ -0,0 +1,53 @@
|
||||||
|
package org.telegram.ui;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.view.Gravity;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.WindowManager;
|
||||||
|
import android.widget.FrameLayout;
|
||||||
|
|
||||||
|
import org.telegram.messenger.AndroidUtilities;
|
||||||
|
import org.telegram.messenger.LocaleController;
|
||||||
|
import org.telegram.messenger.R;
|
||||||
|
import org.telegram.ui.ActionBar.ActionBarMenuSubItem;
|
||||||
|
import org.telegram.ui.ActionBar.ActionBarPopupWindow;
|
||||||
|
import org.telegram.ui.ActionBar.Theme;
|
||||||
|
import org.telegram.ui.Components.LayoutHelper;
|
||||||
|
|
||||||
|
public class ReadAllMentionsMenu {
|
||||||
|
|
||||||
|
public final static int TYPE_REACTIONS = 0;
|
||||||
|
public final static int TYPE_MENTIONS = 1;
|
||||||
|
|
||||||
|
public static ActionBarPopupWindow show(int type, Activity activity, FrameLayout contentView, View mentionButton, Theme.ResourcesProvider resourcesProvider, Runnable onRead) {
|
||||||
|
ActionBarPopupWindow.ActionBarPopupWindowLayout popupWindowLayout = new ActionBarPopupWindow.ActionBarPopupWindowLayout(activity);
|
||||||
|
popupWindowLayout.setMinimumWidth(AndroidUtilities.dp(200));
|
||||||
|
|
||||||
|
ActionBarMenuSubItem cell = new ActionBarMenuSubItem(activity, true,true, resourcesProvider);
|
||||||
|
cell.setMinimumWidth(AndroidUtilities.dp(200));
|
||||||
|
cell.setTextAndIcon(type == TYPE_REACTIONS ? LocaleController.getString("ReadAllReactions", R.string.ReadAllReactions) : LocaleController.getString("ReadAllMentions", R.string.ReadAllMentions) , R.drawable.msg_seen);
|
||||||
|
cell.setOnClickListener(view -> {
|
||||||
|
if (onRead != null) {
|
||||||
|
onRead.run();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
popupWindowLayout.addView(cell);
|
||||||
|
|
||||||
|
ActionBarPopupWindow scrimPopupWindow = new ActionBarPopupWindow(popupWindowLayout, LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT);
|
||||||
|
scrimPopupWindow.setPauseNotifications(true);
|
||||||
|
scrimPopupWindow.setDismissAnimationDuration(220);
|
||||||
|
scrimPopupWindow.setOutsideTouchable(true);
|
||||||
|
scrimPopupWindow.setClippingEnabled(true);
|
||||||
|
scrimPopupWindow.setAnimationStyle(R.style.PopupContextAnimation);
|
||||||
|
scrimPopupWindow.setFocusable(true);
|
||||||
|
popupWindowLayout.measure(View.MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(1000), View.MeasureSpec.AT_MOST), View.MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(1000), View.MeasureSpec.AT_MOST));
|
||||||
|
scrimPopupWindow.setInputMethodMode(ActionBarPopupWindow.INPUT_METHOD_NOT_NEEDED);
|
||||||
|
scrimPopupWindow.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_UNSPECIFIED);
|
||||||
|
scrimPopupWindow.getContentView().setFocusableInTouchMode(true);
|
||||||
|
|
||||||
|
float x = mentionButton.getX() + mentionButton.getWidth() - popupWindowLayout.getMeasuredWidth() + AndroidUtilities.dp(8);
|
||||||
|
float y = mentionButton.getY() - popupWindowLayout.getMeasuredHeight();
|
||||||
|
scrimPopupWindow.showAtLocation(contentView, Gravity.LEFT | Gravity.TOP, (int) x, (int) y);
|
||||||
|
return scrimPopupWindow;
|
||||||
|
}
|
||||||
|
}
|
|
@ -35,14 +35,6 @@ import android.graphics.drawable.ColorDrawable;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.graphics.drawable.GradientDrawable;
|
import android.graphics.drawable.GradientDrawable;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
|
|
||||||
import androidx.collection.LongSparseArray;
|
|
||||||
import androidx.recyclerview.widget.DefaultItemAnimator;
|
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
|
||||||
import androidx.viewpager.widget.PagerAdapter;
|
|
||||||
import androidx.viewpager.widget.ViewPager;
|
|
||||||
|
|
||||||
import android.os.SystemClock;
|
import android.os.SystemClock;
|
||||||
import android.text.TextPaint;
|
import android.text.TextPaint;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
|
@ -59,7 +51,12 @@ import android.widget.FrameLayout;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import com.google.android.exoplayer2.util.Log;
|
import androidx.collection.LongSparseArray;
|
||||||
|
import androidx.recyclerview.widget.DefaultItemAnimator;
|
||||||
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
import androidx.viewpager.widget.PagerAdapter;
|
||||||
|
import androidx.viewpager.widget.ViewPager;
|
||||||
|
|
||||||
import org.telegram.messenger.AndroidUtilities;
|
import org.telegram.messenger.AndroidUtilities;
|
||||||
import org.telegram.messenger.ApplicationLoader;
|
import org.telegram.messenger.ApplicationLoader;
|
||||||
|
@ -326,21 +323,23 @@ public class ThemePreviewActivity extends BaseFragment implements DownloadContro
|
||||||
|
|
||||||
if (screenType == SCREEN_TYPE_ACCENT_COLOR) {
|
if (screenType == SCREEN_TYPE_ACCENT_COLOR) {
|
||||||
accent = applyingTheme.getAccent(!edit);
|
accent = applyingTheme.getAccent(!edit);
|
||||||
useDefaultThemeForButtons = false;
|
if (accent != null) {
|
||||||
backupAccentColor = accent.accentColor;
|
useDefaultThemeForButtons = false;
|
||||||
backupAccentColor2 = accent.accentColor2;
|
backupAccentColor = accent.accentColor;
|
||||||
backupMyMessagesAccentColor = accent.myMessagesAccentColor;
|
backupAccentColor2 = accent.accentColor2;
|
||||||
backupMyMessagesGradientAccentColor1 = accent.myMessagesGradientAccentColor1;
|
backupMyMessagesAccentColor = accent.myMessagesAccentColor;
|
||||||
backupMyMessagesGradientAccentColor2 = accent.myMessagesGradientAccentColor2;
|
backupMyMessagesGradientAccentColor1 = accent.myMessagesGradientAccentColor1;
|
||||||
backupMyMessagesGradientAccentColor3 = accent.myMessagesGradientAccentColor3;
|
backupMyMessagesGradientAccentColor2 = accent.myMessagesGradientAccentColor2;
|
||||||
backupMyMessagesAnimated = accent.myMessagesAnimated;
|
backupMyMessagesGradientAccentColor3 = accent.myMessagesGradientAccentColor3;
|
||||||
backupBackgroundOverrideColor = accent.backgroundOverrideColor;
|
backupMyMessagesAnimated = accent.myMessagesAnimated;
|
||||||
backupBackgroundGradientOverrideColor1 = accent.backgroundGradientOverrideColor1;
|
backupBackgroundOverrideColor = accent.backgroundOverrideColor;
|
||||||
backupBackgroundGradientOverrideColor2 = accent.backgroundGradientOverrideColor2;
|
backupBackgroundGradientOverrideColor1 = accent.backgroundGradientOverrideColor1;
|
||||||
backupBackgroundGradientOverrideColor3 = accent.backgroundGradientOverrideColor3;
|
backupBackgroundGradientOverrideColor2 = accent.backgroundGradientOverrideColor2;
|
||||||
backupIntensity = accent.patternIntensity;
|
backupBackgroundGradientOverrideColor3 = accent.backgroundGradientOverrideColor3;
|
||||||
backupSlug = accent.patternSlug;
|
backupIntensity = accent.patternIntensity;
|
||||||
backupBackgroundRotation = accent.backgroundRotation;
|
backupSlug = accent.patternSlug;
|
||||||
|
backupBackgroundRotation = accent.backgroundRotation;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if (screenType == SCREEN_TYPE_PREVIEW) {
|
if (screenType == SCREEN_TYPE_PREVIEW) {
|
||||||
useDefaultThemeForButtons = false;
|
useDefaultThemeForButtons = false;
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package org.telegram.ui;
|
package org.telegram.ui;
|
||||||
|
|
||||||
|
import static org.telegram.ui.GroupCallActivity.TRANSITION_DURATION;
|
||||||
|
|
||||||
import android.Manifest;
|
import android.Manifest;
|
||||||
import android.animation.Animator;
|
import android.animation.Animator;
|
||||||
import android.animation.AnimatorListenerAdapter;
|
import android.animation.AnimatorListenerAdapter;
|
||||||
|
@ -66,6 +68,7 @@ import org.telegram.messenger.voip.Instance;
|
||||||
import org.telegram.messenger.voip.VideoCapturerDevice;
|
import org.telegram.messenger.voip.VideoCapturerDevice;
|
||||||
import org.telegram.messenger.voip.VoIPService;
|
import org.telegram.messenger.voip.VoIPService;
|
||||||
import org.telegram.tgnet.TLRPC;
|
import org.telegram.tgnet.TLRPC;
|
||||||
|
import org.telegram.ui.ActionBar.ActionBar;
|
||||||
import org.telegram.ui.ActionBar.AlertDialog;
|
import org.telegram.ui.ActionBar.AlertDialog;
|
||||||
import org.telegram.ui.ActionBar.DarkAlertDialog;
|
import org.telegram.ui.ActionBar.DarkAlertDialog;
|
||||||
import org.telegram.ui.ActionBar.Theme;
|
import org.telegram.ui.ActionBar.Theme;
|
||||||
|
@ -128,6 +131,7 @@ public class VoIPFragment implements VoIPService.StateListener, NotificationCent
|
||||||
LinearLayout statusLayout;
|
LinearLayout statusLayout;
|
||||||
private VoIPFloatingLayout currentUserCameraFloatingLayout;
|
private VoIPFloatingLayout currentUserCameraFloatingLayout;
|
||||||
private VoIPFloatingLayout callingUserMiniFloatingLayout;
|
private VoIPFloatingLayout callingUserMiniFloatingLayout;
|
||||||
|
private boolean currentUserCameraIsFullscreen;
|
||||||
|
|
||||||
private TextureViewRenderer callingUserMiniTextureRenderer;
|
private TextureViewRenderer callingUserMiniTextureRenderer;
|
||||||
private VoIPTextureView callingUserTextureView;
|
private VoIPTextureView callingUserTextureView;
|
||||||
|
@ -210,6 +214,25 @@ public class VoIPFragment implements VoIPService.StateListener, NotificationCent
|
||||||
private boolean screenWasWakeup;
|
private boolean screenWasWakeup;
|
||||||
private boolean isVideoCall;
|
private boolean isVideoCall;
|
||||||
|
|
||||||
|
/* === pinch to zoom === */
|
||||||
|
private float pinchStartCenterX;
|
||||||
|
private float pinchStartCenterY;
|
||||||
|
private float pinchStartDistance;
|
||||||
|
private float pinchTranslationX;
|
||||||
|
private float pinchTranslationY;
|
||||||
|
private boolean isInPinchToZoomTouchMode;
|
||||||
|
|
||||||
|
private float pinchCenterX;
|
||||||
|
private float pinchCenterY;
|
||||||
|
|
||||||
|
private int pointerId1, pointerId2;
|
||||||
|
|
||||||
|
float pinchScale = 1f;
|
||||||
|
private boolean zoomStarted;
|
||||||
|
private boolean canZoomGesture;
|
||||||
|
ValueAnimator zoomBackAnimator;
|
||||||
|
/* === pinch to zoom === */
|
||||||
|
|
||||||
public static void show(Activity activity, int account) {
|
public static void show(Activity activity, int account) {
|
||||||
show(activity, false, account);
|
show(activity, false, account);
|
||||||
}
|
}
|
||||||
|
@ -316,6 +339,7 @@ public class VoIPFragment implements VoIPService.StateListener, NotificationCent
|
||||||
if (callingUserIsVideo && currentUserIsVideo && cameraForceExpanded) {
|
if (callingUserIsVideo && currentUserIsVideo && cameraForceExpanded) {
|
||||||
cameraForceExpanded = false;
|
cameraForceExpanded = false;
|
||||||
currentUserCameraFloatingLayout.setRelativePosition(callingUserMiniFloatingLayout);
|
currentUserCameraFloatingLayout.setRelativePosition(callingUserMiniFloatingLayout);
|
||||||
|
currentUserCameraIsFullscreen = false;
|
||||||
previousState = currentState;
|
previousState = currentState;
|
||||||
updateViewState();
|
updateViewState();
|
||||||
return;
|
return;
|
||||||
|
@ -507,11 +531,93 @@ public class VoIPFragment implements VoIPService.StateListener, NotificationCent
|
||||||
long pressedTime;
|
long pressedTime;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onTouchEvent(MotionEvent event) {
|
public boolean onTouchEvent(MotionEvent ev) {
|
||||||
switch (event.getAction()) {
|
/* === pinch to zoom === */
|
||||||
|
if (!canZoomGesture && !isInPinchToZoomTouchMode && !zoomStarted && ev.getActionMasked() != MotionEvent.ACTION_DOWN) {
|
||||||
|
finishZoom();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (ev.getActionMasked() == MotionEvent.ACTION_DOWN) {
|
||||||
|
canZoomGesture = false;
|
||||||
|
isInPinchToZoomTouchMode = false;
|
||||||
|
zoomStarted = false;
|
||||||
|
}
|
||||||
|
VoIPTextureView currentTextureView = getFullscreenTextureView();
|
||||||
|
|
||||||
|
if (ev.getActionMasked() == MotionEvent.ACTION_DOWN || ev.getActionMasked() == MotionEvent.ACTION_POINTER_DOWN) {
|
||||||
|
if (ev.getActionMasked() == MotionEvent.ACTION_DOWN) {
|
||||||
|
AndroidUtilities.rectTmp.set(currentTextureView.getX(), currentTextureView.getY(), currentTextureView.getX() + currentTextureView.getMeasuredWidth(), currentTextureView.getY() + currentTextureView.getMeasuredHeight());
|
||||||
|
AndroidUtilities.rectTmp.inset((currentTextureView.getMeasuredHeight() * currentTextureView.scaleTextureToFill - currentTextureView.getMeasuredHeight()) / 2, (currentTextureView.getMeasuredWidth() * currentTextureView.scaleTextureToFill - currentTextureView.getMeasuredWidth()) / 2);
|
||||||
|
if (!GroupCallActivity.isLandscapeMode) {
|
||||||
|
AndroidUtilities.rectTmp.top = Math.max(AndroidUtilities.rectTmp.top, ActionBar.getCurrentActionBarHeight());
|
||||||
|
AndroidUtilities.rectTmp.bottom = Math.min(AndroidUtilities.rectTmp.bottom, currentTextureView.getMeasuredHeight() - AndroidUtilities.dp(90));
|
||||||
|
} else {
|
||||||
|
AndroidUtilities.rectTmp.top = Math.max(AndroidUtilities.rectTmp.top, ActionBar.getCurrentActionBarHeight());
|
||||||
|
AndroidUtilities.rectTmp.right = Math.min(AndroidUtilities.rectTmp.right, currentTextureView.getMeasuredWidth() - AndroidUtilities.dp(90));
|
||||||
|
}
|
||||||
|
canZoomGesture = AndroidUtilities.rectTmp.contains(ev.getX(), ev.getY());
|
||||||
|
if (!canZoomGesture) {
|
||||||
|
finishZoom();
|
||||||
|
// return maybeSwipeToBackGesture;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!isInPinchToZoomTouchMode && ev.getPointerCount() == 2) {
|
||||||
|
pinchStartDistance = (float) Math.hypot(ev.getX(1) - ev.getX(0), ev.getY(1) - ev.getY(0));
|
||||||
|
pinchStartCenterX = pinchCenterX = (ev.getX(0) + ev.getX(1)) / 2.0f;
|
||||||
|
pinchStartCenterY = pinchCenterY = (ev.getY(0) + ev.getY(1)) / 2.0f;
|
||||||
|
pinchScale = 1f;
|
||||||
|
|
||||||
|
pointerId1 = ev.getPointerId(0);
|
||||||
|
pointerId2 = ev.getPointerId(1);
|
||||||
|
isInPinchToZoomTouchMode = true;
|
||||||
|
}
|
||||||
|
} else if (ev.getActionMasked() == MotionEvent.ACTION_MOVE && isInPinchToZoomTouchMode) {
|
||||||
|
int index1 = -1;
|
||||||
|
int index2 = -1;
|
||||||
|
for (int i = 0; i < ev.getPointerCount(); i++) {
|
||||||
|
if (pointerId1 == ev.getPointerId(i)) {
|
||||||
|
index1 = i;
|
||||||
|
}
|
||||||
|
if (pointerId2 == ev.getPointerId(i)) {
|
||||||
|
index2 = i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (index1 == -1 || index2 == -1) {
|
||||||
|
getParent().requestDisallowInterceptTouchEvent(false);
|
||||||
|
finishZoom();
|
||||||
|
// return maybeSwipeToBackGesture;
|
||||||
|
}
|
||||||
|
pinchScale = (float) Math.hypot(ev.getX(index2) - ev.getX(index1), ev.getY(index2) - ev.getY(index1)) / pinchStartDistance;
|
||||||
|
if (pinchScale > 1.005f && !zoomStarted) {
|
||||||
|
pinchStartDistance = (float) Math.hypot(ev.getX(index2) - ev.getX(index1), ev.getY(index2) - ev.getY(index1));
|
||||||
|
pinchStartCenterX = pinchCenterX = (ev.getX(index1) + ev.getX(index2)) / 2.0f;
|
||||||
|
pinchStartCenterY = pinchCenterY = (ev.getY(index1) + ev.getY(index2)) / 2.0f;
|
||||||
|
pinchScale = 1f;
|
||||||
|
pinchTranslationX = 0f;
|
||||||
|
pinchTranslationY = 0f;
|
||||||
|
getParent().requestDisallowInterceptTouchEvent(true);
|
||||||
|
zoomStarted = true;//
|
||||||
|
isInPinchToZoomTouchMode = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
float newPinchCenterX = (ev.getX(index1) + ev.getX(index2)) / 2.0f;
|
||||||
|
float newPinchCenterY = (ev.getY(index1) + ev.getY(index2)) / 2.0f;
|
||||||
|
|
||||||
|
float moveDx = pinchStartCenterX - newPinchCenterX;
|
||||||
|
float moveDy = pinchStartCenterY - newPinchCenterY;
|
||||||
|
pinchTranslationX = -moveDx / pinchScale;
|
||||||
|
pinchTranslationY = -moveDy / pinchScale;
|
||||||
|
invalidate();
|
||||||
|
} else if ((ev.getActionMasked() == MotionEvent.ACTION_UP || (ev.getActionMasked() == MotionEvent.ACTION_POINTER_UP && checkPointerIds(ev)) || ev.getActionMasked() == MotionEvent.ACTION_CANCEL)) {
|
||||||
|
getParent().requestDisallowInterceptTouchEvent(false);
|
||||||
|
finishZoom();
|
||||||
|
}
|
||||||
|
fragmentView.invalidate();
|
||||||
|
|
||||||
|
switch (ev.getAction()) {
|
||||||
case MotionEvent.ACTION_DOWN:
|
case MotionEvent.ACTION_DOWN:
|
||||||
pressedX = event.getX();
|
pressedX = ev.getX();
|
||||||
pressedY = event.getY();
|
pressedY = ev.getY();
|
||||||
check = true;
|
check = true;
|
||||||
pressedTime = System.currentTimeMillis();
|
pressedTime = System.currentTimeMillis();
|
||||||
break;
|
break;
|
||||||
|
@ -520,8 +626,8 @@ public class VoIPFragment implements VoIPService.StateListener, NotificationCent
|
||||||
break;
|
break;
|
||||||
case MotionEvent.ACTION_UP:
|
case MotionEvent.ACTION_UP:
|
||||||
if (check) {
|
if (check) {
|
||||||
float dx = event.getX() - pressedX;
|
float dx = ev.getX() - pressedX;
|
||||||
float dy = event.getY() - pressedY;
|
float dy = ev.getY() - pressedY;
|
||||||
long currentTime = System.currentTimeMillis();
|
long currentTime = System.currentTimeMillis();
|
||||||
if (dx * dx + dy * dy < touchSlop * touchSlop && currentTime - pressedTime < 300 && currentTime - lastContentTapTime > 300) {
|
if (dx * dx + dy * dy < touchSlop * touchSlop && currentTime - pressedTime < 300 && currentTime - lastContentTapTime > 300) {
|
||||||
lastContentTapTime = System.currentTimeMillis();
|
lastContentTapTime = System.currentTimeMillis();
|
||||||
|
@ -537,11 +643,34 @@ public class VoIPFragment implements VoIPService.StateListener, NotificationCent
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return check;
|
return canZoomGesture || check;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean drawChild(Canvas canvas, View child, long drawingTime) {
|
||||||
|
if (child == callingUserPhotoView && (currentUserIsVideo || callingUserIsVideo)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (
|
||||||
|
child == callingUserPhotoView ||
|
||||||
|
child == callingUserTextureView ||
|
||||||
|
(child == currentUserCameraFloatingLayout && currentUserCameraIsFullscreen)
|
||||||
|
) {
|
||||||
|
if (zoomStarted || zoomBackAnimator != null) {
|
||||||
|
canvas.save();
|
||||||
|
canvas.scale(pinchScale, pinchScale, pinchCenterX, pinchCenterY);
|
||||||
|
canvas.translate(pinchTranslationX, pinchTranslationY);
|
||||||
|
boolean b = super.drawChild(canvas, child, drawingTime);
|
||||||
|
canvas.restore();
|
||||||
|
return b;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return super.drawChild(canvas, child, drawingTime);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
frameLayout.setClipToPadding(false);
|
frameLayout.setClipToPadding(false);
|
||||||
frameLayout.setClipChildren(false);
|
frameLayout.setClipChildren(false);
|
||||||
|
frameLayout.setBackgroundColor(0xff000000);
|
||||||
updateSystemBarColors();
|
updateSystemBarColors();
|
||||||
fragmentView = frameLayout;
|
fragmentView = frameLayout;
|
||||||
frameLayout.setFitsSystemWindows(true);
|
frameLayout.setFitsSystemWindows(true);
|
||||||
|
@ -558,6 +687,7 @@ public class VoIPFragment implements VoIPService.StateListener, NotificationCent
|
||||||
callingUserTextureView = new VoIPTextureView(context, false, true, false, false);
|
callingUserTextureView = new VoIPTextureView(context, false, true, false, false);
|
||||||
callingUserTextureView.renderer.setScalingType(RendererCommon.ScalingType.SCALE_ASPECT_FIT);
|
callingUserTextureView.renderer.setScalingType(RendererCommon.ScalingType.SCALE_ASPECT_FIT);
|
||||||
callingUserTextureView.renderer.setEnableHardwareScaler(true);
|
callingUserTextureView.renderer.setEnableHardwareScaler(true);
|
||||||
|
callingUserTextureView.renderer.setRotateTextureWithScreen(true);
|
||||||
callingUserTextureView.scaleType = VoIPTextureView.SCALE_TYPE_FIT;
|
callingUserTextureView.scaleType = VoIPTextureView.SCALE_TYPE_FIT;
|
||||||
// callingUserTextureView.attachBackgroundRenderer();
|
// callingUserTextureView.attachBackgroundRenderer();
|
||||||
|
|
||||||
|
@ -588,6 +718,7 @@ public class VoIPFragment implements VoIPService.StateListener, NotificationCent
|
||||||
currentUserCameraFloatingLayout = new VoIPFloatingLayout(context);
|
currentUserCameraFloatingLayout = new VoIPFloatingLayout(context);
|
||||||
currentUserCameraFloatingLayout.setDelegate((progress, value) -> currentUserTextureView.setScreenshareMiniProgress(progress, value));
|
currentUserCameraFloatingLayout.setDelegate((progress, value) -> currentUserTextureView.setScreenshareMiniProgress(progress, value));
|
||||||
currentUserCameraFloatingLayout.setRelativePosition(1f, 1f);
|
currentUserCameraFloatingLayout.setRelativePosition(1f, 1f);
|
||||||
|
currentUserCameraIsFullscreen = true;
|
||||||
currentUserTextureView = new VoIPTextureView(context, true, false);
|
currentUserTextureView = new VoIPTextureView(context, true, false);
|
||||||
currentUserTextureView.renderer.setIsCamera(true);
|
currentUserTextureView.renderer.setIsCamera(true);
|
||||||
currentUserTextureView.renderer.setUseCameraRotation(true);
|
currentUserTextureView.renderer.setUseCameraRotation(true);
|
||||||
|
@ -597,6 +728,7 @@ public class VoIPFragment implements VoIPService.StateListener, NotificationCent
|
||||||
hideUiRunnableWaiting = false;
|
hideUiRunnableWaiting = false;
|
||||||
lastContentTapTime = System.currentTimeMillis();
|
lastContentTapTime = System.currentTimeMillis();
|
||||||
callingUserMiniFloatingLayout.setRelativePosition(currentUserCameraFloatingLayout);
|
callingUserMiniFloatingLayout.setRelativePosition(currentUserCameraFloatingLayout);
|
||||||
|
currentUserCameraIsFullscreen = true;
|
||||||
cameraForceExpanded = true;
|
cameraForceExpanded = true;
|
||||||
previousState = currentState;
|
previousState = currentState;
|
||||||
updateViewState();
|
updateViewState();
|
||||||
|
@ -624,6 +756,7 @@ public class VoIPFragment implements VoIPService.StateListener, NotificationCent
|
||||||
hideUiRunnableWaiting = false;
|
hideUiRunnableWaiting = false;
|
||||||
lastContentTapTime = System.currentTimeMillis();
|
lastContentTapTime = System.currentTimeMillis();
|
||||||
currentUserCameraFloatingLayout.setRelativePosition(callingUserMiniFloatingLayout);
|
currentUserCameraFloatingLayout.setRelativePosition(callingUserMiniFloatingLayout);
|
||||||
|
currentUserCameraIsFullscreen = false;
|
||||||
cameraForceExpanded = false;
|
cameraForceExpanded = false;
|
||||||
previousState = currentState;
|
previousState = currentState;
|
||||||
updateViewState();
|
updateViewState();
|
||||||
|
@ -772,7 +905,7 @@ public class VoIPFragment implements VoIPService.StateListener, NotificationCent
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDicline() {
|
public void onDecline() {
|
||||||
if (currentState == VoIPService.STATE_BUSY) {
|
if (currentState == VoIPService.STATE_BUSY) {
|
||||||
windowView.finish();
|
windowView.finish();
|
||||||
} else {
|
} else {
|
||||||
|
@ -855,6 +988,60 @@ public class VoIPFragment implements VoIPService.StateListener, NotificationCent
|
||||||
return frameLayout;
|
return frameLayout;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean checkPointerIds(MotionEvent ev) {
|
||||||
|
if (ev.getPointerCount() < 2) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (pointerId1 == ev.getPointerId(0) && pointerId2 == ev.getPointerId(1)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (pointerId1 == ev.getPointerId(1) && pointerId2 == ev.getPointerId(0)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private VoIPTextureView getFullscreenTextureView() {
|
||||||
|
if (callingUserIsVideo) {
|
||||||
|
return callingUserTextureView;
|
||||||
|
}
|
||||||
|
return currentUserTextureView;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void finishZoom() {
|
||||||
|
if (zoomStarted) {
|
||||||
|
zoomStarted = false;
|
||||||
|
zoomBackAnimator = ValueAnimator.ofFloat(1f, 0);
|
||||||
|
|
||||||
|
float fromScale = pinchScale;
|
||||||
|
float fromTranslateX = pinchTranslationX;
|
||||||
|
float fromTranslateY = pinchTranslationY;
|
||||||
|
zoomBackAnimator.addUpdateListener(valueAnimator -> {
|
||||||
|
float v = (float) valueAnimator.getAnimatedValue();
|
||||||
|
pinchScale = fromScale * v + 1f * (1f - v);
|
||||||
|
pinchTranslationX = fromTranslateX * v;
|
||||||
|
pinchTranslationY = fromTranslateY * v;
|
||||||
|
fragmentView.invalidate();
|
||||||
|
});
|
||||||
|
|
||||||
|
zoomBackAnimator.addListener(new AnimatorListenerAdapter() {
|
||||||
|
@Override
|
||||||
|
public void onAnimationEnd(Animator animation) {
|
||||||
|
zoomBackAnimator = null;
|
||||||
|
pinchScale = 1f;
|
||||||
|
pinchTranslationX = 0;
|
||||||
|
pinchTranslationY = 0;
|
||||||
|
fragmentView.invalidate();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
zoomBackAnimator.setDuration(TRANSITION_DURATION);
|
||||||
|
zoomBackAnimator.setInterpolator(CubicBezierInterpolator.DEFAULT);
|
||||||
|
zoomBackAnimator.start();
|
||||||
|
}
|
||||||
|
canZoomGesture = false;
|
||||||
|
isInPinchToZoomTouchMode = false;
|
||||||
|
}
|
||||||
|
|
||||||
private void initRenderers() {
|
private void initRenderers() {
|
||||||
currentUserTextureView.renderer.init(VideoCapturerDevice.getEglBase().getEglBaseContext(), new RendererCommon.RendererEvents() {
|
currentUserTextureView.renderer.init(VideoCapturerDevice.getEglBase().getEglBaseContext(), new RendererCommon.RendererEvents() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -1323,8 +1510,8 @@ public class VoIPFragment implements VoIPService.StateListener, NotificationCent
|
||||||
}
|
}
|
||||||
|
|
||||||
if (animated) {
|
if (animated) {
|
||||||
currentUserCameraFloatingLayout.saveRelatedPosition();
|
currentUserCameraFloatingLayout.saveRelativePosition();
|
||||||
callingUserMiniFloatingLayout.saveRelatedPosition();
|
callingUserMiniFloatingLayout.saveRelativePosition();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (callingUserIsVideo) {
|
if (callingUserIsVideo) {
|
||||||
|
@ -1620,9 +1807,9 @@ public class VoIPFragment implements VoIPService.StateListener, NotificationCent
|
||||||
currentUserCameraFloatingLayout.setVisibility(View.GONE);
|
currentUserCameraFloatingLayout.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
boolean swtichToFloatAnimated = animated;
|
boolean switchToFloatAnimated = animated;
|
||||||
if (currentUserCameraFloatingLayout.getTag() == null || (int) currentUserCameraFloatingLayout.getTag() == STATE_GONE) {
|
if (currentUserCameraFloatingLayout.getTag() == null || (int) currentUserCameraFloatingLayout.getTag() == STATE_GONE) {
|
||||||
swtichToFloatAnimated = false;
|
switchToFloatAnimated = false;
|
||||||
}
|
}
|
||||||
if (animated) {
|
if (animated) {
|
||||||
if (currentUserCameraFloatingLayout.getTag() != null && (int) currentUserCameraFloatingLayout.getTag() == STATE_GONE) {
|
if (currentUserCameraFloatingLayout.getTag() != null && (int) currentUserCameraFloatingLayout.getTag() == STATE_GONE) {
|
||||||
|
@ -1650,8 +1837,10 @@ public class VoIPFragment implements VoIPService.StateListener, NotificationCent
|
||||||
}
|
}
|
||||||
if ((currentUserCameraFloatingLayout.getTag() == null || (int) currentUserCameraFloatingLayout.getTag() != STATE_FLOATING) && currentUserCameraFloatingLayout.relativePositionToSetX < 0) {
|
if ((currentUserCameraFloatingLayout.getTag() == null || (int) currentUserCameraFloatingLayout.getTag() != STATE_FLOATING) && currentUserCameraFloatingLayout.relativePositionToSetX < 0) {
|
||||||
currentUserCameraFloatingLayout.setRelativePosition(1f, 1f);
|
currentUserCameraFloatingLayout.setRelativePosition(1f, 1f);
|
||||||
|
currentUserCameraIsFullscreen = true;
|
||||||
}
|
}
|
||||||
currentUserCameraFloatingLayout.setFloatingMode(state == STATE_FLOATING, swtichToFloatAnimated);
|
currentUserCameraFloatingLayout.setFloatingMode(state == STATE_FLOATING, switchToFloatAnimated);
|
||||||
|
currentUserCameraIsFullscreen = state != STATE_FLOATING;
|
||||||
}
|
}
|
||||||
currentUserCameraFloatingLayout.setTag(state);
|
currentUserCameraFloatingLayout.setTag(state);
|
||||||
}
|
}
|
||||||
|
|
Before Width: | Height: | Size: 500 B After Width: | Height: | Size: 680 B |
BIN
TMessagesProj/src/main/res/drawable-hdpi/ic_call_end_white_24dp.png
Executable file → Normal file
Before Width: | Height: | Size: 314 B After Width: | Height: | Size: 566 B |
BIN
TMessagesProj/src/main/res/drawable-hdpi/ic_call_end_white_36dp.png
Executable file → Normal file
Before Width: | Height: | Size: 424 B After Width: | Height: | Size: 821 B |
BIN
TMessagesProj/src/main/res/drawable-hdpi/ic_call_made_green_18dp.png
Executable file → Normal file
Before Width: | Height: | Size: 176 B After Width: | Height: | Size: 402 B |
Before Width: | Height: | Size: 344 B After Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 341 B After Width: | Height: | Size: 680 B |
Before Width: | Height: | Size: 341 B After Width: | Height: | Size: 461 B |
BIN
TMessagesProj/src/main/res/drawable-mdpi/ic_call_end_white_24dp.png
Executable file → Normal file
Before Width: | Height: | Size: 235 B After Width: | Height: | Size: 431 B |
BIN
TMessagesProj/src/main/res/drawable-mdpi/ic_call_end_white_36dp.png
Executable file → Normal file
Before Width: | Height: | Size: 314 B After Width: | Height: | Size: 593 B |
BIN
TMessagesProj/src/main/res/drawable-mdpi/ic_call_made_green_18dp.png
Executable file → Normal file
Before Width: | Height: | Size: 136 B After Width: | Height: | Size: 348 B |
Before Width: | Height: | Size: 242 B After Width: | Height: | Size: 807 B |
Before Width: | Height: | Size: 237 B After Width: | Height: | Size: 461 B |
Before Width: | Height: | Size: 794 B After Width: | Height: | Size: 805 B |
BIN
TMessagesProj/src/main/res/drawable-xhdpi/ic_call_end_white_24dp.png
Executable file → Normal file
Before Width: | Height: | Size: 389 B After Width: | Height: | Size: 721 B |
BIN
TMessagesProj/src/main/res/drawable-xhdpi/ic_call_end_white_36dp.png
Executable file → Normal file
Before Width: | Height: | Size: 553 B After Width: | Height: | Size: 1.0 KiB |
BIN
TMessagesProj/src/main/res/drawable-xhdpi/ic_call_made_green_18dp.png
Executable file → Normal file
Before Width: | Height: | Size: 191 B After Width: | Height: | Size: 484 B |
Before Width: | Height: | Size: 419 B After Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 433 B After Width: | Height: | Size: 805 B |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.2 KiB |
BIN
TMessagesProj/src/main/res/drawable-xxhdpi/ic_call_end_white_24dp.png
Executable file → Normal file
Before Width: | Height: | Size: 553 B After Width: | Height: | Size: 1.1 KiB |
BIN
TMessagesProj/src/main/res/drawable-xxhdpi/ic_call_end_white_36dp.png
Executable file → Normal file
Before Width: | Height: | Size: 778 B After Width: | Height: | Size: 1.6 KiB |
BIN
TMessagesProj/src/main/res/drawable-xxhdpi/ic_call_made_green_18dp.png
Executable file → Normal file
Before Width: | Height: | Size: 224 B After Width: | Height: | Size: 603 B |
Before Width: | Height: | Size: 581 B After Width: | Height: | Size: 2.6 KiB |
Before Width: | Height: | Size: 588 B After Width: | Height: | Size: 1.2 KiB |
|
@ -0,0 +1 @@
|
||||||
|
{"v":"5.8.1","fr":60,"ip":0,"op":90,"w":512,"h":512,"nm":"gif","ddd":0,"assets":[],"layers":[{"ddd":0,"ind":1,"ty":4,"nm":"Gif","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[256,256,0],"ix":2,"l":2},"a":{"a":0,"k":[256,256,0],"ix":1,"l":2},"s":{"a":1,"k":[{"i":{"x":[0.4,0.4,0.4],"y":[1,1,1]},"o":{"x":[0.6,0.6,0.6],"y":[0,0,0]},"t":0,"s":[0,0,100]},{"i":{"x":[0.4,0.4,0.4],"y":[1,1,1]},"o":{"x":[0.6,0.6,0.6],"y":[0,0,0]},"t":15,"s":[120,120,100]},{"i":{"x":[0.4,0.4,0.4],"y":[1,1,1]},"o":{"x":[0.6,0.6,0.6],"y":[0,0,0]},"t":25,"s":[96,96,100]},{"t":35,"s":[100,100,100]}],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[0,0],[0,0]],"o":[[0,0],[0,0]],"v":[[357.564,262.852],[318.756,262.852]],"c":false},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ind":1,"ty":"sh","ix":2,"ks":{"a":0,"k":{"i":[[0,0],[0,0],[0,-2.761],[0,0]],"o":[[0,0],[-2.761,0],[0,0],[0,0]],"v":[[376.934,206],[323.756,206],[318.756,211],[318.756,306]],"c":false},"ix":2},"nm":"Path 2","mn":"ADBE Vector Shape - Group","hd":false},{"ind":2,"ty":"sh","ix":3,"ks":{"a":0,"k":{"i":[[0,0],[0,0]],"o":[[0,0],[0,0]],"v":[[265.097,206],[265.097,306]],"c":false},"ix":2},"nm":"Path 3","mn":"ADBE Vector Shape - Group","hd":false},{"ind":3,"ty":"sh","ix":4,"ks":{"a":0,"k":{"i":[[0,0],[10.112,0],[0,-27.614],[-27.614,0],[-7.761,4.955],[0,0],[3.368,0],[0,0]],"o":[[-7.867,-5.161],[-27.614,0],[0,27.614],[9.891,0],[0,0],[0,-3.368],[0,0],[0,0]],"v":[[212.39,214.163],[185,206],[135,256],[185,306],[211.871,298.173],[211.871,267.678],[205.774,261.581],[189.708,261.581]],"c":false},"ix":2},"nm":"Path 4","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"tm","s":{"a":1,"k":[{"i":{"x":[0],"y":[1]},"o":{"x":[0.167],"y":[0.167]},"t":10,"s":[100]},{"t":35,"s":[0]}],"ix":1},"e":{"a":0,"k":100,"ix":2},"o":{"a":0,"k":0,"ix":3},"m":1,"ix":5,"nm":"Trim Paths 1","mn":"ADBE Vector Filter - Trim","hd":false},{"ty":"st","c":{"a":0,"k":[0,0,0,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":24,"ix":5},"lc":2,"lj":2,"bm":0,"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 1","np":6,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false},{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[-28.529,0],[0,0],[-10.43,-5.578],[-5.578,-10.43],[0,-28.529],[0,0],[5.578,-10.43],[10.43,-5.578],[28.529,0],[0,0],[10.43,5.578],[5.578,10.43],[0,28.529],[0,0],[-5.578,10.43],[-10.43,5.578]],"o":[[0,0],[28.529,0],[10.43,5.578],[5.578,10.43],[0,0],[0,28.529],[-5.578,10.43],[-10.43,5.578],[0,0],[-28.529,0],[-10.43,-5.578],[-5.578,-10.43],[0,0],[0,-28.529],[5.578,-10.43],[10.43,-5.578]],"v":[[-98.956,-140],[99.956,-140],[149.259,-131.452],[173.452,-107.259],[182,-57.956],[182,57.956],[173.452,107.259],[149.259,131.452],[99.956,140],[-98.956,140],[-148.259,131.452],[-172.452,107.259],[-181,57.956],[-181,-57.956],[-172.452,-107.259],[-148.259,-131.452]],"c":true},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"fl","c":{"a":0,"k":[1,1,1,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[256,256],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 5","np":2,"cix":2,"bm":0,"ix":2,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":90,"st":0,"bm":0}],"markers":[]}
|
|
@ -2825,6 +2825,7 @@
|
||||||
<string name="VideoSavedHint">Video saved to gallery</string>
|
<string name="VideoSavedHint">Video saved to gallery</string>
|
||||||
<string name="PhotoSavedToDownloadsHint">Photo saved to downloads</string>
|
<string name="PhotoSavedToDownloadsHint">Photo saved to downloads</string>
|
||||||
<string name="VideoSavedToDownloadsHint">Video saved to downloads</string>
|
<string name="VideoSavedToDownloadsHint">Video saved to downloads</string>
|
||||||
|
<string name="GifSavedHint">Added to saved GIFs</string>
|
||||||
<string name="GifSavedToDownloadsHint">GIF saved to downloads</string>
|
<string name="GifSavedToDownloadsHint">GIF saved to downloads</string>
|
||||||
<string name="AudioSavedHint">File saved to music</string>
|
<string name="AudioSavedHint">File saved to music</string>
|
||||||
<string name="FileSavedHint">File saved to downloads</string>
|
<string name="FileSavedHint">File saved to downloads</string>
|
||||||
|
@ -4979,4 +4980,6 @@
|
||||||
<string name="PushChatReactInvoice">%1$s: %3$s to your invoice in %2$s</string>
|
<string name="PushChatReactInvoice">%1$s: %3$s to your invoice in %2$s</string>
|
||||||
<string name="PushChatReactGif">%1$s: %3$s to your GIF in %2$s</string>
|
<string name="PushChatReactGif">%1$s: %3$s to your GIF in %2$s</string>
|
||||||
<string name="BlurInChat">Blur in chat</string>
|
<string name="BlurInChat">Blur in chat</string>
|
||||||
|
<string name="ReadAllReactions">Read all reactions</string>
|
||||||
|
<string name="ReadAllMentions">Read all mentions</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|