Update to 7.7.1 (2291)

This commit is contained in:
DrKLO 2021-04-17 02:59:59 +03:00
parent 8bf056e27b
commit c4ada53b0d
67 changed files with 7599 additions and 4993 deletions

View file

@ -25,7 +25,7 @@ dependencies {
compileOnly 'org.checkerframework:checker-qual:2.5.2'
compileOnly 'org.checkerframework:checker-compat-qual:2.5.0'
implementation 'com.google.firebase:firebase-messaging:21.0.1'
implementation 'com.google.firebase:firebase-messaging:21.1.0'
implementation 'com.google.firebase:firebase-config:20.0.4'
implementation 'com.google.firebase:firebase-datatransport:17.0.11'
implementation 'com.google.firebase:firebase-appindexing:19.2.0'
@ -300,7 +300,7 @@ android {
}
}
defaultConfig.versionCode = 2284
defaultConfig.versionCode = 2291
applicationVariants.all { variant ->
variant.outputs.all { output ->
@ -319,7 +319,7 @@ android {
defaultConfig {
minSdkVersion 16
targetSdkVersion 29
versionName "7.7.0"
versionName "7.7.1"
vectorDrawables.generatedDensities = ['mdpi', 'hdpi', 'xhdpi', 'xxhdpi']

File diff suppressed because it is too large Load diff

View file

@ -123,9 +123,9 @@ extern "C" {
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
** [sqlite_version()] and [sqlite_source_id()].
*/
#define SQLITE_VERSION "3.34.0"
#define SQLITE_VERSION_NUMBER 3034000
#define SQLITE_SOURCE_ID "2020-12-01 16:14:00 a26b6597e3ae272231b96f9982c3bcc17ddec2f2b6eb4df06a224b91089fed5b"
#define SQLITE_VERSION "3.35.4"
#define SQLITE_VERSION_NUMBER 3035004
#define SQLITE_SOURCE_ID "2021-04-02 15:20:15 5d4c65779dab868b285519b19e4cf9d451d50c6048f06f653aa701ec212df45e"
/*
** CAPI3REF: Run-Time Library Version Numbers
@ -2115,7 +2115,13 @@ struct sqlite3_mem_methods {
** The second parameter is a pointer to an integer into which
** is written 0 or 1 to indicate whether triggers are disabled or enabled
** following this call. The second parameter may be a NULL pointer, in
** which case the trigger setting is not reported back. </dd>
** which case the trigger setting is not reported back.
**
** <p>Originally this option disabled all triggers. ^(However, since
** SQLite version 3.35.0, TEMP triggers are still allowed even if
** this option is off. So, in other words, this option now only disables
** triggers in the main database schema or in the schemas of ATTACH-ed
** databases.)^ </dd>
**
** [[SQLITE_DBCONFIG_ENABLE_VIEW]]
** <dt>SQLITE_DBCONFIG_ENABLE_VIEW</dt>
@ -2126,7 +2132,13 @@ struct sqlite3_mem_methods {
** The second parameter is a pointer to an integer into which
** is written 0 or 1 to indicate whether views are disabled or enabled
** following this call. The second parameter may be a NULL pointer, in
** which case the view setting is not reported back. </dd>
** which case the view setting is not reported back.
**
** <p>Originally this option disabled all views. ^(However, since
** SQLite version 3.35.0, TEMP views are still allowed even if
** this option is off. So, in other words, this option now only disables
** views in the main database schema or in the schemas of ATTACH-ed
** databases.)^ </dd>
**
** [[SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER]]
** <dt>SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER</dt>
@ -3499,6 +3511,7 @@ SQLITE_API void sqlite3_progress_handler(sqlite3*, int, int(*)(void*), void*);
** that uses dot-files in place of posix advisory locking.
** <tr><td> file:data.db?mode=readonly <td>
** An error. "readonly" is not a valid option for the "mode" parameter.
** Use "ro" instead: "file:data.db?mode=ro".
** </table>
**
** ^URI hexadecimal escape sequences (%HH) are supported within the path and
@ -3697,7 +3710,7 @@ SQLITE_API sqlite3_file *sqlite3_database_file_object(const char*);
** If the Y parameter to sqlite3_free_filename(Y) is anything other
** than a NULL pointer or a pointer previously acquired from
** sqlite3_create_filename(), then bad things such as heap
** corruption or segfaults may occur. The value Y should be
** corruption or segfaults may occur. The value Y should not be
** used again after sqlite3_free_filename(Y) has been called. This means
** that if the [sqlite3_vfs.xOpen()] method of a VFS has been called using Y,
** then the corresponding [sqlite3_module.xClose() method should also be
@ -7765,7 +7778,8 @@ SQLITE_API int sqlite3_test_control(int op, ...);
#define SQLITE_TESTCTRL_PRNG_SEED 28
#define SQLITE_TESTCTRL_EXTRA_SCHEMA_CHECKS 29
#define SQLITE_TESTCTRL_SEEK_COUNT 30
#define SQLITE_TESTCTRL_LAST 30 /* Largest TESTCTRL */
#define SQLITE_TESTCTRL_TRACEFLAGS 31
#define SQLITE_TESTCTRL_LAST 31 /* Largest TESTCTRL */
/*
** CAPI3REF: SQL Keyword Checking
@ -10438,6 +10452,14 @@ SQLITE_API int sqlite3session_patchset(
*/
SQLITE_API int sqlite3session_isempty(sqlite3_session *pSession);
/*
** CAPI3REF: Query for the amount of heap memory used by a session object.
**
** This API returns the total amount of heap memory in bytes currently
** used by the session object passed as the only argument.
*/
SQLITE_API sqlite3_int64 sqlite3session_memory_used(sqlite3_session *pSession);
/*
** CAPI3REF: Create An Iterator To Traverse A Changeset
** CONSTRUCTOR: sqlite3_changeset_iter
@ -10540,18 +10562,23 @@ SQLITE_API int sqlite3changeset_next(sqlite3_changeset_iter *pIter);
** call to [sqlite3changeset_next()] must have returned [SQLITE_ROW]. If this
** is not the case, this function returns [SQLITE_MISUSE].
**
** If argument pzTab is not NULL, then *pzTab is set to point to a
** nul-terminated utf-8 encoded string containing the name of the table
** affected by the current change. The buffer remains valid until either
** sqlite3changeset_next() is called on the iterator or until the
** conflict-handler function returns. If pnCol is not NULL, then *pnCol is
** set to the number of columns in the table affected by the change. If
** pbIndirect is not NULL, then *pbIndirect is set to true (1) if the change
** Arguments pOp, pnCol and pzTab may not be NULL. Upon return, three
** outputs are set through these pointers:
**
** *pOp is set to one of [SQLITE_INSERT], [SQLITE_DELETE] or [SQLITE_UPDATE],
** depending on the type of change that the iterator currently points to;
**
** *pnCol is set to the number of columns in the table affected by the change; and
**
** *pzTab is set to point to a nul-terminated utf-8 encoded string containing
** the name of the table affected by the current change. The buffer remains
** valid until either sqlite3changeset_next() is called on the iterator
** or until the conflict-handler function returns.
**
** If pbIndirect is not NULL, then *pbIndirect is set to true (1) if the change
** is an indirect change, or false (0) otherwise. See the documentation for
** [sqlite3session_indirect()] for a description of direct and indirect
** changes. Finally, if pOp is not NULL, then *pOp is set to one of
** [SQLITE_INSERT], [SQLITE_DELETE] or [SQLITE_UPDATE], depending on the
** type of change that the iterator currently points to.
** changes.
**
** If no error occurs, SQLITE_OK is returned. If an error does occur, an
** SQLite error code is returned. The values of the output variables may not

View file

@ -1185,6 +1185,9 @@ void ConnectionsManager::processServerResponse(TLObject *message, int64_t messag
} else if (typeInfo == typeid(TL_rpc_result)) {
TL_rpc_result *response = (TL_rpc_result *) message;
int64_t resultMid = response->req_msg_id;
if (resultMid == lastInvokeAfterMessageId) {
lastInvokeAfterMessageId = 0;
}
bool hasResult = response->result.get() != nullptr;
bool ignoreResult = false;
@ -1270,13 +1273,21 @@ void ConnectionsManager::processServerResponse(TLObject *message, int64_t messag
}
} else if ((request->requestFlags & RequestFlagFailOnServerErrors) == 0 || processEvenFailed) {
if (error->error_code == 500 || error->error_code < 0) {
discardResponse = true;
static std::string waitFailed = "MSG_WAIT_FAILED";
if (error->error_message.find(waitFailed) != std::string::npos) {
request->minStartTime = (int32_t) (getCurrentTimeMonotonicMillis() / 1000 + 1);
request->startTime = 0;
request->startTimeMillis = 0;
request->requestFlags &=~ RequestFlagInvokeAfter;
} else {
if (isWorkerBusy) {
request->minStartTime = 0;
} else {
request->minStartTime = request->startTime + (request->serverFailureCount > 10 ? 10 : request->serverFailureCount);
}
request->serverFailureCount++;
}
discardResponse = true;
} else if (error->error_code == 420) {
int32_t waitTime = 2;
static std::string floodWait = "FLOOD_WAIT_";
@ -2618,7 +2629,7 @@ void ConnectionsManager::processRequestQueue(uint32_t connectionTypes, uint32_t
int64_t maxRequestId = 0;
if (lastInvokeAfterMessageId != 0) {
int64_t timeMessage = (int64_t) (lastInvokeAfterMessageId / 4294967296.0);
if (getCurrentTime() - timeMessage <= 30) {
if (getCurrentTime() - timeMessage <= 5) {
maxRequestId = lastInvokeAfterMessageId;
}
}

View file

@ -18,7 +18,7 @@ public class BuildVars {
public static boolean LOGS_ENABLED = false;
public static boolean USE_CLOUD_STRINGS = true;
public static boolean CHECK_UPDATES = true;
public static int BUILD_VERSION = 2284;
public static int BUILD_VERSION = 2291;
public static String BUILD_VERSION_STRING = "7.7.0";
public static int APP_ID = 4;
public static String APP_HASH = "014b35b6184100b085b0d0572f9b5103";

View file

@ -23,6 +23,7 @@ import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.view.View;
import org.telegram.tgnet.TLObject;
import org.telegram.tgnet.TLRPC;
import org.telegram.ui.Components.AnimatedFileDrawable;
import org.telegram.ui.Components.LoadingStickerDrawable;
@ -31,12 +32,11 @@ import org.telegram.ui.Components.RecyclableDrawable;
import androidx.annotation.Keep;
import com.google.android.exoplayer2.util.Log;
public class ImageReceiver implements NotificationCenter.NotificationCenterDelegate {
public interface ImageReceiverDelegate {
void didSetImage(ImageReceiver imageReceiver, boolean set, boolean thumb, boolean memCache);
default void onAnimationReady(ImageReceiver imageReceiver) {
}
}
@ -195,6 +195,8 @@ public class ImageReceiver implements NotificationCenter.NotificationCenterDeleg
private Drawable currentMediaDrawable;
private BitmapShader mediaShader;
private boolean useRoundForThumb;
private Drawable staticThumbDrawable;
private String currentExt;
@ -313,6 +315,39 @@ public class ImageReceiver implements NotificationCenter.NotificationCenterDeleg
setImage(imageLocation, imageFilter, thumbLocation, thumbFilter, null, size, ext, parentObject, cacheType);
}
public void setForUserOrChat(TLObject object, Drawable avatarDrawable) {
setForUserOrChat(object, avatarDrawable, null);
}
public void setForUserOrChat(TLObject object, Drawable avatarDrawable, Object parentObject) {
if (parentObject == null) {
parentObject = object;
}
setUseRoundForThumbDrawable(true);
BitmapDrawable strippedBitmap = null;
boolean hasStripped = false;
if (object instanceof TLRPC.User) {
TLRPC.User user = (TLRPC.User) object;
if (user.photo != null) {
strippedBitmap = user.photo.strippedBitmap;
hasStripped = user.photo.stripped_thumb != null;
}
} else if (object instanceof TLRPC.Chat) {
TLRPC.Chat chat = (TLRPC.Chat) object;
if (chat.photo != null) {
strippedBitmap = chat.photo.strippedBitmap;
hasStripped = chat.photo.stripped_thumb != null;
}
}
if (strippedBitmap != null) {
setImage(ImageLocation.getForUserOrChat(object, ImageLocation.TYPE_SMALL), "50_50", strippedBitmap, null, parentObject, 0);
} else if (hasStripped) {
setImage(ImageLocation.getForUserOrChat(object, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(object, ImageLocation.TYPE_STRIPPED), "50_50", avatarDrawable, parentObject, 0);
} else {
setImage(ImageLocation.getForUserOrChat(object, ImageLocation.TYPE_SMALL), "50_50", avatarDrawable, null, parentObject, 0);
}
}
public void setImage(ImageLocation fileLocation, String fileFilter, ImageLocation thumbLocation, String thumbFilter, Drawable thumb, Object parentObject, int cacheType) {
setImage(null, null, fileLocation, fileFilter, thumbLocation, thumbFilter, thumb, 0, null, parentObject, cacheType);
}
@ -503,6 +538,9 @@ public class ImageReceiver implements NotificationCenter.NotificationCenterDeleg
imageShader = null;
thumbShader = null;
mediaShader = null;
if (useRoundForThumb && staticThumbDrawable != null) {
updateDrawableRadius(staticThumbDrawable);
}
currentAlpha = 1.0f;
if (staticThumbDrawable instanceof SvgHelper.SvgDrawable) {
@ -518,7 +556,7 @@ public class ImageReceiver implements NotificationCenter.NotificationCenterDeleg
if (invalidateAll) {
parentView.invalidate();
} else {
parentView.invalidate((int)imageX, (int) imageY, (int) (imageX + imageW), (int) (imageY + imageH));
parentView.invalidate((int) imageX, (int) imageY, (int) (imageX + imageW), (int) (imageY + imageH));
}
}
@ -677,7 +715,7 @@ public class ImageReceiver implements NotificationCenter.NotificationCenterDeleg
if (invalidateAll) {
parentView.invalidate();
} else {
parentView.invalidate((int)imageX, (int) imageY, (int) (imageX + imageW), (int) (imageY + imageH));
parentView.invalidate((int) imageX, (int) imageY, (int) (imageX + imageW), (int) (imageY + imageH));
}
}
if (forceCrossfade && crossfadeWithOldImage && crossfadeImage != null) {
@ -777,7 +815,7 @@ public class ImageReceiver implements NotificationCenter.NotificationCenterDeleg
public boolean onAttachedToWindow() {
currentOpenedLayerFlags = NotificationCenter.getGlobalInstance().getCurrentHeavyOperationFlags();
currentOpenedLayerFlags &=~ currentLayerNum;
currentOpenedLayerFlags &= ~currentLayerNum;
NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.didReplacedPhotoInMemCache);
NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.stopAllHeavyOperations);
NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.startAllHeavyOperations);
@ -816,6 +854,10 @@ public class ImageReceiver implements NotificationCenter.NotificationCenterDeleg
}
}
public void setUseRoundForThumbDrawable(boolean value) {
useRoundForThumb = value;
}
private void drawDrawable(Canvas canvas, Drawable drawable, int alpha, BitmapShader shader, int orientation, int isPressed) {
if (drawable instanceof BitmapDrawable) {
BitmapDrawable bitmapDrawable = (BitmapDrawable) drawable;
@ -902,7 +944,7 @@ public class ImageReceiver implements NotificationCenter.NotificationCenterDeleg
if (isRoundRect) {
try {
canvas.drawRoundRect(roundRect,roundRadius[0], roundRadius[0],roundPaint);
canvas.drawRoundRect(roundRect, roundRadius[0], roundRadius[0], roundPaint);
} catch (Exception e) {
onBitmapException(bitmapDrawable);
FileLog.e(e);
@ -1142,7 +1184,7 @@ public class ImageReceiver implements NotificationCenter.NotificationCenterDeleg
if (invalidateAll) {
parentView.invalidate();
} else {
parentView.invalidate((int)imageX, (int) imageY, (int) (imageX + imageW), (int) (imageY + imageH));
parentView.invalidate((int) imageX, (int) imageY, (int) (imageX + imageW), (int) (imageY + imageH));
}
}
}
@ -2079,7 +2121,7 @@ public class ImageReceiver implements NotificationCenter.NotificationCenterDeleg
if (currentLayerNum >= layer || currentOpenedLayerFlags == 0) {
return;
}
currentOpenedLayerFlags &=~ layer;
currentOpenedLayerFlags &= ~layer;
if (currentOpenedLayerFlags == 0) {
RLottieDrawable lottieDrawable = getLottieAnimation();
if (allowStartLottieAnimation && lottieDrawable != null && lottieDrawable.isHeavyDrawable()) {

View file

@ -1130,10 +1130,10 @@ public class LocaleController {
}
public String formatCurrencyString(long amount, String type) {
return formatCurrencyString(amount, true, type);
return formatCurrencyString(amount, true, true, false, type);
}
public String formatCurrencyString(long amount, boolean fixAnything, String type) {
public String formatCurrencyString(long amount, boolean fixAnything, boolean withExp, boolean editText, String type) {
type = type.toUpperCase();
String customFormat;
double doubleAmount;
@ -1200,14 +1200,24 @@ public class LocaleController {
doubleAmount = amount / 100.0;
break;
}
String result;
if (!withExp) {
customFormat = " %.0f";
}
if (currency != null) {
NumberFormat format = NumberFormat.getCurrencyInstance(currentLocale != null ? currentLocale : systemDefaultLocale);
format.setCurrency(currency);
if (fixAnything && type.equals("IRR")) {
if (editText) {
format.setGroupingUsed(false);
}
if (!withExp || fixAnything && type.equals("IRR")) {
format.setMaximumFractionDigits(0);
}
return (discount ? "-" : "") + format.format(doubleAmount);
String result = (discount ? "-" : "") + format.format(doubleAmount);
int idx = result.indexOf(type);
if (idx >= 0 && result.charAt(idx + type.length()) != ' ') {
result = result.substring(0, idx + type.length()) + " " + result.substring(idx + type.length());
}
return result;
}
return (discount ? "-" : "") + String.format(Locale.US, type + customFormat, doubleAmount);
}

View file

@ -273,6 +273,7 @@ public class MessagesController extends BaseController implements NotificationCe
public int maxFolderPinnedDialogsCount;
public int mapProvider;
public int availableMapProviders;
public int updateCheckDelay;
public String mapKey;
public int maxMessageLength;
public int maxCaptionLength;
@ -716,6 +717,7 @@ public class MessagesController extends BaseController implements NotificationCe
callRingTimeout = mainPreferences.getInt("callRingTimeout", 90000);
callConnectTimeout = mainPreferences.getInt("callConnectTimeout", 30000);
callPacketTimeout = mainPreferences.getInt("callPacketTimeout", 10000);
updateCheckDelay = mainPreferences.getInt("updateCheckDelay", 24 * 60 * 60);
maxPinnedDialogsCount = mainPreferences.getInt("maxPinnedDialogsCount", 5);
maxFolderPinnedDialogsCount = mainPreferences.getInt("maxFolderPinnedDialogsCount", 100);
maxMessageLength = mainPreferences.getInt("maxMessageLength", 4096);
@ -1583,6 +1585,25 @@ public class MessagesController extends BaseController implements NotificationCe
}
break;
}
case "inapp_update_check_delay": {
if (value.value instanceof TLRPC.TL_jsonNumber) {
TLRPC.TL_jsonNumber number = (TLRPC.TL_jsonNumber) value.value;
if (number.value != updateCheckDelay) {
updateCheckDelay = (int) number.value;
editor.putInt("updateCheckDelay", updateCheckDelay);
changed = true;
}
} else if (value.value instanceof TLRPC.TL_jsonString) {
TLRPC.TL_jsonString number = (TLRPC.TL_jsonString) value.value;
int delay = Utilities.parseInt(number.value);
if (delay != updateCheckDelay) {
updateCheckDelay = delay;
editor.putInt("updateCheckDelay", updateCheckDelay);
changed = true;
}
}
break;
}
case "stickers_emoji_suggest_only_api": {
if (value.value instanceof TLRPC.TL_jsonBool) {
TLRPC.TL_jsonBool bool = (TLRPC.TL_jsonBool) value.value;
@ -13702,7 +13723,7 @@ public class MessagesController extends BaseController implements NotificationCe
}
dialog = new TLRPC.TL_dialog();
dialog.id = uid;
dialog.top_message = lastMessage.getId();
int mid = dialog.top_message = lastMessage.getId();
dialog.last_message_date = lastMessage.messageOwner.date;
dialog.flags = ChatObject.isChannel(chat) ? 1 : 0;
dialogs_dict.put(uid, dialog);
@ -13724,7 +13745,7 @@ public class MessagesController extends BaseController implements NotificationCe
sortDialogs(null);
getNotificationCenter().postNotificationName(NotificationCenter.dialogsNeedReload, true);
}
} else {
} else if (mid > 0) {
int lowerId = (int) uid;
if (lowerId != 0) {
loadUnknownDialog(getInputPeer(lowerId), 0);

View file

@ -405,7 +405,7 @@ public class NotificationCenter {
}
public void postNotificationName(int id, Object... args) {
boolean allowDuringAnimation = id == startAllHeavyOperations || id == stopAllHeavyOperations || id == didReplacedPhotoInMemCache;
boolean allowDuringAnimation = id == startAllHeavyOperations || id == stopAllHeavyOperations || id == didReplacedPhotoInMemCache || id == closeChats;
ArrayList<Integer> expiredIndices = null;
if (!allowDuringAnimation && !allowedNotifications.isEmpty()) {
int size = allowedNotifications.size();

View file

@ -8,10 +8,13 @@
package org.telegram.tgnet;
import android.graphics.drawable.BitmapDrawable;
import android.os.Build;
import android.text.TextUtils;
import org.telegram.messenger.FileLoader;
import org.telegram.messenger.FileLog;
import org.telegram.messenger.ImageLoader;
import org.telegram.messenger.Utilities;
import java.util.ArrayList;
@ -402,6 +405,7 @@ public class TLRPC {
public FileLocation photo_big;
public byte[] stripped_thumb;
public int dc_id;
public BitmapDrawable strippedBitmap;
public static ChatPhoto TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) {
ChatPhoto result = null;
@ -508,6 +512,13 @@ public class TLRPC {
photo_big = FileLocation.TLdeserialize(stream, stream.readInt32(exception), exception);
if ((flags & 2) != 0) {
stripped_thumb = stream.readByteArray(exception);
if (Build.VERSION.SDK_INT >= 21) {
try {
strippedBitmap = new BitmapDrawable(ImageLoader.getStrippedPhotoBitmap(stripped_thumb, "b"));
} catch (Throwable e) {
FileLog.e(e);
}
}
}
dc_id = stream.readInt32(exception);
}
@ -26858,6 +26869,7 @@ public class TLRPC {
public FileLocation photo_big;
public byte[] stripped_thumb;
public int dc_id;
public BitmapDrawable strippedBitmap;
public static UserProfilePhoto TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) {
UserProfilePhoto result = null;
@ -26927,6 +26939,13 @@ public class TLRPC {
photo_big = FileLocation.TLdeserialize(stream, stream.readInt32(exception), exception);
if ((flags & 2) != 0) {
stripped_thumb = stream.readByteArray(exception);
if (Build.VERSION.SDK_INT >= 21) {
try {
strippedBitmap = new BitmapDrawable(ImageLoader.getStrippedPhotoBitmap(stripped_thumb, "b"));
} catch (Throwable e) {
FileLog.e(e);
}
}
}
dc_id = stream.readInt32(exception);
}

View file

@ -1685,12 +1685,12 @@ public class ActionBarMenuItem extends FrameLayout {
avatarImageView.setImageDrawable(combinedDrawable);
} else {
avatarImageView.getImageReceiver().setRoundRadius(AndroidUtilities.dp(16));
avatarImageView.getImageReceiver().setImage(ImageLocation.getForUserOrChat(user, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(user, ImageLocation.TYPE_STRIPPED), "50_50", thumbDrawable, user, 0);
avatarImageView.getImageReceiver().setForUserOrChat(user, thumbDrawable);
}
} else if (data.chat instanceof TLRPC.Chat) {
TLRPC.Chat chat = (TLRPC.Chat) data.chat;
avatarImageView.getImageReceiver().setRoundRadius(AndroidUtilities.dp(16));
avatarImageView.getImageReceiver().setImage(ImageLocation.getForUserOrChat(chat, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(chat, ImageLocation.TYPE_STRIPPED), "50_50", thumbDrawable, chat, 0);
avatarImageView.getImageReceiver().setForUserOrChat(chat, thumbDrawable);
}
} else if (data.filterType == FiltersView.FILTER_TYPE_ARCHIVE) {
CombinedDrawable combinedDrawable = Theme.createCircleDrawableWithIcon(AndroidUtilities.dp(32), R.drawable.chats_archive);

View file

@ -5357,6 +5357,7 @@ public class Theme {
if (isCurrentThemeNight()) {
switchNightThemeDelay = 2000;
lastDelayUpdateTime = SystemClock.elapsedRealtime();
AndroidUtilities.runOnUIThread(Theme::checkAutoNightThemeConditions, 2100);
}
}
currentTheme = themeInfo;

View file

@ -728,12 +728,12 @@ public class FiltersView extends RecyclerListView {
avatarImageView.setImageDrawable(combinedDrawable);
} else {
avatarImageView.getImageReceiver().setRoundRadius(AndroidUtilities.dp(16));
avatarImageView.getImageReceiver().setImage(ImageLocation.getForUserOrChat(user, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(user, ImageLocation.TYPE_STRIPPED), "50_50", thumbDrawable, user, 0);
avatarImageView.getImageReceiver().setForUserOrChat(user, thumbDrawable);
}
} else if (data.chat instanceof TLRPC.Chat) {
TLRPC.Chat chat = (TLRPC.Chat) data.chat;
avatarImageView.getImageReceiver().setRoundRadius(AndroidUtilities.dp(16));
avatarImageView.getImageReceiver().setImage(ImageLocation.getForUserOrChat(chat, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(chat, ImageLocation.TYPE_STRIPPED), "50_50", thumbDrawable, chat, 0);
avatarImageView.getImageReceiver().setForUserOrChat(chat, thumbDrawable);
}
} else {
avatarImageView.setImageDrawable(thumbDrawable);

View file

@ -110,12 +110,12 @@ public class AccountSelectCell extends FrameLayout {
TLRPC.User user = (TLRPC.User) object;
avatarDrawable.setInfo(user);
infoTextView.setText(ContactsController.formatName(user.first_name, user.last_name));
imageView.setImage(ImageLocation.getForUserOrChat(user, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(user, ImageLocation.TYPE_STRIPPED), "50_50", avatarDrawable, user);
imageView.setForUserOrChat(user, avatarDrawable);
} else {
TLRPC.Chat chat = (TLRPC.Chat) object;
avatarDrawable.setInfo(chat);
infoTextView.setText(chat.title);
imageView.setImage(ImageLocation.getForUserOrChat(chat, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(chat, ImageLocation.TYPE_STRIPPED), "50_50", avatarDrawable, chat);
imageView.setForUserOrChat(chat, avatarDrawable);
}
}
@ -125,7 +125,7 @@ public class AccountSelectCell extends FrameLayout {
avatarDrawable.setInfo(user);
textView.setText(ContactsController.formatName(user.first_name, user.last_name));
imageView.getImageReceiver().setCurrentAccount(account);
imageView.setImage(ImageLocation.getForUserOrChat(user,ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(user, ImageLocation.TYPE_STRIPPED), "50_50", avatarDrawable, user);
imageView.setForUserOrChat(user, avatarDrawable);
checkImageView.setVisibility(check && account == UserConfig.selectedAccount ? VISIBLE : INVISIBLE);
}

View file

@ -81,7 +81,7 @@ public class AdminedChannelCell extends FrameLayout {
SpannableStringBuilder stringBuilder = new SpannableStringBuilder(url + channel.username);
stringBuilder.setSpan(new URLSpanNoUnderline(""), url.length(), stringBuilder.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
statusTextView.setText(stringBuilder);
avatarImageView.setImage(ImageLocation.getForUserOrChat(channel, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(channel, ImageLocation.TYPE_STRIPPED), "50_50", avatarDrawable, currentChannel);
avatarImageView.setForUserOrChat(channel, avatarDrawable);
isLast = last;
}

View file

@ -3165,10 +3165,10 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
}
if (user != null) {
commentAvatarDrawables[a].setInfo(user);
commentAvatarImages[a].setImage(ImageLocation.getForUserOrChat(user, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(chat, ImageLocation.TYPE_STRIPPED), "50_50", commentAvatarDrawables[a], user, 0);
commentAvatarImages[a].setForUserOrChat(user, commentAvatarDrawables[a]);
} else if (chat != null) {
commentAvatarDrawables[a].setInfo(chat);
commentAvatarImages[a].setImage(ImageLocation.getForUserOrChat(chat, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(chat, ImageLocation.TYPE_STRIPPED), "50_50", commentAvatarDrawables[a], chat, 0);
commentAvatarImages[a].setForUserOrChat(chat, commentAvatarDrawables[a]);
} else {
commentAvatarDrawables[a].setInfo(id, "", "");
}
@ -4236,7 +4236,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
} else {
hasName = false;
}
photoImage.setImage(ImageLocation.getForUserOrChat(user, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(user, ImageLocation.TYPE_STRIPPED), "50_50", hasName ? contactAvatarDrawable : Theme.chat_contactDrawable[messageObject.isOutOwner() ? 1 : 0], messageObject, 0);
photoImage.setForUserOrChat(user, hasName ? contactAvatarDrawable : Theme.chat_contactDrawable[messageObject.isOutOwner() ? 1 : 0], messageObject);
CharSequence phone;
if (!TextUtils.isEmpty(messageObject.vCardData)) {
@ -4428,7 +4428,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
TLRPC.User user = MessagesController.getInstance(currentAccount).getUser(id);
if (user != null) {
pollAvatarDrawables[a].setInfo(user);
pollAvatarImages[a].setImage(ImageLocation.getForUserOrChat(user, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(user, ImageLocation.TYPE_STRIPPED), "50_50", pollAvatarDrawables[a], user, 0);
pollAvatarImages[a].setForUserOrChat(user, pollAvatarDrawables[a]);
} else {
pollAvatarDrawables[a].setInfo(id, "", "");
}
@ -4762,13 +4762,13 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
updateCurrentUserAndChat();
if (currentUser != null) {
contactAvatarDrawable.setInfo(currentUser);
locationImageReceiver.setImage(ImageLocation.getForUserOrChat(currentUser, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(currentUser, ImageLocation.TYPE_STRIPPED), "50_50", contactAvatarDrawable, currentUser, 0);
locationImageReceiver.setForUserOrChat(currentUser, contactAvatarDrawable);
} else if (currentChat != null) {
if (currentChat.photo != null) {
currentPhoto = currentChat.photo.photo_small;
}
contactAvatarDrawable.setInfo(currentChat);
locationImageReceiver.setImage(ImageLocation.getForUserOrChat(currentChat, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(currentChat, ImageLocation.TYPE_STRIPPED), "50_50", contactAvatarDrawable, currentChat, 0);
locationImageReceiver.setForUserOrChat(currentChat, contactAvatarDrawable);
} else {
locationImageReceiver.setImage(null, null, contactAvatarDrawable, null, null, 0);
}
@ -9198,7 +9198,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
currentPhoto = null;
}
avatarDrawable.setInfo(currentUser);
avatarImage.setImage(ImageLocation.getForUserOrChat(currentUser, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(currentUser, ImageLocation.TYPE_STRIPPED), "50_50", avatarDrawable, currentUser, 0);
avatarImage.setForUserOrChat(currentUser, avatarDrawable);
} else if (currentChat != null) {
if (currentChat.photo != null) {
currentPhoto = currentChat.photo.photo_small;
@ -9206,7 +9206,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
currentPhoto = null;
}
avatarDrawable.setInfo(currentChat);
avatarImage.setImage(ImageLocation.getForUserOrChat(currentChat, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(currentUser, ImageLocation.TYPE_STRIPPED), "50_50", avatarDrawable, currentChat, 0);
avatarImage.setForUserOrChat(currentChat, avatarDrawable);
} else {
currentPhoto = null;
avatarDrawable.setInfo(messageObject.getFromChatId(), null, null);

View file

@ -77,7 +77,7 @@ public class CheckBoxUserCell extends FrameLayout {
textView.setText(ContactsController.formatName(user.first_name, user.last_name));
checkBox.setChecked(checked, false);
avatarDrawable.setInfo(user);
imageView.setImage(ImageLocation.getForUserOrChat(user, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(user, ImageLocation.TYPE_STRIPPED), "50_50", avatarDrawable, user);
imageView.setForUserOrChat(user, avatarDrawable);
needDivider = divider;
setWillNotDraw(!divider);
}

View file

@ -2113,11 +2113,11 @@ public class DialogCell extends BaseCell {
avatarDrawable.setAvatarType(AvatarDrawable.AVATAR_TYPE_SAVED);
avatarImage.setImage(null, null, avatarDrawable, null, user, 0);
} else {
avatarImage.setImage(ImageLocation.getForUserOrChat(user, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(user, ImageLocation.TYPE_STRIPPED), "50_50", avatarDrawable, user, 0);
avatarImage.setForUserOrChat(user, avatarDrawable);
}
} else if (chat != null) {
avatarDrawable.setInfo(chat);
avatarImage.setImage(ImageLocation.getForUserOrChat(chat, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(chat, ImageLocation.TYPE_STRIPPED), "50_50", avatarDrawable, chat, 0);
avatarImage.setForUserOrChat(chat, avatarDrawable);
}
}

View file

@ -129,7 +129,7 @@ public class DialogMeUrlCell extends BaseCell {
}
nameString = chat.title;
avatarDrawable.setInfo(chat);
avatarImage.setImage(ImageLocation.getForUserOrChat(chat, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(chat, ImageLocation.TYPE_STRIPPED), "50_50", avatarDrawable, recentMeUrl, 0);
avatarImage.setForUserOrChat(chat, avatarDrawable, recentMeUrl);
} else if (recentMeUrl instanceof TLRPC.TL_recentMeUrlUser) {
TLRPC.User user = MessagesController.getInstance(currentAccount).getUser(recentMeUrl.user_id);
if (!LocaleController.isRTL) {
@ -153,7 +153,7 @@ public class DialogMeUrlCell extends BaseCell {
}
nameString = UserObject.getUserName(user);
avatarDrawable.setInfo(user);
avatarImage.setImage(ImageLocation.getForUserOrChat(user, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(user, ImageLocation.TYPE_STRIPPED), "50_50", avatarDrawable, recentMeUrl, 0);
avatarImage.setForUserOrChat(user, avatarDrawable, recentMeUrl);
} else if (recentMeUrl instanceof TLRPC.TL_recentMeUrlStickerSet) {
if (!LocaleController.isRTL) {
nameLeft = AndroidUtilities.dp(AndroidUtilities.leftBaseline);
@ -180,7 +180,7 @@ public class DialogMeUrlCell extends BaseCell {
nameLockTop = AndroidUtilities.dp(17.5f);
}
drawVerified = recentMeUrl.chat_invite.chat.verified;
avatarImage.setImage(ImageLocation.getForUserOrChat(recentMeUrl.chat_invite.chat, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(recentMeUrl.chat_invite.chat, ImageLocation.TYPE_STRIPPED), "50_50", avatarDrawable, recentMeUrl, 0);
avatarImage.setForUserOrChat(recentMeUrl.chat_invite.chat, avatarDrawable, recentMeUrl);
} else {
nameString = recentMeUrl.chat_invite.title;
avatarDrawable.setInfo(5, recentMeUrl.chat_invite.title, null);

View file

@ -351,7 +351,7 @@ public class DrawerProfileCell extends FrameLayout {
phoneTextView.setText(PhoneFormat.getInstance().format("+" + user.phone));
AvatarDrawable avatarDrawable = new AvatarDrawable(user);
avatarDrawable.setColor(Theme.getColor(Theme.key_avatar_backgroundInProfileBlue));
avatarImageView.setImage(ImageLocation.getForUserOrChat(user, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(user, ImageLocation.TYPE_STRIPPED), "50_50", avatarDrawable, user);
avatarImageView.setForUserOrChat(user, avatarDrawable);
applyBackground(true);
}

View file

@ -91,7 +91,7 @@ public class DrawerUserCell extends FrameLayout {
avatarDrawable.setInfo(user);
textView.setText(ContactsController.formatName(user.first_name, user.last_name));
imageView.getImageReceiver().setCurrentAccount(account);
imageView.setImage(ImageLocation.getForUserOrChat(user, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(user, ImageLocation.TYPE_STRIPPED), "50_50", avatarDrawable, user);
imageView.setForUserOrChat(user, avatarDrawable);
checkBox.setVisibility(account == UserConfig.selectedAccount ? VISIBLE : INVISIBLE);
}

View file

@ -91,7 +91,7 @@ public class GroupCallInvitedCell extends FrameLayout {
nameTextView.setText(lastName);
avatarImageView.getImageReceiver().setCurrentAccount(account);
avatarImageView.setImage(ImageLocation.getForUserOrChat(currentUser, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(currentUser, ImageLocation.TYPE_STRIPPED), "50_50", avatarDrawable, currentUser);
avatarImageView.setForUserOrChat(currentUser, avatarDrawable);
}
public void setDrawDivider(boolean draw) {

View file

@ -330,7 +330,7 @@ public class GroupCreateUserCell extends FrameLayout {
}
}
avatarImageView.setImage(ImageLocation.getForUserOrChat(currentUser, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(currentUser, ImageLocation.TYPE_STRIPPED), "50_50", avatarDrawable, currentUser);
avatarImageView.setForUserOrChat(currentUser, avatarDrawable);
} else {
TLRPC.Chat currentChat = (TLRPC.Chat) currentObject;
if (currentChat.photo != null) {
@ -390,7 +390,7 @@ public class GroupCreateUserCell extends FrameLayout {
}
}
avatarImageView.setImage(ImageLocation.getForUserOrChat(currentChat, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(currentChat, ImageLocation.TYPE_STRIPPED), "50_50", avatarDrawable, currentChat);
avatarImageView.setForUserOrChat(currentChat, avatarDrawable);
}
}

View file

@ -128,7 +128,7 @@ public class HintDialogCell extends FrameLayout {
nameTextView.setText("");
}
avatarDrawable.setInfo(currentUser);
imageView.setImage(ImageLocation.getForUserOrChat(currentUser, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(currentUser, ImageLocation.TYPE_STRIPPED), "50_50", avatarDrawable, currentUser);
imageView.setForUserOrChat(currentUser, avatarDrawable);
} else {
TLRPC.Chat chat = MessagesController.getInstance(currentAccount).getChat(-uid);
if (name != null) {
@ -140,7 +140,7 @@ public class HintDialogCell extends FrameLayout {
}
avatarDrawable.setInfo(chat);
currentUser = null;
imageView.setImage(ImageLocation.getForUserOrChat(chat, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(chat, ImageLocation.TYPE_STRIPPED), "50_50", avatarDrawable, chat);
imageView.setForUserOrChat(chat, avatarDrawable);
}
if (counter) {
update(0);

View file

@ -58,7 +58,7 @@ public class JoinSheetUserCell extends FrameLayout {
public void setUser(TLRPC.User user) {
nameTextView.setText(ContactsController.formatName(user.first_name, user.last_name));
avatarDrawable.setInfo(user);
imageView.setImage(ImageLocation.getForUserOrChat(user, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(user, ImageLocation.TYPE_STRIPPED), "50_50", avatarDrawable, user);
imageView.setForUserOrChat(user, avatarDrawable);
}
public void setCount(int count) {

View file

@ -260,7 +260,7 @@ public class ManageChatUserCell extends FrameLayout {
}
}
lastAvatar = photo;
avatarImageView.setImage(ImageLocation.getForUserOrChat(currentUser, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(currentUser, ImageLocation.TYPE_STRIPPED), "50_50", avatarDrawable, currentUser);
avatarImageView.setForUserOrChat(currentUser, avatarDrawable);
} else if (currentObject instanceof TLRPC.Chat) {
TLRPC.Chat currentChat = (TLRPC.Chat) currentObject;
@ -317,7 +317,7 @@ public class ManageChatUserCell extends FrameLayout {
}
}
lastAvatar = photo;
avatarImageView.setImage(ImageLocation.getForUserOrChat(currentChat, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(currentChat, ImageLocation.TYPE_STRIPPED), "50_50", avatarDrawable, currentChat);
avatarImageView.setForUserOrChat(currentChat, avatarDrawable);
} else if (currentObject instanceof Integer) {
nameTextView.setText(currentName);
statusTextView.setTextColor(statusColor);

View file

@ -76,7 +76,7 @@ public class MentionCell extends LinearLayout {
}
avatarDrawable.setInfo(user);
if (user.photo != null && user.photo.photo_small != null) {
imageView.setImage(ImageLocation.getForUserOrChat(user, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(user, ImageLocation.TYPE_STRIPPED), "50_50", avatarDrawable, user);
imageView.setForUserOrChat(user, avatarDrawable);
} else {
imageView.setImageDrawable(avatarDrawable);
}
@ -99,7 +99,7 @@ public class MentionCell extends LinearLayout {
}
avatarDrawable.setInfo(chat);
if (chat.photo != null && chat.photo.photo_small != null) {
imageView.setImage(ImageLocation.getForUserOrChat(chat, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(chat, ImageLocation.TYPE_STRIPPED), "50_50", avatarDrawable, chat);
imageView.setForUserOrChat(chat, avatarDrawable);
} else {
imageView.setImageDrawable(avatarDrawable);
}
@ -140,7 +140,7 @@ public class MentionCell extends LinearLayout {
imageView.setVisibility(VISIBLE);
avatarDrawable.setInfo(user);
if (user.photo != null && user.photo.photo_small != null) {
imageView.setImage(ImageLocation.getForUserOrChat(user, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(user, ImageLocation.TYPE_STRIPPED), "50_50", avatarDrawable, user);
imageView.setForUserOrChat(user, avatarDrawable);
} else {
imageView.setImageDrawable(avatarDrawable);
}

View file

@ -501,14 +501,14 @@ public class ProfileSearchCell extends BaseCell {
if (user.photo != null) {
photo = user.photo.photo_small;
}
avatarImage.setImage(ImageLocation.getForUserOrChat(user, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(user, ImageLocation.TYPE_STRIPPED), "50_50", avatarDrawable, user, 0);
avatarImage.setForUserOrChat(user, avatarDrawable);
}
} else if (chat != null) {
if (chat.photo != null) {
photo = chat.photo.photo_small;
}
avatarDrawable.setInfo(chat);
avatarImage.setImage(ImageLocation.getForUserOrChat(chat, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(chat, ImageLocation.TYPE_STRIPPED), "50_50", avatarDrawable, chat, 0);
avatarImage.setForUserOrChat(chat, avatarDrawable);
} else {
avatarDrawable.setInfo(0, null, null);
avatarImage.setImage(null, null, avatarDrawable, null, null, 0);

View file

@ -183,7 +183,7 @@ public class SessionCell extends FrameLayout {
if (user != null) {
avatarDrawable.setInfo(user);
name = UserObject.getFirstName(user);
imageView.setImage(ImageLocation.getForUserOrChat(user, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(user, ImageLocation.TYPE_STRIPPED), "50_50", avatarDrawable, user);
imageView.setForUserOrChat(user, avatarDrawable);
} else {
name = "";
}

View file

@ -114,7 +114,7 @@ public class ShareDialogCell extends FrameLayout {
} else {
nameTextView.setText("");
}
imageView.setImage(ImageLocation.getForUserOrChat(user, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(user, ImageLocation.TYPE_STRIPPED), "50_50", avatarDrawable, user);
imageView.setForUserOrChat(user, avatarDrawable);
}
} else {
user = null;
@ -127,7 +127,7 @@ public class ShareDialogCell extends FrameLayout {
nameTextView.setText("");
}
avatarDrawable.setInfo(chat);
imageView.setImage(ImageLocation.getForUserOrChat(chat, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(chat, ImageLocation.TYPE_STRIPPED), "50_50", avatarDrawable, chat);
imageView.setForUserOrChat(chat, avatarDrawable);
}
currentDialog = uid;
checkBox.setChecked(checked, false);
@ -192,6 +192,6 @@ public class ShareDialogCell extends FrameLayout {
int cy = imageView.getTop() + imageView.getMeasuredHeight() / 2;
Theme.checkboxSquare_checkPaint.setColor(Theme.getColor(Theme.key_dialogRoundCheckBox));
Theme.checkboxSquare_checkPaint.setAlpha((int) (checkBox.getProgress() * 255));
canvas.drawCircle(cx, cy, AndroidUtilities.dp(24), Theme.checkboxSquare_checkPaint);
canvas.drawCircle(cx, cy, AndroidUtilities.dp(currentType == TYPE_CREATE ? 24 : 28), Theme.checkboxSquare_checkPaint);
}
}

View file

@ -124,14 +124,14 @@ public class SharingLiveLocationCell extends FrameLayout {
if (user != null) {
avatarDrawable = new AvatarDrawable(user);
name = UserObject.getUserName(user);
avatarImageView.setImage(ImageLocation.getForUserOrChat(user, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(user, ImageLocation.TYPE_STRIPPED), "50_50", avatarDrawable, user);
avatarImageView.setForUserOrChat(user, avatarDrawable);
}
} else {
TLRPC.Chat chat = MessagesController.getInstance(currentAccount).getChat(-lowerId);
if (chat != null) {
avatarDrawable = new AvatarDrawable(chat);
name = chat.title;
avatarImageView.setImage(ImageLocation.getForUserOrChat(chat, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(chat, ImageLocation.TYPE_STRIPPED), "50_50", avatarDrawable, chat);
avatarImageView.setForUserOrChat(chat, avatarDrawable);
}
}
nameTextView.setText(name);
@ -177,14 +177,14 @@ public class SharingLiveLocationCell extends FrameLayout {
if (user != null) {
avatarDrawable = new AvatarDrawable(user);
name = UserObject.getUserName(user);
avatarImageView.setImage(ImageLocation.getForUserOrChat(user, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(user, ImageLocation.TYPE_STRIPPED), "50_50", avatarDrawable, user);
avatarImageView.setForUserOrChat(user, avatarDrawable);
}
} else {
TLRPC.Chat chat = MessagesController.getInstance(currentAccount).getChat(-fromId);
if (chat != null) {
avatarDrawable = new AvatarDrawable(chat);
name = chat.title;
avatarImageView.setImage(ImageLocation.getForUserOrChat(chat, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(chat, ImageLocation.TYPE_STRIPPED), "50_50", avatarDrawable, chat);
avatarImageView.setForUserOrChat(chat, avatarDrawable);
}
}
}
@ -216,14 +216,14 @@ public class SharingLiveLocationCell extends FrameLayout {
if (user != null) {
avatarDrawable.setInfo(user);
nameTextView.setText(ContactsController.formatName(user.first_name, user.last_name));
avatarImageView.setImage(ImageLocation.getForUserOrChat(user, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(user, ImageLocation.TYPE_STRIPPED), "50_50", avatarDrawable, user);
avatarImageView.setForUserOrChat(user, avatarDrawable);
}
} else {
TLRPC.Chat chat = MessagesController.getInstance(currentAccount).getChat(-lower_id);
if (chat != null) {
avatarDrawable.setInfo(chat);
nameTextView.setText(chat.title);
avatarImageView.setImage(ImageLocation.getForUserOrChat(chat, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(chat, ImageLocation.TYPE_STRIPPED), "50_50", avatarDrawable, chat);
avatarImageView.setForUserOrChat(chat, avatarDrawable);
}
}
@ -249,14 +249,14 @@ public class SharingLiveLocationCell extends FrameLayout {
if (user != null) {
avatarDrawable.setInfo(user);
nameTextView.setText(ContactsController.formatName(user.first_name, user.last_name));
avatarImageView.setImage(ImageLocation.getForUserOrChat(user, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(user, ImageLocation.TYPE_STRIPPED), "50_50", avatarDrawable, user);
avatarImageView.setForUserOrChat(user, avatarDrawable);
}
} else {
TLRPC.Chat chat = MessagesController.getInstance(currentAccount).getChat(-lower_id);
if (chat != null) {
avatarDrawable.setInfo(chat);
nameTextView.setText(chat.title);
avatarImageView.setImage(ImageLocation.getForUserOrChat(chat, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(chat, ImageLocation.TYPE_STRIPPED), "50_50", avatarDrawable, chat);
avatarImageView.setForUserOrChat(chat, avatarDrawable);
}
}
}

View file

@ -113,7 +113,7 @@ public class StatisticPostInfoCell extends FrameLayout {
public void setData(StatisticActivity.MemberData memberData) {
avatarDrawable.setInfo(memberData.user);
imageView.setImage(ImageLocation.getForUserOrChat(memberData.user, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(memberData.user, ImageLocation.TYPE_STRIPPED), "50_50", avatarDrawable, memberData.user);
imageView.setForUserOrChat(memberData.user, avatarDrawable);
imageView.setRoundRadius(AndroidUtilities.dp(46) >> 1);
message.setText(memberData.user.first_name);
date.setText(memberData.description);

View file

@ -493,9 +493,9 @@ public class UserCell extends FrameLayout {
lastAvatar = photo;
if (currentUser != null) {
avatarImageView.setImage(ImageLocation.getForUserOrChat(currentUser, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(currentUser, ImageLocation.TYPE_STRIPPED), "50_50", avatarDrawable, currentUser);
avatarImageView.setForUserOrChat(currentUser, avatarDrawable);
} else if (currentChat != null) {
avatarImageView.setImage(ImageLocation.getForUserOrChat(currentChat, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(currentChat, ImageLocation.TYPE_STRIPPED), "50_50", avatarDrawable, currentChat);
avatarImageView.setForUserOrChat(currentChat, avatarDrawable);
} else {
avatarImageView.setImageDrawable(avatarDrawable);
}

View file

@ -260,7 +260,7 @@ public class UserCell2 extends FrameLayout {
statusTextView.setText(LocaleController.formatUserStatus(currentAccount, currentUser));
}
}
avatarImageView.setImage(ImageLocation.getForUserOrChat(currentUser, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(currentUser, ImageLocation.TYPE_STRIPPED), "50_50", avatarDrawable, currentUser);
avatarImageView.setForUserOrChat(currentUser, avatarDrawable);
} else if (currentChat != null) {
statusTextView.setTextColor(statusColor);
if (ChatObject.isChannel(currentChat) && !currentChat.megagroup) {
@ -282,7 +282,7 @@ public class UserCell2 extends FrameLayout {
statusTextView.setText(LocaleController.getString("MegaPublic", R.string.MegaPublic));
}
}
avatarImageView.setImage(ImageLocation.getForUserOrChat(currentChat, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(currentChat, ImageLocation.TYPE_STRIPPED), "50_50", avatarDrawable, currentObject);
avatarImageView.setForUserOrChat(currentChat, avatarDrawable);
} else {
avatarImageView.setImageDrawable(avatarDrawable);
}

View file

@ -1832,9 +1832,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
if (revoke && currentUser != null) {
getMessagesStorage().getMessagesCount(currentUser.id, (count) -> {
if (count >= 50) {
AlertsCreator.createClearOrDeleteDialogAlert(ChatActivity.this, true, false, true, null, currentUser, false, false, (param) -> {
performHistoryClear(true);
});
AlertsCreator.createClearOrDeleteDialogAlert(ChatActivity.this, true, false, true, null, currentUser, false, false, (param) -> performHistoryClear(true));
} else {
performHistoryClear(true);
}
@ -5790,6 +5788,12 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
public void didPressUrl(CharacterStyle span) {
didPressMessageUrl(span, false, null, null);
}
@Override
public void showWithAction(long did, int action, Object infoObject, Object infoObject2, Runnable actionRunnable, Runnable cancelRunnable) {
setAdditionalTranslationY(fragmentContextView != null && fragmentContextView.isCallTypeVisible() ? AndroidUtilities.dp(fragmentContextView.getStyleHeight()) : 0);
super.showWithAction(did, action, infoObject, infoObject2, actionRunnable, cancelRunnable);
}
};
contentView.addView(topUndoView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.TOP | Gravity.LEFT, 8, 8, 8, 0));

View file

@ -938,7 +938,7 @@ public class ChatEditActivity extends BaseFragment implements ImageUpdater.Image
if (currentChat.photo != null) {
avatar = currentChat.photo.photo_small;
ImageLocation location = ImageLocation.getForUserOrChat(currentChat, ImageLocation.TYPE_SMALL);
avatarImage.setImage(location, "50_50", ImageLocation.getForUserOrChat(currentChat, ImageLocation.TYPE_STRIPPED), "50_50", avatarDrawable, currentChat);
avatarImage.setForUserOrChat(currentChat, avatarDrawable);
hasPhoto = location != null;
} else {
avatarImage.setImageDrawable(avatarDrawable);

View file

@ -499,7 +499,7 @@ public class ChatLinkActivity extends BaseFragment implements NotificationCenter
frameLayout2.addView(textView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, (LocaleController.isRTL ? 21 : 76), 11, (LocaleController.isRTL ? 76 : 21), 0));
frameLayout2.addView(messageTextView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, 24, 57, 24, 9));
avatarDrawable.setInfo(chat);
imageView.setImage(ImageLocation.getForUserOrChat(chat, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(chat, ImageLocation.TYPE_STRIPPED), "50_50", avatarDrawable, chat);
imageView.setForUserOrChat(chat, avatarDrawable);
builder.setPositiveButton(LocaleController.getString("DiscussionLinkGroup", R.string.DiscussionLinkGroup), (dialogInterface, i) -> {
if (chatFull.hidden_prehistory) {
MessagesController.getInstance(currentAccount).toogleChannelInvitesHistory(chat.id, false);

View file

@ -1762,7 +1762,7 @@ public class ChatUsersActivity extends BaseFragment implements NotificationCente
return true;
}
if (!isChannel) {
if (ChatObject.isChannel(currentChat)) {
if (ChatObject.isChannel(currentChat) && !currentChat.gigagroup) {
items.add(LocaleController.getString("ChangePermissions", R.string.ChangePermissions));
icons.add(R.drawable.actions_permissions);
actions.add(1);

View file

@ -1161,11 +1161,11 @@ public class AlertsCreator {
} else {
avatarDrawable.setSmallSize(false);
avatarDrawable.setInfo(user);
imageView.setImage(ImageLocation.getForUserOrChat(user, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(user, ImageLocation.TYPE_STRIPPED), "50_50", avatarDrawable, user);
imageView.setForUserOrChat(user, avatarDrawable);
}
} else {
avatarDrawable.setInfo(chat);
imageView.setImage(ImageLocation.getForUserOrChat(chat, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(chat, ImageLocation.TYPE_STRIPPED), "50_50", avatarDrawable, chat);
imageView.setForUserOrChat(chat, avatarDrawable);
}
messageTextView.setText(AndroidUtilities.replaceTags(message));
@ -1329,11 +1329,11 @@ public class AlertsCreator {
} else {
avatarDrawable.setSmallSize(false);
avatarDrawable.setInfo(user);
imageView.setImage(ImageLocation.getForUserOrChat(user, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(user, ImageLocation.TYPE_STRIPPED), "50_50", avatarDrawable, user);
imageView.setForUserOrChat(user, avatarDrawable);
}
} else {
avatarDrawable.setInfo(chat);
imageView.setImage(ImageLocation.getForUserOrChat(chat, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(chat, ImageLocation.TYPE_STRIPPED), "50_50", avatarDrawable, chat);
imageView.setForUserOrChat(chat, avatarDrawable);
}
if (second) {
@ -1499,7 +1499,7 @@ public class AlertsCreator {
BackupImageView imageView = new BackupImageView(context);
imageView.setRoundRadius(AndroidUtilities.dp(20));
imageView.setImage(ImageLocation.getForUserOrChat(user, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(user, ImageLocation.TYPE_STRIPPED), "50_50", avatarDrawable, user);
imageView.setForUserOrChat(user, avatarDrawable);
frameLayout.addView(imageView, LayoutHelper.createFrame(40, 40, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, 22, 5, 22, 0));
TextView textView = new TextView(context);
@ -2032,9 +2032,9 @@ public class AlertsCreator {
t = LocaleController.formatPluralString("SecondsSchedule", diff);
}
if (infoText.getTag() != null) {
infoText.setText(LocaleController.formatString("VoipGroupScheduleInfo", R.string.VoipGroupScheduleInfo, t));
} else {
infoText.setText(LocaleController.formatString("VoipChannelScheduleInfo", R.string.VoipChannelScheduleInfo, t));
} else {
infoText.setText(LocaleController.formatString("VoipGroupScheduleInfo", R.string.VoipGroupScheduleInfo, t));
}
}
return currentTime - systemTime > 60000L;
@ -3361,7 +3361,7 @@ public class AlertsCreator {
BackupImageView imageView = new BackupImageView(activity);
imageView.setRoundRadius(AndroidUtilities.dp(26));
imageView.setImage(ImageLocation.getForUserOrChat(selfUser, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(selfUser, ImageLocation.TYPE_STRIPPED), "50_50", (Drawable) null, selfUser);
imageView.setForUserOrChat(selfUser, new AvatarDrawable(selfUser));
frameLayout.addView(imageView, LayoutHelper.createFrame(52, 52, Gravity.CENTER, 0, 0, 0, 11));
builder.setTopView(frameLayout);

View file

@ -17,7 +17,6 @@ import androidx.core.graphics.ColorUtils;
import org.telegram.messenger.AccountInstance;
import org.telegram.messenger.AndroidUtilities;
import org.telegram.messenger.ImageLocation;
import org.telegram.messenger.ImageReceiver;
import org.telegram.messenger.MessageObject;
import org.telegram.messenger.MessagesController;
@ -234,9 +233,9 @@ public class AvatarsImageView extends FrameLayout {
animatingStates[index].id = -currentChat.id;
}
if (currentUser != null) {
animatingStates[index].imageReceiver.setImage(ImageLocation.getForUserOrChat(currentUser, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(currentUser, ImageLocation.TYPE_STRIPPED), "50_50", animatingStates[index].avatarDrawable, currentUser, 0);
animatingStates[index].imageReceiver.setForUserOrChat(currentUser, animatingStates[index].avatarDrawable);
} else {
animatingStates[index].imageReceiver.setImage(ImageLocation.getForUserOrChat(currentChat, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(currentChat, ImageLocation.TYPE_STRIPPED), "50_50", animatingStates[index].avatarDrawable, currentChat, 0);
animatingStates[index].imageReceiver.setForUserOrChat(currentChat, animatingStates[index].avatarDrawable);
}
animatingStates[index].imageReceiver.setRoundRadius(AndroidUtilities.dp(currentStyle == 4 ? 16 : 12));
int size = AndroidUtilities.dp(currentStyle == 4 ? 32 : 24);

View file

@ -20,6 +20,7 @@ import android.view.View;
import org.telegram.messenger.ImageLocation;
import org.telegram.messenger.ImageReceiver;
import org.telegram.messenger.SecureDocument;
import org.telegram.tgnet.TLObject;
public class BackupImageView extends View {
@ -68,6 +69,14 @@ public class BackupImageView extends View {
imageReceiver.setImage(imageLocation, imageFilter, null, null, thumb, size, null, parentObject, cacheType);
}
public void setForUserOrChat(TLObject object, AvatarDrawable avatarDrawable) {
imageReceiver.setForUserOrChat(object, avatarDrawable);
}
public void setForUserOrChat(TLObject object, AvatarDrawable avatarDrawable, Object parent) {
imageReceiver.setForUserOrChat(object, avatarDrawable, parent);
}
public void setImageMedia(ImageLocation mediaLocation, String mediaFilter, ImageLocation imageLocation, String imageFilter, Bitmap thumbBitmap, int size, int cacheType, Object parentObject) {
Drawable thumb = null;
if (thumbBitmap != null) {

View file

@ -553,7 +553,7 @@ public class ChatAttachAlert extends BottomSheet implements NotificationCenter.N
currentUser = user;
nameTextView.setText(ContactsController.formatName(user.first_name, user.last_name));
avatarDrawable.setInfo(user);
imageView.setImage(ImageLocation.getForUserOrChat(user, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(user, ImageLocation.TYPE_STRIPPED), "50_50", avatarDrawable, user);
imageView.setForUserOrChat(user, avatarDrawable);
requestLayout();
}
}

View file

@ -208,7 +208,7 @@ public class ChatAttachAlertContactsLayout extends ChatAttachAlert.AttachAlertLa
lastAvatar = photo;
if (currentUser != null) {
avatarImageView.setImage(ImageLocation.getForUserOrChat(currentUser, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(currentUser, ImageLocation.TYPE_STRIPPED), "50_50", avatarDrawable, currentUser);
avatarImageView.setForUserOrChat(currentUser, avatarDrawable);
} else {
avatarImageView.setImageDrawable(avatarDrawable);
}

View file

@ -589,7 +589,7 @@ public class ChatAvatarContainer extends FrameLayout implements NotificationCent
public void setChatAvatar(TLRPC.Chat chat) {
avatarDrawable.setInfo(chat);
if (avatarImageView != null) {
avatarImageView.setImage(ImageLocation.getForUserOrChat(chat, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(chat, ImageLocation.TYPE_STRIPPED), "50_50", avatarDrawable, chat);
avatarImageView.setForUserOrChat(chat, avatarDrawable);
}
}
@ -615,7 +615,7 @@ public class ChatAvatarContainer extends FrameLayout implements NotificationCent
} else {
avatarDrawable.setSmallSize(false);
if (avatarImageView != null) {
avatarImageView.setImage(ImageLocation.getForUserOrChat(user, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(user, ImageLocation.TYPE_STRIPPED), "50_50", avatarDrawable, user);
avatarImageView.setForUserOrChat(user, avatarDrawable);
}
}
}
@ -643,13 +643,13 @@ public class ChatAvatarContainer extends FrameLayout implements NotificationCent
} else {
avatarDrawable.setSmallSize(false);
if (avatarImageView != null) {
avatarImageView.setImage(ImageLocation.getForUserOrChat(user, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(user, ImageLocation.TYPE_STRIPPED), "50_50", avatarDrawable, user);
avatarImageView.setForUserOrChat(user, avatarDrawable);
}
}
} else if (chat != null) {
avatarDrawable.setInfo(chat);
if (avatarImageView != null) {
avatarImageView.setImage(ImageLocation.getForUserOrChat(chat, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(chat, ImageLocation.TYPE_STRIPPED), "50_50", avatarDrawable, chat);
avatarImageView.setForUserOrChat(chat, avatarDrawable);
}
}
}

View file

@ -51,7 +51,9 @@ public class ContactsEmptyView extends LinearLayout implements NotificationCente
stickerView = new BackupImageView(context);
drawable = new LoadingStickerDrawable(stickerView, svg, AndroidUtilities.dp(130), AndroidUtilities.dp(130));
stickerView.setImageDrawable(drawable);
if (!AndroidUtilities.isTablet()) {
addView(stickerView, LayoutHelper.createLinear(130, 130, Gravity.CENTER_HORIZONTAL | Gravity.TOP, 0, 2, 0, 0));
}
titleTextView = new TextView(context);
titleTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 20);

View file

@ -1101,6 +1101,10 @@ public class FragmentContextView extends FrameLayout implements NotificationCent
return currentStyle == 4 ? 48 : 36;
}
public boolean isCallTypeVisible() {
return (currentStyle == 1 || currentStyle == 3) && visible;
}
private void checkLiveLocation(boolean create) {
View fragmentView = fragment.getFragmentView();
if (!create && fragmentView != null) {
@ -1765,7 +1769,7 @@ public class FragmentContextView extends FrameLayout implements NotificationCent
} else {
titleTextView.setText(LocaleController.getString("VoipGroupScheduledVoiceChat", R.string.VoipGroupScheduledVoiceChat), false);
}
subtitleTextView.setText(LocaleController.formatStartsTime(call.call.schedule_date, 2), false);
subtitleTextView.setText(LocaleController.formatStartsTime(call.call.schedule_date, 4), false);
if (!scheduleRunnableScheduled) {
scheduleRunnableScheduled = true;
updateScheduleTimeRunnable.run();

View file

@ -80,7 +80,7 @@ public class JoinCallByUrlAlert extends BottomSheet {
linearLayout.addView(avatarImageView, LayoutHelper.createLinear(90, 90, Gravity.TOP | Gravity.CENTER_HORIZONTAL, 0, 29, 0, 0));
AvatarDrawable avatarDrawable = new AvatarDrawable(chat);
avatarImageView.setImage(ImageLocation.getForUserOrChat(chat, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(chat, ImageLocation.TYPE_STRIPPED), "50_50", avatarDrawable, chat);
avatarImageView.setForUserOrChat(chat, avatarDrawable);
TextView percentTextView = new TextView(context);
percentTextView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));

View file

@ -68,7 +68,7 @@ public class JoinGroupAlert extends BottomSheet {
avatarDrawable = new AvatarDrawable(invite.chat);
title = invite.chat.title;
participants_count = invite.chat.participants_count;
avatarImageView.setImage(ImageLocation.getForUserOrChat(invite.chat, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(invite.chat, ImageLocation.TYPE_STRIPPED), "50_50", avatarDrawable, invite);
avatarImageView.setForUserOrChat(invite.chat, avatarDrawable, invite);
} else {
avatarDrawable = new AvatarDrawable();
avatarDrawable.setInfo(0, invite.title, null);

View file

@ -117,7 +117,7 @@ public class PhonebookShareAlert extends BottomSheet {
BackupImageView avatarImageView = new BackupImageView(context);
avatarImageView.setRoundRadius(AndroidUtilities.dp(40));
avatarImageView.setImage(ImageLocation.getForUserOrChat(currentUser, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(currentUser, ImageLocation.TYPE_STRIPPED), "50_50", avatarDrawable, currentUser);
avatarImageView.setForUserOrChat(currentUser, avatarDrawable);
addView(avatarImageView, LayoutHelper.createLinear(80, 80, Gravity.TOP | Gravity.CENTER_HORIZONTAL, 0, 32, 0, 0));
TextView textView = new TextView(context);

View file

@ -375,7 +375,7 @@ public class PollVotesAlert extends BottomSheet {
lastAvatar = photo;
if (currentUser != null) {
avatarImageView.setImage(ImageLocation.getForUserOrChat(currentUser, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(currentUser, ImageLocation.TYPE_STRIPPED), "50_50", avatarDrawable, currentUser);
avatarImageView.setForUserOrChat(currentUser, avatarDrawable);
} else {
avatarImageView.setImageDrawable(avatarDrawable);
}

View file

@ -134,16 +134,24 @@ public class RecyclerItemsEnterAnimator {
}
public void onDetached() {
for (int i = 0; i < currentAnimations.size(); i++) {
currentAnimations.get(i).cancel();
cancel();
}
public void cancel() {
if (!currentAnimations.isEmpty()) {
ArrayList<AnimatorSet> animations = new ArrayList<>(currentAnimations);
for (int i = 0; i < animations.size(); i++) {
animations.get(i).end();
animations.get(i).cancel();
}
}
currentAnimations.clear();
for (int i = 0; i < preDrawListeners.size(); i++) {
listView.getViewTreeObserver().removeOnPreDrawListener(preDrawListeners.get(i));
}
preDrawListeners.clear();
listAlphaItems.clear();
listView.invalidate();
invalidateAlpha = true;
}
}

View file

@ -284,7 +284,7 @@ public class ScrollSlidingTabStrip extends HorizontalScrollView {
BackupImageView imageView = new BackupImageView(getContext());
imageView.setLayerNum(1);
imageView.setRoundRadius(AndroidUtilities.dp(15));
imageView.setImage(ImageLocation.getForUserOrChat(chat, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(chat, ImageLocation.TYPE_STRIPPED), "50_50", avatarDrawable, chat);
imageView.setForUserOrChat(chat, avatarDrawable);
imageView.setAspectFit(true);
tab.addView(imageView, LayoutHelper.createFrame(30, 30, Gravity.CENTER));
}

View file

@ -55,6 +55,8 @@ public class SearchViewPager extends ViewPagerFixed implements FilteredSearchVie
public StickerEmptyView emptyView;
public DialogsSearchAdapter dialogsSearchAdapter;
private LinearLayoutManager searchlayoutManager;
private RecyclerItemsEnterAnimator itemsEnterAnimator;
private boolean attached;
private NumberTextView selectedMessagesCountTextView;
private boolean isActionModeShowed;
@ -85,8 +87,7 @@ public class SearchViewPager extends ViewPagerFixed implements FilteredSearchVie
ChatPreviewDelegate chatPreviewDelegate;
private final int folderId;
ArrayList<SearchResultsEnterAnimator> currentAnimators = new ArrayList<>();
int animateFromCount = 0;
public SearchViewPager(Context context, BaseFragment fragment, int type, int initialDialogsType, int folderId, ChatPreviewDelegate chatPreviewDelegate) {
super(context);
@ -111,23 +112,15 @@ public class SearchViewPager extends ViewPagerFixed implements FilteredSearchVie
searchListView = new RecyclerListView(context) {
@Override
protected void dispatchDraw(Canvas canvas) {
int n = getChildCount();
loop: for (int i = 0; i < n; i++) {
View v = getChildAt(i);
ViewHolder holder = searchListView.getChildViewHolder(v);
if (holder == null || holder.shouldIgnore()) {
continue;
}
int position = searchlayoutManager.getPosition(v);
for (int k = 0; k < currentAnimators.size(); k++) {
if (currentAnimators.get(k).setup(v, position)) {
continue loop;
}
}
v.setAlpha(1f);
}
itemsEnterAnimator.dispatchDraw();
super.dispatchDraw(canvas);
}
@Override
protected void onDetachedFromWindow() {
super.onDetachedFromWindow();
itemsEnterAnimator.onDetached();
}
};
searchListView.setPivotY(0);
searchListView.setAdapter(dialogsSearchAdapter);
@ -185,6 +178,8 @@ public class SearchViewPager extends ViewPagerFixed implements FilteredSearchVie
searchContainer.addView(emptyView);
searchListView.setEmptyView(emptyView);
itemsEnterAnimator = new RecyclerItemsEnterAnimator(searchListView);
setAdapter(new ViewPagerFixed.Adapter() {
@Override
@ -688,109 +683,15 @@ public class SearchViewPager extends ViewPagerFixed implements FilteredSearchVie
}
public void runResultsEnterAnimation() {
Set<Integer> hasSet = new HashSet<>();
int n = searchListView.getChildCount();
View progressView = null;
for (int i = 0; i < n; i++) {
View child = searchListView.getChildAt(i);
int childPosition = searchlayoutManager.getPosition(child);
if (child instanceof FlickerLoadingView) {
progressView = child;
} else {
hasSet.add(childPosition);
}
}
final View finalProgressView = progressView;
if (progressView != null) {
searchListView.removeView(progressView);
itemsEnterAnimator.showItemsAnimated(animateFromCount);
animateFromCount = dialogsSearchAdapter.getItemCount();
}
searchListView.getViewTreeObserver().addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() {
@Override
public boolean onPreDraw() {
searchListView.getViewTreeObserver().removeOnPreDrawListener(this);
int n = searchListView.getChildCount();
for (int i = 0; i < n; i++) {
View child = searchListView.getChildAt(i);
int position = searchlayoutManager.getPosition(child);
if (!hasSet.contains(position)) {
SearchResultsEnterAnimator animator = new SearchResultsEnterAnimator();
child.setAlpha(0);
int s = Math.min(searchListView.getMeasuredHeight(), Math.max(0, child.getTop()));
int delay = (int) ((s / (float) searchListView.getMeasuredHeight()) * 100);
animator.position = position;
animator.valueAnimator.setStartDelay(delay);
animator.valueAnimator.setDuration(200);
animator.valueAnimator.start();
}
}
if (finalProgressView != null && finalProgressView.getParent() == null) {
searchListView.addView(finalProgressView);
RecyclerView.LayoutManager layoutManager = searchListView.getLayoutManager();
if (layoutManager != null) {
layoutManager.ignoreView(finalProgressView);
Animator animator = ObjectAnimator.ofFloat(finalProgressView, ALPHA, finalProgressView.getAlpha(), 0);
animator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
finalProgressView.setAlpha(1f);
layoutManager.stopIgnoringView(finalProgressView);
searchListView.removeView(finalProgressView);
}
});
animator.start();
}
}
return true;
}
});
}
public void cancelEnterAnimation() {
for (int i = 0; i < currentAnimators.size(); i++) {
SearchResultsEnterAnimator animator = currentAnimators.get(i);
animator.valueAnimator.cancel();
currentAnimators.remove(animator);
i--;
}
}
public TabsView getTabsView() {
return tabsView;
}
private class SearchResultsEnterAnimator {
final ValueAnimator valueAnimator;
float progress;
int position;
private SearchResultsEnterAnimator() {
valueAnimator = ValueAnimator.ofFloat(0, 1f);
valueAnimator.addUpdateListener(valueAnimator -> {
progress = (float) valueAnimator.getAnimatedValue();
searchListView.invalidate();
});
valueAnimator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
currentAnimators.remove(SearchResultsEnterAnimator.this);
}
});
currentAnimators.add(this);
}
public boolean setup(View view, int position) {
if (this.position == position) {
view.setAlpha(progress);
return true;
}
return false;
}
}
boolean attached;
@Override
protected void onAttachedToWindow() {
super.onAttachedToWindow();
@ -803,6 +704,12 @@ public class SearchViewPager extends ViewPagerFixed implements FilteredSearchVie
attached = false;
}
public void cancelEnterAnimation() {
itemsEnterAnimator.cancel();
searchListView.invalidate();
animateFromCount = 0;
}
public interface ChatPreviewDelegate {
void startChatPreview(DialogCell cell);
void move(float dy);

View file

@ -864,7 +864,7 @@ public class ShareAlert extends BottomSheet implements NotificationCenter.Notifi
gridView = new RecyclerListView(context) {
@Override
protected boolean allowSelectChildAtPosition(float x, float y) {
return y >= scrollOffsetY + AndroidUtilities.dp(48) + (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);
}
@Override

View file

@ -38,7 +38,6 @@ import org.telegram.messenger.ChatObject;
import org.telegram.messenger.ContactsController;
import org.telegram.messenger.Emoji;
import org.telegram.messenger.FileLog;
import org.telegram.messenger.ImageLocation;
import org.telegram.messenger.LocaleController;
import org.telegram.messenger.MessagesController;
import org.telegram.messenger.R;
@ -449,7 +448,7 @@ public class UndoView extends FrameLayout {
AvatarDrawable avatarDrawable = new AvatarDrawable();
avatarDrawable.setTextSize(AndroidUtilities.dp(12));
avatarDrawable.setInfo(user);
avatarImageView.setImage(ImageLocation.getForUserOrChat(user, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(user, ImageLocation.TYPE_STRIPPED), "50_50", avatarDrawable, user);
avatarImageView.setForUserOrChat(user, avatarDrawable);
avatarImageView.setVisibility(VISIBLE);
timeLeft = 3000;
} else if (action == ACTION_VOIP_USER_CHANGED) {
@ -459,12 +458,12 @@ public class UndoView extends FrameLayout {
if (infoObject instanceof TLRPC.User) {
TLRPC.User user = (TLRPC.User) infoObject;
avatarDrawable.setInfo(user);
avatarImageView.setImage(ImageLocation.getForUserOrChat(user, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(user, ImageLocation.TYPE_STRIPPED), "50_50", avatarDrawable, user);
avatarImageView.setForUserOrChat(user, avatarDrawable);
name = ContactsController.formatName(user.first_name, user.last_name);
} else {
TLRPC.Chat chat = (TLRPC.Chat) infoObject;
avatarDrawable.setInfo(chat);
avatarImageView.setImage(ImageLocation.getForUserOrChat(chat, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(chat, ImageLocation.TYPE_STRIPPED), "50_50", avatarDrawable, chat);
avatarImageView.setForUserOrChat(chat, avatarDrawable);
name = chat.title;
}
infoText = AndroidUtilities.replaceTags(LocaleController.formatString("VoipGroupUserChanged", R.string.VoipGroupUserChanged, name));
@ -700,9 +699,9 @@ public class UndoView extends FrameLayout {
}
} else {
if (action == ACTION_ADDED_TO_FOLDER) {
infoText = AndroidUtilities.replaceTags(LocaleController.formatString("FilterChatsAddedToExisting", R.string.FilterChatsAddedToExisting, LocaleController.formatPluralString("Chats", (Integer) infoObject), filter.name));
infoText = AndroidUtilities.replaceTags(LocaleController.formatString("FilterChatsAddedToExisting", R.string.FilterChatsAddedToExisting, LocaleController.formatPluralString("ChatsSelected", (Integer) infoObject), filter.name));
} else {
infoText = AndroidUtilities.replaceTags(LocaleController.formatString("FilterChatsRemovedFrom", R.string.FilterChatsRemovedFrom, LocaleController.formatPluralString("Chats", (Integer) infoObject), filter.name));
infoText = AndroidUtilities.replaceTags(LocaleController.formatString("FilterChatsRemovedFrom", R.string.FilterChatsRemovedFrom, LocaleController.formatPluralString("ChatsSelected", (Integer) infoObject), filter.name));
}
}
subInfoText = null;

View file

@ -118,7 +118,7 @@ public class UsersAlertBase extends BottomSheet {
listView = new RecyclerListView(context) {
@Override
protected boolean allowSelectChildAtPosition(float x, float y) {
return y >= scrollOffsetY + AndroidUtilities.dp(48) + (Build.VERSION.SDK_INT >= 21 ? AndroidUtilities.statusBarHeight : 0);
return y >= AndroidUtilities.dp(58) + (Build.VERSION.SDK_INT >= 21 ? AndroidUtilities.statusBarHeight : 0);
}
@Override

View file

@ -277,7 +277,7 @@ public class ContactAddActivity extends BaseFragment implements NotificationCent
}
}
onlineTextView.setText(LocaleController.formatUserStatus(currentAccount, user));
avatarImage.setImage(ImageLocation.getForUserOrChat(user, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(user, ImageLocation.TYPE_STRIPPED), "50_50", avatarDrawable = new AvatarDrawable(user), user);
avatarImage.setForUserOrChat(user, avatarDrawable = new AvatarDrawable(user));
}
public void didReceivedNotification(int id, int account, Object... args) {

View file

@ -2451,7 +2451,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
TLRPC.User user = getUserConfig().getCurrentUser();
avatarDrawable.setInfo(user);
imageView.getImageReceiver().setCurrentAccount(currentAccount);
imageView.setImage(ImageLocation.getForUserOrChat(user, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(user, ImageLocation.TYPE_STRIPPED), "50_50", avatarDrawable, user);
imageView.setForUserOrChat(user, avatarDrawable);
for (int a = 0; a < UserConfig.MAX_ACCOUNT_COUNT; a++) {
TLRPC.User u = AccountInstance.getInstance(a).getUserConfig().getCurrentUser();
@ -7364,8 +7364,10 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
} else {
setFragmentIsSliding(false);
}
if (fragmentView != null) {
fragmentView.requestLayout();
}
}
setSlideTransitionProgress(1f - progress);
}
}

View file

@ -1319,11 +1319,11 @@ public class GroupCallActivity extends BottomSheet implements NotificationCenter
if (peerId > 0) {
TLRPC.User user = accountInstance.getMessagesController().getUser(peerId);
accountSwitchAvatarDrawable.setInfo(user);
accountSwitchImageView.setImage(ImageLocation.getForUserOrChat(user, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(user, ImageLocation.TYPE_STRIPPED), "50_50", accountSwitchAvatarDrawable, user);
accountSwitchImageView.setForUserOrChat(user, accountSwitchAvatarDrawable);
} else {
TLRPC.Chat chat = accountInstance.getMessagesController().getChat(-peerId);
accountSwitchAvatarDrawable.setInfo(chat);
accountSwitchImageView.setImage(ImageLocation.getForUserOrChat(chat, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(chat, ImageLocation.TYPE_STRIPPED), "50_50", accountSwitchAvatarDrawable, chat);
accountSwitchImageView.setForUserOrChat(chat, accountSwitchAvatarDrawable);
}
accountSelectCell.setVisibility(View.GONE);
accountGap.setVisibility(View.GONE);
@ -3748,7 +3748,7 @@ public class GroupCallActivity extends BottomSheet implements NotificationCenter
invites[b] = null;
}
}
if (ChatObject.canManageCalls(currentChat) && !call.call.join_muted) {
if (!copy && ChatObject.canManageCalls(currentChat) && !call.call.join_muted) {
invites[0] = null;
}
if (invites[0] == null && invites[1] == null && !TextUtils.isEmpty(currentChat.username)) {
@ -3763,7 +3763,7 @@ public class GroupCallActivity extends BottomSheet implements NotificationCenter
private void openShareAlert(boolean withMessage, String urlMuted, String urlUnmuted, boolean copy) {
if (copy) {
AndroidUtilities.addToClipboard(invites[0]);
AndroidUtilities.addToClipboard(urlMuted != null ? urlMuted : urlUnmuted);
getUndoView().showWithAction(0, UndoView.ACTION_VOIP_LINK_COPIED, null, null, null, null);
} else {
boolean keyboardIsOpen = false;
@ -4507,11 +4507,11 @@ public class GroupCallActivity extends BottomSheet implements NotificationCenter
String name;
if (object instanceof TLRPC.User) {
TLRPC.User user = (TLRPC.User) object;
imageView.setImage(ImageLocation.getForUserOrChat(user, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(user, ImageLocation.TYPE_STRIPPED), "50_50", avatarDrawable, user);
imageView.setForUserOrChat(user, avatarDrawable);
name = UserObject.getFirstName(user);
} else {
TLRPC.Chat chat = (TLRPC.Chat) object;
imageView.setImage(ImageLocation.getForUserOrChat(chat, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(chat, ImageLocation.TYPE_STRIPPED), "50_50", avatarDrawable, chat);
imageView.setForUserOrChat(chat, avatarDrawable);
name = chat.title;
}

View file

@ -3380,7 +3380,7 @@ public class LaunchActivity extends Activity implements ActionBarLayout.ActionBa
if (!force && BuildVars.DEBUG_VERSION || !force && !BuildVars.CHECK_UPDATES) {
return;
}
if (!force && Math.abs(System.currentTimeMillis() - UserConfig.getInstance(0).lastUpdateCheckTime) < 24 * 60 * 60 * 1000) {
if (!force && Math.abs(System.currentTimeMillis() - UserConfig.getInstance(0).lastUpdateCheckTime) < MessagesController.getInstance(0).updateCheckDelay * 1000) {
return;
}
TLRPC.TL_help_getAppUpdate req = new TLRPC.TL_help_getAppUpdate();

View file

@ -1208,7 +1208,7 @@ public class LocationActivity extends BaseFragment implements NotificationCenter
BackupImageView backupImageView = new BackupImageView(context);
backupImageView.setRoundRadius(AndroidUtilities.dp(26));
backupImageView.setImage(ImageLocation.getForUserOrChat(chat, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(chat, ImageLocation.TYPE_STRIPPED), "50_50", new AvatarDrawable(chat), chat);
backupImageView.setForUserOrChat(chat, new AvatarDrawable(chat));
frameLayout1.addView(backupImageView, LayoutHelper.createFrame(52, 52, Gravity.LEFT | Gravity.TOP, 5, 5, 0, 0));
markerImageView = frameLayout1;

View file

@ -1526,7 +1526,7 @@ public class PassportActivity extends BaseFragment implements NotificationCenter
passwordAvatarContainer.addView(avatarImageView, LayoutHelper.createFrame(64, 64, Gravity.CENTER, 0, 8, 0, 0));
AvatarDrawable avatarDrawable = new AvatarDrawable(botUser);
avatarImageView.setImage(ImageLocation.getForUserOrChat(botUser, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(botUser, ImageLocation.TYPE_STRIPPED), "50_50", avatarDrawable, botUser);
avatarImageView.setForUserOrChat(botUser, avatarDrawable);
passwordRequestTextView = new TextInfoPrivacyCell(context);
passwordRequestTextView.getTextView().setGravity(Gravity.CENTER_HORIZONTAL);
@ -2001,7 +2001,7 @@ public class PassportActivity extends BaseFragment implements NotificationCenter
avatarContainer.addView(avatarImageView, LayoutHelper.createFrame(64, 64, Gravity.CENTER, 0, 8, 0, 0));
AvatarDrawable avatarDrawable = new AvatarDrawable(botUser);
avatarImageView.setImage(ImageLocation.getForUserOrChat(botUser, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(botUser, ImageLocation.TYPE_STRIPPED), "50_50", avatarDrawable, botUser);
avatarImageView.setForUserOrChat(botUser, avatarDrawable);
bottomCell = new TextInfoPrivacyCell(context);
bottomCell.setBackgroundDrawable(Theme.getThemedDrawable(context, R.drawable.greydivider_top, Theme.key_windowBackgroundGrayShadow));

View file

@ -204,6 +204,7 @@ public class PaymentFormActivity extends BaseFragment implements NotificationCen
private FrameLayout googlePayContainer;
private FrameLayout googlePayButton;
private LinearLayout linearLayout2;
private TextPriceCell totalCell;
private EditTextSettingsCell codeFieldCell;
@ -240,6 +241,8 @@ public class PaymentFormActivity extends BaseFragment implements NotificationCen
private LinearLayout tipLayout;
private ArrayList<TLRPC.TL_labeledPrice> prices;
private int currentStep;
private boolean passwordOk;
private String paymentJson;
@ -1684,14 +1687,14 @@ public class PaymentFormActivity extends BaseFragment implements NotificationCen
sectionCell[0] = new ShadowSectionCell(context);
linearLayout2.addView(sectionCell[0], LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT));
ArrayList<TLRPC.TL_labeledPrice> arrayList = new ArrayList<>(paymentForm.invoice.prices);
prices = new ArrayList<>(paymentForm.invoice.prices);
if (shippingOption != null) {
arrayList.addAll(shippingOption.prices);
prices.addAll(shippingOption.prices);
}
totalPrice = new String[1];
for (int a = 0; a < arrayList.size(); a++) {
TLRPC.TL_labeledPrice price = arrayList.get(a);
for (int a = 0; a < prices.size(); a++) {
TLRPC.TL_labeledPrice price = prices.get(a);
TextPriceCell priceCell = new TextPriceCell(context);
priceCell.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite));
@ -1706,10 +1709,10 @@ public class PaymentFormActivity extends BaseFragment implements NotificationCen
linearLayout2.addView(priceCell);
}
TextPriceCell priceCell = new TextPriceCell(context);
priceCell.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite));
totalPrice[0] = getTotalPriceString(arrayList);
priceCell.setTextAndValue(LocaleController.getString("PaymentTransactionTotal", R.string.PaymentTransactionTotal), totalPrice[0], true);
totalCell = new TextPriceCell(context);
totalCell.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite));
totalPrice[0] = getTotalPriceString(prices);
totalCell.setTextAndValue(LocaleController.getString("PaymentTransactionTotal", R.string.PaymentTransactionTotal), totalPrice[0], true);
if (currentStep == 4 && (paymentForm.invoice.flags & 256) != 0) {
ViewGroup container = new FrameLayout(context);
@ -1746,7 +1749,22 @@ public class PaymentFormActivity extends BaseFragment implements NotificationCen
private boolean anyBefore;
private String overrideText;
private boolean dotEntered;
private boolean isDeletedChar;
private int beforeTextLength;
private int enteredCharacterStart;
private boolean lastDotEntered;
char[] commas = new char[]{',', '.', '٫', '、', '\u2E41', '︐', '︑', '﹐', '﹑', '', '、', 'ʻ'};
private int indexOfComma(String text) {
for (int a = 0; a < commas.length; a++) {
int idx = text.indexOf(commas[a]);
if (idx >= 0) {
return idx;
}
}
return -1;
}
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
@ -1755,17 +1773,24 @@ public class PaymentFormActivity extends BaseFragment implements NotificationCen
}
anyBefore = !TextUtils.isEmpty(s);
overrideText = null;
if (count == 1 && after == 0) {
beforeTextLength = s == null ? 0 : s.length();
enteredCharacterStart = start;
if (isDeletedChar = (count == 1 && after == 0)) {
String fixed = LocaleController.fixNumbers(s);
char actionCh = fixed.charAt(start);
if (actionCh < '0' || actionCh > '9') {
while (--start > 0) {
int idx = indexOfComma(fixed);
String reminderStr = idx >= 0 ? fixed.substring(idx + 1) : "";
long reminder = Utilities.parseLong(PhoneFormat.stripExceptNumbers(reminderStr));
if ((actionCh < '0' || actionCh > '9') && (reminderStr.length() == 0 || reminder != 0)) {
while (--start >= 0) {
actionCh = fixed.charAt(start);
if (actionCh >= '0' && actionCh <= '9') {
overrideText = fixed.substring(0, start) + fixed.substring(start + 1);
break;
}
}
} else if (idx > 0 && start > idx && reminder == 0) {
overrideText = fixed.substring(0, idx - 1);
}
}
}
@ -1788,42 +1813,54 @@ public class PaymentFormActivity extends BaseFragment implements NotificationCen
} else {
text = LocaleController.fixNumbers(s.toString());
}
tipAmount = Utilities.parseLong(PhoneFormat.stripExceptNumbers(text));
/*if (!dotEntered) {
int idx = indexOfComma(text);
boolean dotEntered = idx >= 0;
int exp = LocaleController.getCurrencyExpDivider(paymentForm.invoice.currency);
String wholeStr = idx >= 0 ? text.substring(0, idx) : text;
String reminderStr = idx >= 0 ? text.substring(idx + 1) : "";
long whole = Utilities.parseLong(PhoneFormat.stripExceptNumbers(wholeStr)) * exp;
long reminder = Utilities.parseLong(PhoneFormat.stripExceptNumbers(reminderStr));
reminderStr = "" + reminder;
String expStr = "" + (exp - 1);
if (idx > 0 && reminderStr.length() > expStr.length()) {
if (enteredCharacterStart - idx < reminderStr.length()) {
reminderStr = reminderStr.substring(0, expStr.length());
} else {
reminderStr = reminderStr.substring(reminderStr.length() - expStr.length());
}
if (text.endsWith(",") || text.endsWith(".")) {
dotEntered = true;
reminder = Utilities.parseLong(reminderStr);
}
if (tipAmount == 0) {
dotEntered = false;
}*/
tipAmount = whole + reminder;
if (paymentForm.invoice.max_tip_amount != 0 && tipAmount > paymentForm.invoice.max_tip_amount) {
tipAmount = paymentForm.invoice.max_tip_amount;
}
int start = inputFields[0].getSelectionStart();
String phoneChars = "0123456789,.";
String str = inputFields[0].getText().toString();
StringBuilder builder = new StringBuilder(str.length());
for (int a = 0; a < str.length(); a++) {
String ch = str.substring(a, a + 1);
if (phoneChars.contains(ch)) {
builder.append(ch);
}
}
ignoreOnTextChange = true;
inputFields[0].setText(LocaleController.getInstance().formatCurrencyString(tipAmount, false, paymentForm.invoice.currency));
String newText;
if (tipAmount == 0) {
inputFields[0].setText(newText = "");
} else {
inputFields[0].setText(newText = LocaleController.getInstance().formatCurrencyString(tipAmount, false, dotEntered, true, paymentForm.invoice.currency));
}
if (oldAmount < tipAmount && oldAmount != 0 && anyBefore && start >= 0) {
inputFields[0].setSelection(Math.min(start, inputFields[0].length()));
} else if (!isDeletedChar || beforeTextLength == inputFields[0].length()) {
if (!lastDotEntered && dotEntered && idx >= 0) {
idx = indexOfComma(newText);
if (idx > 0) {
inputFields[0].setSelection(idx + 1);
} else {
inputFields[0].setSelection(inputFields[0].length());
}
totalPrice[0] = getTotalPriceString(arrayList);
priceCell.setTextAndValue(LocaleController.getString("PaymentTransactionTotal", R.string.PaymentTransactionTotal), totalPrice[0], true);
if (payTextView != null) {
payTextView.setText(LocaleController.formatString("PaymentCheckoutPay", R.string.PaymentCheckoutPay, totalPrice[0]));
} else {
inputFields[0].setSelection(inputFields[0].length());
}
checkSelectedTip();
} else {
inputFields[0].setSelection(Math.max(0, Math.min(start, inputFields[0].length())));
}
lastDotEntered = dotEntered;
updateTotalPrice();
overrideText = null;
ignoreOnTextChange = false;
}
});
@ -1932,9 +1969,13 @@ public class PaymentFormActivity extends BaseFragment implements NotificationCen
valueTextView.setOnClickListener(v -> {
long amoumt = (Long) valueTextView.getTag();
if (tipAmount != null && amoumt == tipAmount) {
inputFields[0].setText(LocaleController.getInstance().formatCurrencyString(0, false, paymentForm.invoice.currency));
ignoreOnTextChange = true;
inputFields[0].setText("");
ignoreOnTextChange = false;
tipAmount = 0L;
updateTotalPrice();
} else {
inputFields[0].setText(LocaleController.getInstance().formatCurrencyString(amount, false, paymentForm.invoice.currency));
inputFields[0].setText(LocaleController.getInstance().formatCurrencyString(amount, false, true, true, paymentForm.invoice.currency));
}
inputFields[0].setSelection(inputFields[0].length());
});
@ -1946,7 +1987,7 @@ public class PaymentFormActivity extends BaseFragment implements NotificationCen
}
}
linearLayout2.addView(priceCell);
linearLayout2.addView(totalCell);
sectionCell[2] = new ShadowSectionCell(context);
sectionCell[2].setBackgroundDrawable(Theme.getThemedDrawable(context, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow));
@ -2381,16 +2422,6 @@ public class PaymentFormActivity extends BaseFragment implements NotificationCen
return fragmentView;
}
private void checkSelectedTip() {
int color = Theme.getColor(Theme.key_contacts_inviteBackground);
for (int b = 0, N2 = tipLayout.getChildCount(); b < N2; b++) {
View child = tipLayout.getChildAt(b);
int alpha = child.getTag().equals(tipAmount) ? 0x3fffffff : 0x1fffffff;
Theme.setDrawableColor(child.getBackground(), color & alpha);
child.invalidate();
}
}
private void setAddressFields() {
if (validateRequest.info.shipping_address != null) {
String address = String.format("%s %s, %s, %s, %s, %s", validateRequest.info.shipping_address.street_line1, validateRequest.info.shipping_address.street_line2, validateRequest.info.shipping_address.city, validateRequest.info.shipping_address.state, validateRequest.info.shipping_address.country_iso2, validateRequest.info.shipping_address.post_code);
@ -2410,6 +2441,28 @@ public class PaymentFormActivity extends BaseFragment implements NotificationCen
}
}
private void updateTotalPrice() {
totalPrice[0] = getTotalPriceString(prices);
totalCell.setTextAndValue(LocaleController.getString("PaymentTransactionTotal", R.string.PaymentTransactionTotal), totalPrice[0], true);
if (payTextView != null) {
payTextView.setText(LocaleController.formatString("PaymentCheckoutPay", R.string.PaymentCheckoutPay, totalPrice[0]));
}
if (tipLayout != null) {
int color = Theme.getColor(Theme.key_contacts_inviteBackground);
for (int b = 0, N2 = tipLayout.getChildCount(); b < N2; b++) {
TextView child = (TextView) tipLayout.getChildAt(b);
if (child.getTag().equals(tipAmount)) {
Theme.setDrawableColor(child.getBackground(), color);
child.setTextColor(Theme.getColor(Theme.key_contacts_inviteText));
} else {
Theme.setDrawableColor(child.getBackground(), color & 0x1fffffff);
child.setTextColor(Theme.getColor(Theme.key_chats_secretName));
}
child.invalidate();
}
}
}
private void createGooglePayButton(Context context) {
googlePayContainer = new FrameLayout(context);
googlePayContainer.setBackgroundDrawable(Theme.getSelectorDrawable(true));
@ -2617,7 +2670,7 @@ public class PaymentFormActivity extends BaseFragment implements NotificationCen
private void showPayAlert(final String totalPrice) {
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
builder.setTitle(LocaleController.getString("PaymentTransactionReview", R.string.PaymentTransactionReview));
builder.setMessage(LocaleController.formatString("PaymentTransactionMessage", R.string.PaymentTransactionMessage, totalPrice, currentBotName, currentItemName));
builder.setMessage(AndroidUtilities.replaceTags(LocaleController.formatString("PaymentTransactionMessage2", R.string.PaymentTransactionMessage2, totalPrice, currentBotName, currentItemName)));
builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), (dialogInterface, i) -> {
setDonePressed(true);
sendData();

View file

@ -13611,8 +13611,10 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
textureImageView.setImageDrawable(null);
}
}
if (pipVideoView != null) {
pipVideoView.close();
pipVideoView = null;
}
} else {
containerView.invalidate();
}

View file

@ -1372,7 +1372,7 @@ public class PopupNotificationActivity extends Activity implements NotificationC
currentChat = chat;
if (avatarImageView != null) {
AvatarDrawable avatarDrawable = new AvatarDrawable(currentChat);
avatarImageView.setImage(ImageLocation.getForUserOrChat(chat, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(chat, ImageLocation.TYPE_STRIPPED), "50_50", avatarDrawable, chat);
avatarImageView.setForUserOrChat(chat, avatarDrawable);
}
} else if (currentUser != null) {
TLRPC.User user = MessagesController.getInstance(currentMessageObject.currentAccount).getUser(currentUser.id);
@ -1382,7 +1382,7 @@ public class PopupNotificationActivity extends Activity implements NotificationC
currentUser = user;
if (avatarImageView != null) {
AvatarDrawable avatarDrawable = new AvatarDrawable(currentUser);
avatarImageView.setImage(ImageLocation.getForUserOrChat(user, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(user, ImageLocation.TYPE_STRIPPED), "50_50", avatarDrawable, user);
avatarImageView.setForUserOrChat(user, avatarDrawable);
}
}
}

View file

@ -3432,6 +3432,9 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
canEditAdmin = false;
}
allowKick = canRestrict = ChatObject.canBlockUsers(currentChat) && (!(channelParticipant instanceof TLRPC.TL_channelParticipantAdmin || channelParticipant instanceof TLRPC.TL_channelParticipantCreator) || channelParticipant.can_edit);
if (currentChat.gigagroup) {
canRestrict = false;
}
editingAdmin = channelParticipant instanceof TLRPC.TL_channelParticipantAdmin;
} else {
channelParticipant = null;
@ -3634,9 +3637,17 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
if (i == 0) {
try {
android.content.ClipboardManager clipboard = (android.content.ClipboardManager) ApplicationLoader.applicationContext.getSystemService(Context.CLIPBOARD_SERVICE);
android.content.ClipData clip = android.content.ClipData.newPlainText("label", "https://" + MessagesController.getInstance(UserConfig.selectedAccount).linkPrefix + "/" + username);
clipboard.setPrimaryClip(clip);
String text;
if (user_id != 0) {
text = "@" + username;
BulletinFactory.of(this).createCopyBulletin(LocaleController.getString("UsernameCopied", R.string.UsernameCopied)).show();
} else {
text = "https://" + MessagesController.getInstance(UserConfig.selectedAccount).linkPrefix + "/" + username;
BulletinFactory.of(this).createCopyBulletin(LocaleController.getString("LinkCopied", R.string.LinkCopied)).show();
}
android.content.ClipData clip = android.content.ClipData.newPlainText("label", text);
clipboard.setPrimaryClip(clip);
} catch (Exception e) {
FileLog.e(e);
}

View file

@ -85,7 +85,7 @@
<string name="PaymentCardSavePaymentInformationInfoLine1">You can save your payment info for future use.</string>
<string name="PaymentCardSavePaymentInformationInfoLine2">Please *turn on Two-Step Verification* to enable this.</string>
<string name="PaymentTransactionReview">Transaction Review</string>
<string name="PaymentTransactionMessage">Do you really want to transfer %1$s to the %2$s bot for %3$s?</string>
<string name="PaymentTransactionMessage2">Transfer **%1$s** to the %2$s bot for **%3$s**?</string>
<string name="PaymentTransactionTotal">Total</string>
<string name="PaymentInvoice">INVOICE</string>
<string name="PaymentTestInvoice">TEST INVOICE</string>