mirror of https://github.com/NekoX-Dev/NekoX.git
Update to 7.1.2 (2098)
This commit is contained in:
parent
99f5637dda
commit
75d0903666
|
@ -284,7 +284,7 @@ android {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
defaultConfig.versionCode = 2096
|
defaultConfig.versionCode = 2098
|
||||||
|
|
||||||
applicationVariants.all { variant ->
|
applicationVariants.all { variant ->
|
||||||
variant.outputs.all { output ->
|
variant.outputs.all { output ->
|
||||||
|
@ -319,7 +319,7 @@ android {
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
minSdkVersion 16
|
minSdkVersion 16
|
||||||
targetSdkVersion 28
|
targetSdkVersion 28
|
||||||
versionName "7.1.1"
|
versionName "7.1.2"
|
||||||
|
|
||||||
vectorDrawables.generatedDensities = ['mdpi', 'hdpi', 'xhdpi', 'xxhdpi']
|
vectorDrawables.generatedDensities = ['mdpi', 'hdpi', 'xhdpi', 'xxhdpi']
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
|
|
||||||
#define USE_DEBUG_SESSION false
|
#define USE_DEBUG_SESSION false
|
||||||
#define READ_BUFFER_SIZE 1024 * 128
|
#define READ_BUFFER_SIZE 1024 * 128
|
||||||
#define DEBUG_VERSION
|
//#define DEBUG_VERSION
|
||||||
#define USE_OLD_KEYS
|
#define USE_OLD_KEYS
|
||||||
#define PFS_ENABLED 1
|
#define PFS_ENABLED 1
|
||||||
#define DEFAULT_DATACENTER_ID INT_MAX
|
#define DEFAULT_DATACENTER_ID INT_MAX
|
||||||
|
|
|
@ -328,7 +328,11 @@ public class AndroidUtilities {
|
||||||
SpannableStringBuilder spannableStringBuilder = SpannableStringBuilder.valueOf(str);
|
SpannableStringBuilder spannableStringBuilder = SpannableStringBuilder.valueOf(str);
|
||||||
int i = s.indexOf(query);
|
int i = s.indexOf(query);
|
||||||
while (i >= 0) {
|
while (i >= 0) {
|
||||||
spannableStringBuilder.setSpan(new ForegroundColorSpanThemable(Theme.key_windowBackgroundWhiteBlueText4), i, i + query.length(), 0);
|
try {
|
||||||
|
spannableStringBuilder.setSpan(new ForegroundColorSpanThemable(Theme.key_windowBackgroundWhiteBlueText4), i, i + query.length(), 0);
|
||||||
|
} catch (Exception e) {
|
||||||
|
FileLog.e(e);
|
||||||
|
}
|
||||||
i = s.indexOf(query, i + 1);
|
i = s.indexOf(query, i + 1);
|
||||||
}
|
}
|
||||||
return spannableStringBuilder;
|
return spannableStringBuilder;
|
||||||
|
|
|
@ -18,7 +18,7 @@ public class BuildVars {
|
||||||
public static boolean LOGS_ENABLED = false;
|
public static boolean LOGS_ENABLED = false;
|
||||||
public static boolean USE_CLOUD_STRINGS = true;
|
public static boolean USE_CLOUD_STRINGS = true;
|
||||||
public static boolean CHECK_UPDATES = true;
|
public static boolean CHECK_UPDATES = true;
|
||||||
public static int BUILD_VERSION = 2096;
|
public static int BUILD_VERSION = 2098;
|
||||||
public static String BUILD_VERSION_STRING = "7.1.0";
|
public static String BUILD_VERSION_STRING = "7.1.0";
|
||||||
public static int APP_ID = 4;
|
public static int APP_ID = 4;
|
||||||
public static String APP_HASH = "014b35b6184100b085b0d0572f9b5103";
|
public static String APP_HASH = "014b35b6184100b085b0d0572f9b5103";
|
||||||
|
|
|
@ -3213,7 +3213,7 @@ public class MediaController implements AudioManager.OnAudioFocusChangeListener,
|
||||||
if (messageObject1 == null) {
|
if (messageObject1 == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (waveform != null) {
|
if (waveform != null && messageObject1.getDocument() != null) {
|
||||||
for (int a = 0; a < messageObject1.getDocument().attributes.size(); a++) {
|
for (int a = 0; a < messageObject1.getDocument().attributes.size(); a++) {
|
||||||
TLRPC.DocumentAttribute attribute = messageObject1.getDocument().attributes.get(a);
|
TLRPC.DocumentAttribute attribute = messageObject1.getDocument().attributes.get(a);
|
||||||
if (attribute instanceof TLRPC.TL_documentAttributeAudio) {
|
if (attribute instanceof TLRPC.TL_documentAttributeAudio) {
|
||||||
|
|
|
@ -2179,60 +2179,75 @@ public class MediaDataController extends BaseController {
|
||||||
final int currentReqId = ++lastReqId;
|
final int currentReqId = ++lastReqId;
|
||||||
lastSearchQuery = query;
|
lastSearchQuery = query;
|
||||||
final long queryWithDialogFinal = queryWithDialog;
|
final long queryWithDialogFinal = queryWithDialog;
|
||||||
reqId = getConnectionsManager().sendRequest(req, (response, error) -> AndroidUtilities.runOnUIThread(() -> {
|
String finalQuery = query;
|
||||||
if (currentReqId == lastReqId) {
|
reqId = getConnectionsManager().sendRequest(req, (response, error) -> {
|
||||||
reqId = 0;
|
ArrayList<MessageObject> messageObjects = new ArrayList<>();
|
||||||
if (!jumpToMessage) {
|
|
||||||
loadingMoreSearchMessages = false;
|
if (error == null) {
|
||||||
}
|
TLRPC.messages_Messages res = (TLRPC.messages_Messages) response;
|
||||||
if (response != null) {
|
int N = Math.min(res.messages.size(), 20);
|
||||||
TLRPC.messages_Messages res = (TLRPC.messages_Messages) response;
|
for (int a = 0; a < N; a++) {
|
||||||
for (int a = 0; a < res.messages.size(); a++) {
|
TLRPC.Message message = res.messages.get(a);
|
||||||
TLRPC.Message message = res.messages.get(a);
|
MessageObject messageObject = new MessageObject(currentAccount, message, false, false);
|
||||||
if (message instanceof TLRPC.TL_messageEmpty || message.action instanceof TLRPC.TL_messageActionHistoryClear) {
|
messageObject.setQuery(finalQuery);
|
||||||
res.messages.remove(a);
|
messageObjects.add(messageObject);
|
||||||
a--;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
getMessagesStorage().putUsersAndChats(res.users, res.chats, true, true);
|
|
||||||
getMessagesController().putUsers(res.users, false);
|
|
||||||
getMessagesController().putChats(res.chats, false);
|
|
||||||
if (req.offset_id == 0 && queryWithDialogFinal == dialogId) {
|
|
||||||
lastReturnedNum = 0;
|
|
||||||
searchResultMessages.clear();
|
|
||||||
searchResultMessagesMap[0].clear();
|
|
||||||
searchResultMessagesMap[1].clear();
|
|
||||||
messagesSearchCount[0] = 0;
|
|
||||||
getNotificationCenter().postNotificationName(NotificationCenter.chatSearchResultsLoading, guid);
|
|
||||||
}
|
|
||||||
boolean added = false;
|
|
||||||
int N = Math.min(res.messages.size(), 20);
|
|
||||||
for (int a = 0; a < N; a++) {
|
|
||||||
TLRPC.Message message = res.messages.get(a);
|
|
||||||
added = true;
|
|
||||||
MessageObject messageObject = new MessageObject(currentAccount, message, false, false);
|
|
||||||
searchResultMessages.add(messageObject);
|
|
||||||
searchResultMessagesMap[queryWithDialogFinal == dialogId ? 0 : 1].put(messageObject.getId(), messageObject);
|
|
||||||
}
|
|
||||||
messagesSearchEndReached[queryWithDialogFinal == dialogId ? 0 : 1] = res.messages.size() < 21;
|
|
||||||
messagesSearchCount[queryWithDialogFinal == dialogId ? 0 : 1] = res instanceof TLRPC.TL_messages_messagesSlice || res instanceof TLRPC.TL_messages_channelMessages ? res.count : res.messages.size();
|
|
||||||
if (searchResultMessages.isEmpty()) {
|
|
||||||
getNotificationCenter().postNotificationName(NotificationCenter.chatSearchResultsAvailable, guid, 0, getMask(), (long) 0, 0, 0, jumpToMessage);
|
|
||||||
} else {
|
|
||||||
if (added) {
|
|
||||||
if (lastReturnedNum >= searchResultMessages.size()) {
|
|
||||||
lastReturnedNum = searchResultMessages.size() - 1;
|
|
||||||
}
|
|
||||||
MessageObject messageObject = searchResultMessages.get(lastReturnedNum);
|
|
||||||
getNotificationCenter().postNotificationName(NotificationCenter.chatSearchResultsAvailable, guid, messageObject.getId(), getMask(), messageObject.getDialogId(), lastReturnedNum, messagesSearchCount[0] + messagesSearchCount[1], jumpToMessage);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (queryWithDialogFinal == dialogId && messagesSearchEndReached[0] && mergeDialogId != 0 && !messagesSearchEndReached[1]) {
|
|
||||||
searchMessagesInChat(lastSearchQuery, dialogId, mergeDialogId, guid, 0, replyMessageId, true, user, jumpToMessage);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}), ConnectionsManager.RequestFlagFailOnServerErrors);
|
AndroidUtilities.runOnUIThread(() -> {
|
||||||
|
if (currentReqId == lastReqId) {
|
||||||
|
reqId = 0;
|
||||||
|
if (!jumpToMessage) {
|
||||||
|
loadingMoreSearchMessages = false;
|
||||||
|
}
|
||||||
|
if (response != null) {
|
||||||
|
TLRPC.messages_Messages res = (TLRPC.messages_Messages) response;
|
||||||
|
for (int a = 0; a < res.messages.size(); a++) {
|
||||||
|
TLRPC.Message message = res.messages.get(a);
|
||||||
|
if (message instanceof TLRPC.TL_messageEmpty || message.action instanceof TLRPC.TL_messageActionHistoryClear) {
|
||||||
|
res.messages.remove(a);
|
||||||
|
a--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
getMessagesStorage().putUsersAndChats(res.users, res.chats, true, true);
|
||||||
|
getMessagesController().putUsers(res.users, false);
|
||||||
|
getMessagesController().putChats(res.chats, false);
|
||||||
|
if (req.offset_id == 0 && queryWithDialogFinal == dialogId) {
|
||||||
|
lastReturnedNum = 0;
|
||||||
|
searchResultMessages.clear();
|
||||||
|
searchResultMessagesMap[0].clear();
|
||||||
|
searchResultMessagesMap[1].clear();
|
||||||
|
messagesSearchCount[0] = 0;
|
||||||
|
getNotificationCenter().postNotificationName(NotificationCenter.chatSearchResultsLoading, guid);
|
||||||
|
}
|
||||||
|
boolean added = false;
|
||||||
|
int N = Math.min(res.messages.size(), 20);
|
||||||
|
for (int a = 0; a < N; a++) {
|
||||||
|
TLRPC.Message message = res.messages.get(a);
|
||||||
|
added = true;
|
||||||
|
MessageObject messageObject = messageObjects.get(a);
|
||||||
|
searchResultMessages.add(messageObject);
|
||||||
|
searchResultMessagesMap[queryWithDialogFinal == dialogId ? 0 : 1].put(messageObject.getId(), messageObject);
|
||||||
|
}
|
||||||
|
messagesSearchEndReached[queryWithDialogFinal == dialogId ? 0 : 1] = res.messages.size() < 21;
|
||||||
|
messagesSearchCount[queryWithDialogFinal == dialogId ? 0 : 1] = res instanceof TLRPC.TL_messages_messagesSlice || res instanceof TLRPC.TL_messages_channelMessages ? res.count : res.messages.size();
|
||||||
|
if (searchResultMessages.isEmpty()) {
|
||||||
|
getNotificationCenter().postNotificationName(NotificationCenter.chatSearchResultsAvailable, guid, 0, getMask(), (long) 0, 0, 0, jumpToMessage);
|
||||||
|
} else {
|
||||||
|
if (added) {
|
||||||
|
if (lastReturnedNum >= searchResultMessages.size()) {
|
||||||
|
lastReturnedNum = searchResultMessages.size() - 1;
|
||||||
|
}
|
||||||
|
MessageObject messageObject = searchResultMessages.get(lastReturnedNum);
|
||||||
|
getNotificationCenter().postNotificationName(NotificationCenter.chatSearchResultsAvailable, guid, messageObject.getId(), getMask(), messageObject.getDialogId(), lastReturnedNum, messagesSearchCount[0] + messagesSearchCount[1], jumpToMessage);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (queryWithDialogFinal == dialogId && messagesSearchEndReached[0] && mergeDialogId != 0 && !messagesSearchEndReached[1]) {
|
||||||
|
searchMessagesInChat(lastSearchQuery, dialogId, mergeDialogId, guid, 0, replyMessageId, true, user, jumpToMessage);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}, ConnectionsManager.RequestFlagFailOnServerErrors);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getLastSearchQuery() {
|
public String getLastSearchQuery() {
|
||||||
|
|
|
@ -5560,7 +5560,7 @@ public class MessagesController extends BaseController implements NotificationCe
|
||||||
boolean isMegagroup = false;
|
boolean isMegagroup = false;
|
||||||
if (messagesRes instanceof TLRPC.TL_messages_channelMessages) {
|
if (messagesRes instanceof TLRPC.TL_messages_channelMessages) {
|
||||||
int channelId = -(int) dialogId;
|
int channelId = -(int) dialogId;
|
||||||
if (!scheduled) {
|
if (!scheduled && threadMessageId == 0) {
|
||||||
int channelPts = channelsPts.get(channelId);
|
int channelPts = channelsPts.get(channelId);
|
||||||
if (channelPts == 0) {
|
if (channelPts == 0) {
|
||||||
channelPts = getMessagesStorage().getChannelPtsSync(channelId);
|
channelPts = getMessagesStorage().getChannelPtsSync(channelId);
|
||||||
|
|
|
@ -7569,6 +7569,9 @@ public class MessagesStorage extends BaseController {
|
||||||
}
|
}
|
||||||
replies = currentReplies;
|
replies = currentReplies;
|
||||||
}
|
}
|
||||||
|
if (currentReplies != null && currentReplies.read_max_id > replies.read_max_id) {
|
||||||
|
replies.read_max_id = currentReplies.read_max_id;
|
||||||
|
}
|
||||||
state.requery();
|
state.requery();
|
||||||
NativeByteBuffer data = new NativeByteBuffer(replies.getObjectSize());
|
NativeByteBuffer data = new NativeByteBuffer(replies.getObjectSize());
|
||||||
replies.serializeToStream(data);
|
replies.serializeToStream(data);
|
||||||
|
|
|
@ -608,206 +608,43 @@ public class NotificationsController extends BaseController {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void processEditedMessages(final LongSparseArray<ArrayList<MessageObject>> editedMessages) {
|
public void processEditedMessages(final LongSparseArray<ArrayList<MessageObject>> editedMessages) {
|
||||||
/*if (editedMessages.size() == 0) {
|
if (editedMessages.size() == 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final ArrayList<MessageObject> popupArrayAdd = new ArrayList<>(0);
|
final ArrayList<MessageObject> popupArrayAdd = new ArrayList<>(0);
|
||||||
notificationsQueue.postRunnable(() -> {
|
notificationsQueue.postRunnable(() -> {
|
||||||
boolean added = false;
|
boolean updated = false;
|
||||||
boolean edited = false;
|
for (int a = 0, N = editedMessages.size(); a < N; a++) {
|
||||||
|
long did = editedMessages.keyAt(a);
|
||||||
LongSparseArray<Boolean> settingsCache = new LongSparseArray<>();
|
if (pushDialogs.indexOfKey(did) < 0) {
|
||||||
SharedPreferences preferences = getAccountInstance().getNotificationsSettings();
|
|
||||||
boolean allowPinned = preferences.getBoolean("PinnedMessages", true);
|
|
||||||
int popup = 0;
|
|
||||||
boolean hasScheduled = false;
|
|
||||||
|
|
||||||
for (int a = 0; a < messageObjects.size(); a++) {
|
|
||||||
MessageObject messageObject = messageObjects.get(a);
|
|
||||||
if (messageObject.messageOwner != null && messageObject.messageOwner.silent && (messageObject.messageOwner.action instanceof TLRPC.TL_messageActionContactSignUp || messageObject.messageOwner.action instanceof TLRPC.TL_messageActionUserJoined)) {
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
long mid = messageObject.getId();
|
ArrayList<MessageObject> messages = editedMessages.valueAt(a);
|
||||||
long random_id = messageObject.isFcmMessage() ? messageObject.messageOwner.random_id : 0;
|
for (int b = 0, N2 = messages.size(); b < N2; b++) {
|
||||||
long dialog_id = messageObject.getDialogId();
|
MessageObject messageObject = messages.get(b);
|
||||||
int lower_id = (int) dialog_id;
|
long mid = messageObject.getId();
|
||||||
boolean isChannel;
|
if (messageObject.messageOwner.peer_id.channel_id != 0) {
|
||||||
if (messageObject.isFcmMessage()) {
|
mid |= ((long) messageObject.messageOwner.peer_id.channel_id) << 32;
|
||||||
isChannel = messageObject.localChannel;
|
|
||||||
} else if (lower_id < 0) {
|
|
||||||
TLRPC.Chat chat = getMessagesController().getChat(-lower_id);
|
|
||||||
isChannel = ChatObject.isChannel(chat) && !chat.megagroup;
|
|
||||||
} else {
|
|
||||||
isChannel = false;
|
|
||||||
}
|
|
||||||
if (messageObject.messageOwner.to_id.channel_id != 0) {
|
|
||||||
mid |= ((long) messageObject.messageOwner.to_id.channel_id) << 32;
|
|
||||||
}
|
|
||||||
|
|
||||||
MessageObject oldMessageObject = pushMessagesDict.get(mid);
|
|
||||||
if (oldMessageObject == null && messageObject.messageOwner.random_id != 0) {
|
|
||||||
oldMessageObject = fcmRandomMessagesDict.get(messageObject.messageOwner.random_id);
|
|
||||||
if (oldMessageObject != null) {
|
|
||||||
fcmRandomMessagesDict.remove(messageObject.messageOwner.random_id);
|
|
||||||
}
|
}
|
||||||
}
|
MessageObject oldMessage = pushMessagesDict.get(mid);
|
||||||
if (oldMessageObject != null) {
|
if (oldMessage != null) {
|
||||||
if (oldMessageObject.isFcmMessage()) {
|
updated = true;
|
||||||
pushMessagesDict.put(mid, messageObject);
|
pushMessagesDict.put(mid, messageObject);
|
||||||
int idxOld = pushMessages.indexOf(oldMessageObject);
|
int idx = pushMessages.indexOf(oldMessage);
|
||||||
if (idxOld >= 0) {
|
if (idx >= 0) {
|
||||||
pushMessages.set(idxOld, messageObject);
|
pushMessages.set(idx, messageObject);
|
||||||
popup = addToPopupMessages(popupArrayAdd, messageObject, lower_id, dialog_id, isChannel, preferences);
|
|
||||||
}
|
}
|
||||||
if (isFcm && (edited = messageObject.localEdit)) {
|
idx = delayedPushMessages.indexOf(oldMessage);
|
||||||
getMessagesStorage().putPushMessage(messageObject);
|
if (idx >= 0) {
|
||||||
|
delayedPushMessages.set(idx, messageObject);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (edited) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (isFcm) {
|
|
||||||
getMessagesStorage().putPushMessage(messageObject);
|
|
||||||
}
|
|
||||||
|
|
||||||
long original_dialog_id = dialog_id;
|
|
||||||
if (dialog_id == opened_dialog_id && ApplicationLoader.isScreenOn) {
|
|
||||||
if (!isFcm) {
|
|
||||||
playInChatSound();
|
|
||||||
}
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (messageObject.messageOwner.mentioned) {
|
|
||||||
if (!allowPinned && messageObject.messageOwner.action instanceof TLRPC.TL_messageActionPinMessage) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
dialog_id = messageObject.messageOwner.from_id;
|
|
||||||
}
|
|
||||||
if (isPersonalMessage(messageObject)) {
|
|
||||||
personal_count++;
|
|
||||||
}
|
|
||||||
added = true;
|
|
||||||
|
|
||||||
boolean isChat = lower_id < 0;
|
|
||||||
int index = settingsCache.indexOfKey(dialog_id);
|
|
||||||
boolean value;
|
|
||||||
if (index >= 0) {
|
|
||||||
value = settingsCache.valueAt(index);
|
|
||||||
} else {
|
|
||||||
int notifyOverride = getNotifyOverride(preferences, dialog_id);
|
|
||||||
if (notifyOverride == -1) {
|
|
||||||
value = isGlobalNotificationsEnabled(dialog_id, isChannel);
|
|
||||||
} else {
|
|
||||||
value = notifyOverride != 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
settingsCache.put(dialog_id, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (value) {
|
|
||||||
if (!isFcm) {
|
|
||||||
popup = addToPopupMessages(popupArrayAdd, messageObject, lower_id, dialog_id, isChannel, preferences);
|
|
||||||
}
|
|
||||||
if (!hasScheduled) {
|
|
||||||
hasScheduled = messageObject.messageOwner.from_scheduled;
|
|
||||||
}
|
|
||||||
delayedPushMessages.add(messageObject);
|
|
||||||
pushMessages.add(0, messageObject);
|
|
||||||
if (mid != 0) {
|
|
||||||
pushMessagesDict.put(mid, messageObject);
|
|
||||||
} else if (random_id != 0) {
|
|
||||||
fcmRandomMessagesDict.put(random_id, messageObject);
|
|
||||||
}
|
|
||||||
if (original_dialog_id != dialog_id) {
|
|
||||||
Integer current = pushDialogsOverrideMention.get(original_dialog_id);
|
|
||||||
pushDialogsOverrideMention.put(original_dialog_id, current == null ? 1 : current + 1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (updated) {
|
||||||
if (added) {
|
showOrUpdateNotification(false);
|
||||||
notifyCheck = isLast;
|
|
||||||
}
|
}
|
||||||
|
});
|
||||||
if (!popupArrayAdd.isEmpty() && !AndroidUtilities.needShowPasscode() && !SharedConfig.isWaitingForPasscodeEnter) {
|
|
||||||
final int popupFinal = popup;
|
|
||||||
AndroidUtilities.runOnUIThread(() -> {
|
|
||||||
popupMessages.addAll(0, popupArrayAdd);
|
|
||||||
if (ApplicationLoader.mainInterfacePaused || !ApplicationLoader.isScreenOn) {
|
|
||||||
if (popupFinal == 3 || popupFinal == 1 && ApplicationLoader.isScreenOn || popupFinal == 2 && !ApplicationLoader.isScreenOn) {
|
|
||||||
Intent popupIntent = new Intent(ApplicationLoader.applicationContext, PopupNotificationActivity.class);
|
|
||||||
popupIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_NO_ANIMATION | Intent.FLAG_ACTIVITY_NO_USER_ACTION | Intent.FLAG_FROM_BACKGROUND);
|
|
||||||
try {
|
|
||||||
ApplicationLoader.applicationContext.startActivity(popupIntent);
|
|
||||||
} catch (Throwable ignore) {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
if (isFcm || hasScheduled) {
|
|
||||||
if (edited) {
|
|
||||||
delayedPushMessages.clear();
|
|
||||||
showOrUpdateNotification(notifyCheck);
|
|
||||||
} else if (added) {
|
|
||||||
MessageObject messageObject = messageObjects.get(0);
|
|
||||||
long dialog_id = messageObject.getDialogId();
|
|
||||||
Boolean isChannel;
|
|
||||||
if (messageObject.isFcmMessage()) {
|
|
||||||
isChannel = messageObject.localChannel;
|
|
||||||
} else {
|
|
||||||
isChannel = null;
|
|
||||||
}
|
|
||||||
int old_unread_count = total_unread_count;
|
|
||||||
|
|
||||||
int notifyOverride = getNotifyOverride(preferences, dialog_id);
|
|
||||||
boolean canAddValue;
|
|
||||||
if (notifyOverride == -1) {
|
|
||||||
canAddValue = isGlobalNotificationsEnabled(dialog_id, isChannel);
|
|
||||||
} else {
|
|
||||||
canAddValue = notifyOverride != 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
Integer currentCount = pushDialogs.get(dialog_id);
|
|
||||||
int newCount = currentCount != null ? currentCount + 1 : 1;
|
|
||||||
|
|
||||||
if (notifyCheck && !canAddValue) {
|
|
||||||
Integer override = pushDialogsOverrideMention.get(dialog_id);
|
|
||||||
if (override != null && override != 0) {
|
|
||||||
canAddValue = true;
|
|
||||||
newCount = override;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (canAddValue) {
|
|
||||||
if (currentCount != null) {
|
|
||||||
total_unread_count -= currentCount;
|
|
||||||
}
|
|
||||||
total_unread_count += newCount;
|
|
||||||
pushDialogs.put(dialog_id, newCount);
|
|
||||||
}
|
|
||||||
if (old_unread_count != total_unread_count) {
|
|
||||||
delayedPushMessages.clear();
|
|
||||||
showOrUpdateNotification(notifyCheck);
|
|
||||||
final int pushDialogsCount = pushDialogs.size();
|
|
||||||
AndroidUtilities.runOnUIThread(() -> {
|
|
||||||
NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.notificationsCountUpdated, currentAccount);
|
|
||||||
getNotificationCenter().postNotificationName(NotificationCenter.dialogsUnreadCounterChanged, pushDialogsCount);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
notifyCheck = false;
|
|
||||||
if (showBadgeNumber) {
|
|
||||||
setBadge(getTotalAllUnreadCount());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (countDownLatch != null) {
|
|
||||||
countDownLatch.countDown();
|
|
||||||
}
|
|
||||||
});*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void processNewMessages(final ArrayList<MessageObject> messageObjects, final boolean isLast, final boolean isFcm, CountDownLatch countDownLatch) {
|
public void processNewMessages(final ArrayList<MessageObject> messageObjects, final boolean isLast, final boolean isFcm, CountDownLatch countDownLatch) {
|
||||||
|
@ -1032,20 +869,28 @@ public class NotificationsController extends BaseController {
|
||||||
int old_unread_count = total_unread_count;
|
int old_unread_count = total_unread_count;
|
||||||
SharedPreferences preferences = getAccountInstance().getNotificationsSettings();
|
SharedPreferences preferences = getAccountInstance().getNotificationsSettings();
|
||||||
for (int b = 0; b < dialogsToUpdate.size(); b++) {
|
for (int b = 0; b < dialogsToUpdate.size(); b++) {
|
||||||
long dialog_id = dialogsToUpdate.keyAt(b);
|
long dialogId = dialogsToUpdate.keyAt(b);
|
||||||
|
Integer currentCount = pushDialogs.get(dialogId);
|
||||||
|
Integer newCount = dialogsToUpdate.get(dialogId);
|
||||||
|
|
||||||
int notifyOverride = getNotifyOverride(preferences, dialog_id);
|
int lowerId = (int) dialogId;
|
||||||
|
if (lowerId < 0) {
|
||||||
|
TLRPC.Chat chat = getMessagesController().getChat(-lowerId);
|
||||||
|
if (chat == null || chat.min || ChatObject.isNotInChat(chat)) {
|
||||||
|
newCount = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int notifyOverride = getNotifyOverride(preferences, dialogId);
|
||||||
boolean canAddValue;
|
boolean canAddValue;
|
||||||
if (notifyOverride == -1) {
|
if (notifyOverride == -1) {
|
||||||
canAddValue = isGlobalNotificationsEnabled(dialog_id);
|
canAddValue = isGlobalNotificationsEnabled(dialogId);
|
||||||
} else {
|
} else {
|
||||||
canAddValue = notifyOverride != 2;
|
canAddValue = notifyOverride != 2;
|
||||||
}
|
}
|
||||||
Integer currentCount = pushDialogs.get(dialog_id);
|
|
||||||
Integer newCount = dialogsToUpdate.get(dialog_id);
|
|
||||||
|
|
||||||
if (notifyCheck && !canAddValue) {
|
if (notifyCheck && !canAddValue) {
|
||||||
Integer override = pushDialogsOverrideMention.get(dialog_id);
|
Integer override = pushDialogsOverrideMention.get(dialogId);
|
||||||
if (override != null && override != 0) {
|
if (override != null && override != 0) {
|
||||||
canAddValue = true;
|
canAddValue = true;
|
||||||
newCount = override;
|
newCount = override;
|
||||||
|
@ -1053,7 +898,7 @@ public class NotificationsController extends BaseController {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (newCount == 0) {
|
if (newCount == 0) {
|
||||||
smartNotificationsDialogs.remove(dialog_id);
|
smartNotificationsDialogs.remove(dialogId);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (newCount < 0) {
|
if (newCount < 0) {
|
||||||
|
@ -1068,11 +913,11 @@ public class NotificationsController extends BaseController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (newCount == 0) {
|
if (newCount == 0) {
|
||||||
pushDialogs.remove(dialog_id);
|
pushDialogs.remove(dialogId);
|
||||||
pushDialogsOverrideMention.remove(dialog_id);
|
pushDialogsOverrideMention.remove(dialogId);
|
||||||
for (int a = 0; a < pushMessages.size(); a++) {
|
for (int a = 0; a < pushMessages.size(); a++) {
|
||||||
MessageObject messageObject = pushMessages.get(a);
|
MessageObject messageObject = pushMessages.get(a);
|
||||||
if (!messageObject.messageOwner.from_scheduled && messageObject.getDialogId() == dialog_id) {
|
if (!messageObject.messageOwner.from_scheduled && messageObject.getDialogId() == dialogId) {
|
||||||
if (isPersonalMessage(messageObject)) {
|
if (isPersonalMessage(messageObject)) {
|
||||||
personal_count--;
|
personal_count--;
|
||||||
}
|
}
|
||||||
|
@ -1089,7 +934,7 @@ public class NotificationsController extends BaseController {
|
||||||
}
|
}
|
||||||
} else if (canAddValue) {
|
} else if (canAddValue) {
|
||||||
total_unread_count += newCount;
|
total_unread_count += newCount;
|
||||||
pushDialogs.put(dialog_id, newCount);
|
pushDialogs.put(dialogId, newCount);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!popupArrayToRemove.isEmpty()) {
|
if (!popupArrayToRemove.isEmpty()) {
|
||||||
|
@ -1297,6 +1142,13 @@ public class NotificationsController extends BaseController {
|
||||||
try {
|
try {
|
||||||
for (int i = 0, N = MessagesController.getInstance(a).allDialogs.size(); i < N; i++) {
|
for (int i = 0, N = MessagesController.getInstance(a).allDialogs.size(); i < N; i++) {
|
||||||
TLRPC.Dialog dialog = MessagesController.getInstance(a).allDialogs.get(i);
|
TLRPC.Dialog dialog = MessagesController.getInstance(a).allDialogs.get(i);
|
||||||
|
int lowerId = (int) dialog.id;
|
||||||
|
if (lowerId < 0) {
|
||||||
|
TLRPC.Chat chat = getMessagesController().getChat(-lowerId);
|
||||||
|
if (ChatObject.isNotInChat(chat)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (dialog.unread_count != 0) {
|
if (dialog.unread_count != 0) {
|
||||||
count += dialog.unread_count;
|
count += dialog.unread_count;
|
||||||
}
|
}
|
||||||
|
@ -1312,6 +1164,13 @@ public class NotificationsController extends BaseController {
|
||||||
try {
|
try {
|
||||||
for (int i = 0, N = MessagesController.getInstance(a).allDialogs.size(); i < N; i++) {
|
for (int i = 0, N = MessagesController.getInstance(a).allDialogs.size(); i < N; i++) {
|
||||||
TLRPC.Dialog dialog = MessagesController.getInstance(a).allDialogs.get(i);
|
TLRPC.Dialog dialog = MessagesController.getInstance(a).allDialogs.get(i);
|
||||||
|
int lowerId = (int) dialog.id;
|
||||||
|
if (lowerId < 0) {
|
||||||
|
TLRPC.Chat chat = getMessagesController().getChat(-lowerId);
|
||||||
|
if (ChatObject.isNotInChat(chat)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (dialog.unread_count != 0) {
|
if (dialog.unread_count != 0) {
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
|
|
|
@ -43253,7 +43253,6 @@ public class TLRPC {
|
||||||
public int views;
|
public int views;
|
||||||
public int forwards;
|
public int forwards;
|
||||||
public TL_messageReplies replies;
|
public TL_messageReplies replies;
|
||||||
public ArrayList<Integer> recent_repliers = new ArrayList<>();
|
|
||||||
public int edit_date;
|
public int edit_date;
|
||||||
public boolean silent;
|
public boolean silent;
|
||||||
public boolean post;
|
public boolean post;
|
||||||
|
|
|
@ -276,6 +276,7 @@ public class ActionBarLayout extends FrameLayout {
|
||||||
protected Activity parentActivity;
|
protected Activity parentActivity;
|
||||||
|
|
||||||
public ArrayList<BaseFragment> fragmentsStack;
|
public ArrayList<BaseFragment> fragmentsStack;
|
||||||
|
private Rect rect = new Rect();
|
||||||
|
|
||||||
public ActionBarLayout(Context context) {
|
public ActionBarLayout(Context context) {
|
||||||
super(context);
|
super(context);
|
||||||
|
@ -636,7 +637,7 @@ public class ActionBarLayout extends FrameLayout {
|
||||||
velocityTracker.addMovement(ev);
|
velocityTracker.addMovement(ev);
|
||||||
if (!transitionAnimationInProgress && !inPreviewMode && maybeStartTracking && !startedTracking && dx >= AndroidUtilities.getPixelsInCM(0.4f, true) && Math.abs(dx) / 3 > dy) {
|
if (!transitionAnimationInProgress && !inPreviewMode && maybeStartTracking && !startedTracking && dx >= AndroidUtilities.getPixelsInCM(0.4f, true) && Math.abs(dx) / 3 > dy) {
|
||||||
BaseFragment currentFragment = fragmentsStack.get(fragmentsStack.size() - 1);
|
BaseFragment currentFragment = fragmentsStack.get(fragmentsStack.size() - 1);
|
||||||
if (currentFragment.canBeginSlide()) {
|
if (currentFragment.canBeginSlide() && findScrollingChild(this, ev.getX(), ev.getY()) == null) {
|
||||||
prepareForMoving(ev);
|
prepareForMoving(ev);
|
||||||
} else {
|
} else {
|
||||||
maybeStartTracking = false;
|
maybeStartTracking = false;
|
||||||
|
@ -1832,4 +1833,26 @@ public class ActionBarLayout extends FrameLayout {
|
||||||
containerView.setFragmentPanTranslationOffset(offset);
|
containerView.setFragmentPanTranslationOffset(offset);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private View findScrollingChild(ViewGroup parent, float x, float y) {
|
||||||
|
int n = parent.getChildCount();
|
||||||
|
for (int i = 0; i < n; i++) {
|
||||||
|
View child = parent.getChildAt(i);
|
||||||
|
if (child.getVisibility() != View.VISIBLE) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
child.getHitRect(rect);
|
||||||
|
if (rect.contains((int) x, (int) y)) {
|
||||||
|
if (child.canScrollHorizontally(-1)) {
|
||||||
|
return child;
|
||||||
|
} else if (child instanceof ViewGroup) {
|
||||||
|
View v = findScrollingChild((ViewGroup) child, x - rect.left, y - rect.top);
|
||||||
|
if (v != null) {
|
||||||
|
return v;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -604,7 +604,9 @@ public class ActionBarMenuItem extends FrameLayout {
|
||||||
if (!currentSearchFilters.isEmpty()) {
|
if (!currentSearchFilters.isEmpty()) {
|
||||||
if (listener != null) {
|
if (listener != null) {
|
||||||
for (int i = 0; i < currentSearchFilters.size(); i++) {
|
for (int i = 0; i < currentSearchFilters.size(); i++) {
|
||||||
listener.onSearchFilterCleared(currentSearchFilters.get(i));
|
if ( currentSearchFilters.get(i).removable) {
|
||||||
|
listener.onSearchFilterCleared(currentSearchFilters.get(i));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
clearSearchFilters();
|
clearSearchFilters();
|
||||||
|
@ -636,6 +638,9 @@ public class ActionBarMenuItem extends FrameLayout {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeSearchFilter(FiltersView.MediaFilterData filter) {
|
public void removeSearchFilter(FiltersView.MediaFilterData filter) {
|
||||||
|
if (!filter.removable) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
currentSearchFilters.remove(filter);
|
currentSearchFilters.remove(filter);
|
||||||
if (selectedFilterIndex < 0 || selectedFilterIndex > currentSearchFilters.size() - 1) {
|
if (selectedFilterIndex < 0 || selectedFilterIndex > currentSearchFilters.size() - 1) {
|
||||||
selectedFilterIndex = currentSearchFilters.size() - 1;
|
selectedFilterIndex = currentSearchFilters.size() - 1;
|
||||||
|
@ -650,7 +655,12 @@ public class ActionBarMenuItem extends FrameLayout {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void clearSearchFilters() {
|
public void clearSearchFilters() {
|
||||||
currentSearchFilters.clear();
|
for (int i = 0; i < currentSearchFilters.size(); i++) {
|
||||||
|
if (currentSearchFilters.get(i).removable) {
|
||||||
|
currentSearchFilters.remove(i);
|
||||||
|
i--;
|
||||||
|
}
|
||||||
|
}
|
||||||
onFiltersChanged();
|
onFiltersChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -739,16 +749,19 @@ public class ActionBarMenuItem extends FrameLayout {
|
||||||
if (selectedFilterIndex != index) {
|
if (selectedFilterIndex != index) {
|
||||||
selectedFilterIndex = index;
|
selectedFilterIndex = index;
|
||||||
onFiltersChanged();
|
onFiltersChanged();
|
||||||
} else if (!searchFilterView.selectedForDelete) {
|
return;
|
||||||
searchFilterView.setSelectedForDelete(true);
|
}
|
||||||
} else {
|
if (searchFilterView.getFilter().removable) {
|
||||||
FiltersView.MediaFilterData filterToRemove = searchFilterView.getFilter();
|
if (!searchFilterView.selectedForDelete) {
|
||||||
removeSearchFilter(filterToRemove);
|
searchFilterView.setSelectedForDelete(true);
|
||||||
if (listener != null) {
|
} else {
|
||||||
listener.onSearchFilterCleared(filterToRemove);
|
FiltersView.MediaFilterData filterToRemove = searchFilterView.getFilter();
|
||||||
listener.onTextChanged(searchField);
|
removeSearchFilter(filterToRemove);
|
||||||
|
if (listener != null) {
|
||||||
|
listener.onSearchFilterCleared(filterToRemove);
|
||||||
|
listener.onTextChanged(searchField);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
searchFilterLayout.addView(searchFilterView, LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT, LayoutHelper.MATCH_PARENT, 0, 0, 0, 6, 0));
|
searchFilterLayout.addView(searchFilterView, LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT, LayoutHelper.MATCH_PARENT, 0, 0, 0, 6, 0));
|
||||||
|
@ -1013,8 +1026,8 @@ public class ActionBarMenuItem extends FrameLayout {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
||||||
if (keyCode == KeyEvent.KEYCODE_DEL && searchField.length() == 0 && ((searchFieldCaption.getVisibility() == VISIBLE && searchFieldCaption.length() > 0) || !currentSearchFilters.isEmpty())) {
|
if (keyCode == KeyEvent.KEYCODE_DEL && searchField.length() == 0 && ((searchFieldCaption.getVisibility() == VISIBLE && searchFieldCaption.length() > 0) || hasRemovableFilters())) {
|
||||||
if (!currentSearchFilters.isEmpty()) {
|
if (hasRemovableFilters()) {
|
||||||
FiltersView.MediaFilterData filterToRemove = currentSearchFilters.get(currentSearchFilters.size() - 1);
|
FiltersView.MediaFilterData filterToRemove = currentSearchFilters.get(currentSearchFilters.size() - 1);
|
||||||
if (listener != null) {
|
if (listener != null) {
|
||||||
listener.onSearchFilterCleared(filterToRemove);
|
listener.onSearchFilterCleared(filterToRemove);
|
||||||
|
@ -1143,10 +1156,10 @@ public class ActionBarMenuItem extends FrameLayout {
|
||||||
clearButton.setOnClickListener(v -> {
|
clearButton.setOnClickListener(v -> {
|
||||||
if (searchField.length() != 0) {
|
if (searchField.length() != 0) {
|
||||||
searchField.setText("");
|
searchField.setText("");
|
||||||
} else if (!currentSearchFilters.isEmpty()) {
|
} else if (hasRemovableFilters()) {
|
||||||
searchField.hideActionMode();
|
searchField.hideActionMode();
|
||||||
for (int i = 0; i < currentSearchFilters.size(); i++) {
|
for (int i = 0; i < currentSearchFilters.size(); i++) {
|
||||||
if (listener != null) {
|
if (listener != null && currentSearchFilters.get(i).removable) {
|
||||||
listener.onSearchFilterCleared(currentSearchFilters.get(i));
|
listener.onSearchFilterCleared(currentSearchFilters.get(i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1173,7 +1186,7 @@ public class ActionBarMenuItem extends FrameLayout {
|
||||||
|
|
||||||
private void checkClearButton() {
|
private void checkClearButton() {
|
||||||
if (clearButton != null) {
|
if (clearButton != null) {
|
||||||
if (currentSearchFilters.isEmpty() && TextUtils.isEmpty(searchField.getText()) &&
|
if (!hasRemovableFilters() && TextUtils.isEmpty(searchField.getText()) &&
|
||||||
(listener == null || !listener.forceShowClear()) &&
|
(listener == null || !listener.forceShowClear()) &&
|
||||||
(searchFieldCaption == null || searchFieldCaption.getVisibility() != VISIBLE)) {
|
(searchFieldCaption == null || searchFieldCaption.getVisibility() != VISIBLE)) {
|
||||||
if (clearButton.getTag() != null) {
|
if (clearButton.getTag() != null) {
|
||||||
|
@ -1209,6 +1222,18 @@ public class ActionBarMenuItem extends FrameLayout {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean hasRemovableFilters() {
|
||||||
|
if (currentSearchFilters.isEmpty()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
for (int i = 0; i < currentSearchFilters.size(); i++) {
|
||||||
|
if (currentSearchFilters.get(i).removable) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
public void setShowSearchProgress(boolean show) {
|
public void setShowSearchProgress(boolean show) {
|
||||||
if (progressDrawable == null) {
|
if (progressDrawable == null) {
|
||||||
return;
|
return;
|
||||||
|
@ -1417,6 +1442,11 @@ public class ActionBarMenuItem extends FrameLayout {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void collapseSearchFilters() {
|
||||||
|
selectedFilterIndex = -1;
|
||||||
|
onFiltersChanged();
|
||||||
|
}
|
||||||
|
|
||||||
private static class SearchFilterView extends FrameLayout {
|
private static class SearchFilterView extends FrameLayout {
|
||||||
|
|
||||||
Drawable thumbDrawable;
|
Drawable thumbDrawable;
|
||||||
|
@ -1474,6 +1504,10 @@ public class ActionBarMenuItem extends FrameLayout {
|
||||||
Theme.setCombinedDrawableColor(thumbDrawable, Theme.getColor(Theme.key_avatar_actionBarIconBlue), true);
|
Theme.setCombinedDrawableColor(thumbDrawable, Theme.getColor(Theme.key_avatar_actionBarIconBlue), true);
|
||||||
}
|
}
|
||||||
avatarImageView.setAlpha(1f - selectedProgress);
|
avatarImageView.setAlpha(1f - selectedProgress);
|
||||||
|
|
||||||
|
if (data != null && (data.filterType == FiltersView.FILTER_TYPE_ARCHIVE)) {
|
||||||
|
setData(data);
|
||||||
|
}
|
||||||
invalidate();
|
invalidate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1501,6 +1535,12 @@ public class ActionBarMenuItem extends FrameLayout {
|
||||||
avatarImageView.getImageReceiver().setRoundRadius(AndroidUtilities.dp(16));
|
avatarImageView.getImageReceiver().setRoundRadius(AndroidUtilities.dp(16));
|
||||||
avatarImageView.getImageReceiver().setImage(ImageLocation.getForChat(chat, false), "50_50",thumbDrawable, null, chat, 0);
|
avatarImageView.getImageReceiver().setImage(ImageLocation.getForChat(chat, false), "50_50",thumbDrawable, null, chat, 0);
|
||||||
}
|
}
|
||||||
|
} else if (data.filterType == FiltersView.FILTER_TYPE_ARCHIVE) {
|
||||||
|
CombinedDrawable combinedDrawable = Theme.createCircleDrawableWithIcon(AndroidUtilities.dp(32), R.drawable.chats_archive);
|
||||||
|
combinedDrawable.setIconSize(AndroidUtilities.dp(16), AndroidUtilities.dp(16));
|
||||||
|
Theme.setCombinedDrawableColor(combinedDrawable, Theme.getColor(Theme.key_avatar_backgroundArchived), false);
|
||||||
|
Theme.setCombinedDrawableColor(combinedDrawable, Theme.getColor(Theme.key_avatar_actionBarIconBlue), true);
|
||||||
|
avatarImageView.setImageDrawable(combinedDrawable);
|
||||||
} else {
|
} else {
|
||||||
avatarImageView.setImageDrawable(thumbDrawable);
|
avatarImageView.setImageDrawable(thumbDrawable);
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,7 @@ import android.widget.FrameLayout;
|
||||||
|
|
||||||
import com.google.android.exoplayer2.util.Log;
|
import com.google.android.exoplayer2.util.Log;
|
||||||
|
|
||||||
|
import org.telegram.messenger.AndroidUtilities;
|
||||||
import org.telegram.messenger.NotificationCenter;
|
import org.telegram.messenger.NotificationCenter;
|
||||||
import org.telegram.messenger.SharedConfig;
|
import org.telegram.messenger.SharedConfig;
|
||||||
import org.telegram.messenger.UserConfig;
|
import org.telegram.messenger.UserConfig;
|
||||||
|
@ -65,7 +66,7 @@ public class AdjustPanLayoutHelper {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!heightAnimationEnabled()) {
|
if (!heightAnimationEnabled() || Math.abs(previousHeight - contentHeight) < AndroidUtilities.dp(20)) {
|
||||||
previousHeight = contentHeight;
|
previousHeight = contentHeight;
|
||||||
previousContentHeight = contentView.getHeight();
|
previousContentHeight = contentView.getHeight();
|
||||||
previousStartOffset = startOffset();
|
previousStartOffset = startOffset();
|
||||||
|
|
|
@ -63,6 +63,7 @@ public class FiltersView extends RecyclerListView {
|
||||||
public final static int FILTER_TYPE_CHAT = 4;
|
public final static int FILTER_TYPE_CHAT = 4;
|
||||||
public final static int FILTER_TYPE_VOICE = 5;
|
public final static int FILTER_TYPE_VOICE = 5;
|
||||||
public final static int FILTER_TYPE_DATE = 6;
|
public final static int FILTER_TYPE_DATE = 6;
|
||||||
|
public final static int FILTER_TYPE_ARCHIVE = 7;
|
||||||
|
|
||||||
public final static MediaFilterData[] filters = new MediaFilterData[]{
|
public final static MediaFilterData[] filters = new MediaFilterData[]{
|
||||||
new MediaFilterData(R.drawable.search_media, R.drawable.search_media_filled, LocaleController.getString("SharedMediaTab2", R.string.SharedMediaTab2), new TLRPC.TL_inputMessagesFilterPhotoVideo(), FILTER_TYPE_MEDIA),
|
new MediaFilterData(R.drawable.search_media, R.drawable.search_media_filled, LocaleController.getString("SharedMediaTab2", R.string.SharedMediaTab2), new TLRPC.TL_inputMessagesFilterPhotoVideo(), FILTER_TYPE_MEDIA),
|
||||||
|
@ -260,9 +261,8 @@ public class FiltersView extends RecyclerListView {
|
||||||
private final static Pattern monthYearOrDayPatter = Pattern.compile("(\\w{3,}) ([0-9]{0,4})");
|
private final static Pattern monthYearOrDayPatter = Pattern.compile("(\\w{3,}) ([0-9]{0,4})");
|
||||||
private final static Pattern yearOrDayAndMonthPatter = Pattern.compile("([0-9]{0,4}) (\\w{2,})");
|
private final static Pattern yearOrDayAndMonthPatter = Pattern.compile("([0-9]{0,4}) (\\w{2,})");
|
||||||
|
|
||||||
|
private final static Pattern shortDate = Pattern.compile("^([0-9]{1,4})(\\.| |/|\\-)([0-9]{1,4})$");
|
||||||
private final static Pattern shortDate = Pattern.compile("^([0-9]{1,4})(\\.| |\\\\)([0-9]{1,4})$");
|
private final static Pattern longDate = Pattern.compile("^([0-9]{1,2})(\\.| |/|\\-)([0-9]{1,2})(\\.| |/|\\-)([0-9]{1,4})$");
|
||||||
private final static Pattern longDate = Pattern.compile("^([0-9]{1,2})(\\.| |\\\\)([0-9]{1,2})(\\.| |\\\\)([0-9]{1,4})$");
|
|
||||||
|
|
||||||
|
|
||||||
private final static int[] numberOfDaysEachMonth = new int[]{31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
|
private final static int[] numberOfDaysEachMonth = new int[]{31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
|
||||||
|
@ -356,6 +356,9 @@ public class FiltersView extends RecyclerListView {
|
||||||
int day = Integer.parseInt(g1);
|
int day = Integer.parseInt(g1);
|
||||||
int month = Integer.parseInt(g2) - 1;
|
int month = Integer.parseInt(g2) - 1;
|
||||||
int year = Integer.parseInt(g3);
|
int year = Integer.parseInt(g3);
|
||||||
|
if (year >= 10 && year <= 99) {
|
||||||
|
year += 2000;
|
||||||
|
}
|
||||||
int currentYear = Calendar.getInstance().get(Calendar.YEAR);
|
int currentYear = Calendar.getInstance().get(Calendar.YEAR);
|
||||||
if (validDateForMont(day - 1, month) && year >= minYear && year <= currentYear) {
|
if (validDateForMont(day - 1, month) && year >= minYear && year <= currentYear) {
|
||||||
Calendar calendar = Calendar.getInstance();
|
Calendar calendar = Calendar.getInstance();
|
||||||
|
@ -751,6 +754,7 @@ public class FiltersView extends RecyclerListView {
|
||||||
public final TLRPC.MessagesFilter filter;
|
public final TLRPC.MessagesFilter filter;
|
||||||
public TLObject chat;
|
public TLObject chat;
|
||||||
public DateData dateData;
|
public DateData dateData;
|
||||||
|
public boolean removable = true;
|
||||||
|
|
||||||
public MediaFilterData(int iconRes, int iconResFilled, String title, TLRPC.MessagesFilter filter, int filterType) {
|
public MediaFilterData(int iconRes, int iconResFilled, String title, TLRPC.MessagesFilter filter, int filterType) {
|
||||||
this.iconRes = iconRes;
|
this.iconRes = iconRes;
|
||||||
|
|
|
@ -653,9 +653,11 @@ public class ArticleViewer implements NotificationCenter.NotificationCenterDeleg
|
||||||
WindowInsets oldInsets = (WindowInsets) lastInsets;
|
WindowInsets oldInsets = (WindowInsets) lastInsets;
|
||||||
lastInsets = insets;
|
lastInsets = insets;
|
||||||
if (oldInsets == null || !oldInsets.toString().equals(insets.toString())) {
|
if (oldInsets == null || !oldInsets.toString().equals(insets.toString())) {
|
||||||
windowView.requestLayout();
|
if (windowView != null) {
|
||||||
|
windowView.requestLayout();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (Build.VERSION.SDK_INT >= 28) {
|
if (Build.VERSION.SDK_INT >= 28 && parentActivity != null) {
|
||||||
DisplayCutout cutout = parentActivity.getWindow().getDecorView().getRootWindowInsets().getDisplayCutout();
|
DisplayCutout cutout = parentActivity.getWindow().getDecorView().getRootWindowInsets().getDisplayCutout();
|
||||||
if (cutout != null) {
|
if (cutout != null) {
|
||||||
List<Rect> rects = cutout.getBoundingRects();
|
List<Rect> rects = cutout.getBoundingRects();
|
||||||
|
|
|
@ -2550,6 +2550,27 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private int getRepliesCount() {
|
||||||
|
if (currentMessagesGroup != null && !currentMessagesGroup.messages.isEmpty()) {
|
||||||
|
MessageObject messageObject = currentMessagesGroup.messages.get(0);
|
||||||
|
return messageObject.getRepliesCount();
|
||||||
|
}
|
||||||
|
return currentMessageObject.getRepliesCount();
|
||||||
|
}
|
||||||
|
|
||||||
|
private ArrayList<TLRPC.Peer> getRecentRepliers() {
|
||||||
|
if (currentMessagesGroup != null && !currentMessagesGroup.messages.isEmpty()) {
|
||||||
|
MessageObject messageObject = currentMessagesGroup.messages.get(0);
|
||||||
|
if (messageObject.messageOwner.replies != null) {
|
||||||
|
return messageObject.messageOwner.replies.recent_repliers;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (currentMessageObject.messageOwner.replies != null) {
|
||||||
|
return currentMessageObject.messageOwner.replies.recent_repliers;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
private boolean isUserDataChanged() {
|
private boolean isUserDataChanged() {
|
||||||
if (currentMessageObject != null && (!hasLinkPreview && currentMessageObject.messageOwner.media != null && currentMessageObject.messageOwner.media.webpage instanceof TLRPC.TL_webPage)) {
|
if (currentMessageObject != null && (!hasLinkPreview && currentMessageObject.messageOwner.media != null && currentMessageObject.messageOwner.media.webpage instanceof TLRPC.TL_webPage)) {
|
||||||
return true;
|
return true;
|
||||||
|
@ -2566,7 +2587,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||||
if (lastViewsCount != currentMessageObject.messageOwner.views) {
|
if (lastViewsCount != currentMessageObject.messageOwner.views) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (lastRepliesCount != currentMessageObject.getRepliesCount()) {
|
if (lastRepliesCount != getRepliesCount()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (lastReactions != currentMessageObject.messageOwner.reactions) {
|
if (lastReactions != currentMessageObject.messageOwner.reactions) {
|
||||||
|
@ -2848,7 +2869,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||||
lastSendState = messageObject.messageOwner.send_state;
|
lastSendState = messageObject.messageOwner.send_state;
|
||||||
lastDeleteDate = messageObject.messageOwner.destroyTime;
|
lastDeleteDate = messageObject.messageOwner.destroyTime;
|
||||||
lastViewsCount = messageObject.messageOwner.views;
|
lastViewsCount = messageObject.messageOwner.views;
|
||||||
lastRepliesCount = messageObject.getRepliesCount();
|
lastRepliesCount = getRepliesCount();
|
||||||
isPressed = false;
|
isPressed = false;
|
||||||
gamePreviewPressed = false;
|
gamePreviewPressed = false;
|
||||||
sideButtonPressed = false;
|
sideButtonPressed = false;
|
||||||
|
@ -3002,7 +3023,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||||
linked = messageObject.isLinkedToChat(linkedChatId);
|
linked = messageObject.isLinkedToChat(linkedChatId);
|
||||||
}
|
}
|
||||||
if ((hasDiscussion && linked || isRepliesChat && !messageObject.isOutOwner()) && (currentPosition == null || (currentPosition.flags & MessageObject.POSITION_FLAG_BOTTOM) != 0)) {
|
if ((hasDiscussion && linked || isRepliesChat && !messageObject.isOutOwner()) && (currentPosition == null || (currentPosition.flags & MessageObject.POSITION_FLAG_BOTTOM) != 0)) {
|
||||||
int commentCount = messageObject.getRepliesCount();
|
int commentCount = getRepliesCount();
|
||||||
if (!messageObject.shouldDrawWithoutBackground() && !messageObject.isAnimatedEmoji()) {
|
if (!messageObject.shouldDrawWithoutBackground() && !messageObject.isAnimatedEmoji()) {
|
||||||
drawCommentButton = true;
|
drawCommentButton = true;
|
||||||
int avatarsOffset = 0;
|
int avatarsOffset = 0;
|
||||||
|
@ -3014,13 +3035,14 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||||
comment = LocaleController.getString("ViewInChat", R.string.ViewInChat);
|
comment = LocaleController.getString("ViewInChat", R.string.ViewInChat);
|
||||||
} else {
|
} else {
|
||||||
comment = commentCount == 0 ? LocaleController.getString("LeaveAComment", R.string.LeaveAComment) : LocaleController.formatPluralString("CommentsCount", commentCount);
|
comment = commentCount == 0 ? LocaleController.getString("LeaveAComment", R.string.LeaveAComment) : LocaleController.formatPluralString("CommentsCount", commentCount);
|
||||||
if (commentCount != 0 && !messageObject.messageOwner.replies.recent_repliers.isEmpty()) {
|
ArrayList<TLRPC.Peer> recentRepliers = getRecentRepliers();
|
||||||
|
if (commentCount != 0 && recentRepliers != null && !recentRepliers.isEmpty()) {
|
||||||
createCommentUI();
|
createCommentUI();
|
||||||
int size = messageObject.messageOwner.replies.recent_repliers.size();
|
int size = recentRepliers.size();
|
||||||
for (int a = 0; a < commentAvatarImages.length; a++) {
|
for (int a = 0; a < commentAvatarImages.length; a++) {
|
||||||
if (a < size) {
|
if (a < size) {
|
||||||
commentAvatarImages[a].setImageCoords(0, 0, AndroidUtilities.dp(24), AndroidUtilities.dp(24));
|
commentAvatarImages[a].setImageCoords(0, 0, AndroidUtilities.dp(24), AndroidUtilities.dp(24));
|
||||||
int id = MessageObject.getPeerId(messageObject.messageOwner.replies.recent_repliers.get(a));
|
int id = MessageObject.getPeerId(recentRepliers.get(a));
|
||||||
TLRPC.User user = null;
|
TLRPC.User user = null;
|
||||||
TLRPC.Chat chat = null;
|
TLRPC.Chat chat = null;
|
||||||
if (id > 0) {
|
if (id > 0) {
|
||||||
|
@ -8676,7 +8698,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||||
timeWidth += viewsTextWidth + Theme.chat_msgInViewsDrawable.getIntrinsicWidth() + AndroidUtilities.dp(10);
|
timeWidth += viewsTextWidth + Theme.chat_msgInViewsDrawable.getIntrinsicWidth() + AndroidUtilities.dp(10);
|
||||||
}
|
}
|
||||||
if (hasLinkedChat && isChat && isMegagroup && !isThreadChat && messageObject.hasReplies()) {
|
if (hasLinkedChat && isChat && isMegagroup && !isThreadChat && messageObject.hasReplies()) {
|
||||||
currentRepliesString = String.format("%s", LocaleController.formatShortNumber(messageObject.getRepliesCount(), null));
|
currentRepliesString = String.format("%s", LocaleController.formatShortNumber(getRepliesCount(), null));
|
||||||
repliesTextWidth = (int) Math.ceil(Theme.chat_timePaint.measureText(currentRepliesString));
|
repliesTextWidth = (int) Math.ceil(Theme.chat_timePaint.measureText(currentRepliesString));
|
||||||
timeWidth += repliesTextWidth + Theme.chat_msgInRepliesDrawable.getIntrinsicWidth() + AndroidUtilities.dp(10);
|
timeWidth += repliesTextWidth + Theme.chat_msgInRepliesDrawable.getIntrinsicWidth() + AndroidUtilities.dp(10);
|
||||||
} else {
|
} else {
|
||||||
|
@ -10314,7 +10336,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||||
}
|
}
|
||||||
|
|
||||||
private void drawCaptionLayout(Canvas canvas, StaticLayout captionLayout, boolean selectionOnly, float alpha) {
|
private void drawCaptionLayout(Canvas canvas, StaticLayout captionLayout, boolean selectionOnly, float alpha) {
|
||||||
if (currentBackgroundDrawable != null && drawCommentButton) {
|
if (currentBackgroundDrawable != null && drawCommentButton && timeLayout != null) {
|
||||||
int x;
|
int x;
|
||||||
float y = layoutHeight - AndroidUtilities.dp(18) - timeLayout.getHeight();
|
float y = layoutHeight - AndroidUtilities.dp(18) - timeLayout.getHeight();
|
||||||
if (mediaBackground) {
|
if (mediaBackground) {
|
||||||
|
@ -12569,7 +12591,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||||
}
|
}
|
||||||
|
|
||||||
if (commentLayout != null) {
|
if (commentLayout != null) {
|
||||||
lastCommentsCount = currentMessageObject.getRepliesCount();
|
lastCommentsCount = getRepliesCount();
|
||||||
lastTotalCommentWidth = totalCommentWidth;
|
lastTotalCommentWidth = totalCommentWidth;
|
||||||
lastCommentLayout = commentLayout;
|
lastCommentLayout = commentLayout;
|
||||||
lastCommentArrowX = commentArrowX;
|
lastCommentArrowX = commentArrowX;
|
||||||
|
@ -12577,7 +12599,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||||
lastCommentDrawUnread = commentDrawUnread;
|
lastCommentDrawUnread = commentDrawUnread;
|
||||||
}
|
}
|
||||||
if (repliesLayout != null) {
|
if (repliesLayout != null) {
|
||||||
lastRepliesCount = currentMessageObject.getRepliesCount();
|
lastRepliesCount = getRepliesCount();
|
||||||
lastRepliesLayout = repliesLayout;
|
lastRepliesLayout = repliesLayout;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12646,13 +12668,13 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (repliesLayout != null && lastRepliesCount != currentMessageObject.getRepliesCount()) {
|
if (repliesLayout != null && lastRepliesCount != getRepliesCount()) {
|
||||||
animateRepliesLayout = lastRepliesLayout;
|
animateRepliesLayout = lastRepliesLayout;
|
||||||
animateReplies = true;
|
animateReplies = true;
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (commentLayout != null && lastCommentsCount != currentMessageObject.getRepliesCount()) {
|
if (commentLayout != null && lastCommentsCount != getRepliesCount()) {
|
||||||
animateCommentsLayout = lastCommentLayout;
|
animateCommentsLayout = lastCommentLayout;
|
||||||
animateTotalCommentWidth = lastTotalCommentWidth;
|
animateTotalCommentWidth = lastTotalCommentWidth;
|
||||||
animateCommentArrowX = lastCommentArrowX;
|
animateCommentArrowX = lastCommentArrowX;
|
||||||
|
|
|
@ -950,7 +950,7 @@ public class DialogCell extends BaseCell {
|
||||||
} else if (message.messageOwner.message != null) {
|
} else if (message.messageOwner.message != null) {
|
||||||
String mess = message.messageOwner.message;
|
String mess = message.messageOwner.message;
|
||||||
if (message.hasHighlightedWords()) {
|
if (message.hasHighlightedWords()) {
|
||||||
mess = mess.replace('\n', ' ').trim();
|
mess = mess.replace('\n', ' ').replaceAll(" +", " ").trim();
|
||||||
int w = getMeasuredWidth() - AndroidUtilities.dp(72 + 23 + 10);
|
int w = getMeasuredWidth() - AndroidUtilities.dp(72 + 23 + 10);
|
||||||
if (hasNameInMessage) {
|
if (hasNameInMessage) {
|
||||||
if (!TextUtils.isEmpty(messageNameString)) {
|
if (!TextUtils.isEmpty(messageNameString)) {
|
||||||
|
@ -1016,8 +1016,8 @@ public class DialogCell extends BaseCell {
|
||||||
} else {
|
} else {
|
||||||
emoji = "\uD83D\uDCCE ";
|
emoji = "\uD83D\uDCCE ";
|
||||||
}
|
}
|
||||||
if (message.hasHighlightedWords()) {
|
if (message.hasHighlightedWords() && !TextUtils.isEmpty(message.messageOwner.message)) {
|
||||||
String str = message.messageOwner.message.replace('\n', ' ').trim();
|
String str = message.messageOwner.message.replace('\n', ' ').replaceAll(" +", " ").trim();
|
||||||
int w = getMeasuredWidth() - AndroidUtilities.dp(72 + 23 + 24);
|
int w = getMeasuredWidth() - AndroidUtilities.dp(72 + 23 + 24);
|
||||||
if (hasNameInMessage) {
|
if (hasNameInMessage) {
|
||||||
if (!TextUtils.isEmpty(messageNameString)) {
|
if (!TextUtils.isEmpty(messageNameString)) {
|
||||||
|
@ -1041,22 +1041,22 @@ public class DialogCell extends BaseCell {
|
||||||
} else if (message.type == 14) {
|
} else if (message.type == 14) {
|
||||||
messageString = String.format("\uD83C\uDFA7 %s - %s", message.getMusicAuthor(), message.getMusicTitle());
|
messageString = String.format("\uD83C\uDFA7 %s - %s", message.getMusicAuthor(), message.getMusicTitle());
|
||||||
} else {
|
} else {
|
||||||
if (message.hasHighlightedWords()){
|
if (message.hasHighlightedWords() && !TextUtils.isEmpty(message.messageOwner.message)){
|
||||||
messageString = message.messageOwner.message.replace('\n', ' ').trim();
|
messageString = message.messageOwner.message.replace('\n', ' ').trim();
|
||||||
int w = getMeasuredWidth() - AndroidUtilities.dp(72 + 23 );
|
int w = getMeasuredWidth() - AndroidUtilities.dp(72 + 23 );
|
||||||
messageString = AndroidUtilities.ellipsizeCenterEnd(messageString, message.highlightedWords.get(0), w, currentMessagePaint).toString();
|
messageString = AndroidUtilities.ellipsizeCenterEnd(messageString, message.highlightedWords.get(0), w, currentMessagePaint).toString();
|
||||||
AndroidUtilities.highlightText(messageString, message.highlightedWords);
|
|
||||||
} else {
|
} else {
|
||||||
messageString = message.messageText;
|
messageString = message.messageText;
|
||||||
}
|
}
|
||||||
|
AndroidUtilities.highlightText(messageString, message.highlightedWords);
|
||||||
}
|
}
|
||||||
if (message.messageOwner.media != null && !message.isMediaEmpty()) {
|
if (message.messageOwner.media != null && !message.isMediaEmpty()) {
|
||||||
currentMessagePaint = Theme.dialogs_messagePrintingPaint[paintIndex];
|
currentMessagePaint = Theme.dialogs_messagePrintingPaint[paintIndex];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (hasMessageThumb) {
|
if (hasMessageThumb) {
|
||||||
if (message.hasHighlightedWords()) {
|
if (message.hasHighlightedWords() && !TextUtils.isEmpty(message.messageOwner.message)) {
|
||||||
messageString = message.messageOwner.message.replace('\n', ' ').trim();
|
messageString = message.messageOwner.message.replace('\n', ' ').replaceAll(" +", " ").trim();
|
||||||
int w = getMeasuredWidth() - AndroidUtilities.dp(72 + 23 + thumbSize + 6);
|
int w = getMeasuredWidth() - AndroidUtilities.dp(72 + 23 + thumbSize + 6);
|
||||||
messageString = AndroidUtilities.ellipsizeCenterEnd(messageString, message.highlightedWords.get(0), w, currentMessagePaint).toString();
|
messageString = AndroidUtilities.ellipsizeCenterEnd(messageString, message.highlightedWords.get(0), w, currentMessagePaint).toString();
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -172,7 +172,7 @@ public class SharedAudioCell extends FrameLayout implements DownloadController.F
|
||||||
}
|
}
|
||||||
|
|
||||||
if (currentMessageObject.hasHighlightedWords()) {
|
if (currentMessageObject.hasHighlightedWords()) {
|
||||||
CharSequence caption = Emoji.replaceEmoji(currentMessageObject.messageOwner.message.replace("\n", " ").trim(), Theme.chat_msgTextPaint.getFontMetricsInt(), AndroidUtilities.dp(20), false);
|
CharSequence caption = Emoji.replaceEmoji(currentMessageObject.messageOwner.message.replace("\n", " ").replaceAll(" +", " ").trim(), Theme.chat_msgTextPaint.getFontMetricsInt(), AndroidUtilities.dp(20), false);
|
||||||
CharSequence sequence = AndroidUtilities.highlightText(caption, currentMessageObject.highlightedWords);
|
CharSequence sequence = AndroidUtilities.highlightText(caption, currentMessageObject.highlightedWords);
|
||||||
if (sequence != null) {
|
if (sequence != null) {
|
||||||
sequence = TextUtils.ellipsize(AndroidUtilities.ellipsizeCenterEnd(sequence, currentMessageObject.highlightedWords.get(0), maxWidth, captionTextPaint), captionTextPaint, maxWidth, TextUtils.TruncateAt.END);
|
sequence = TextUtils.ellipsize(AndroidUtilities.ellipsizeCenterEnd(sequence, currentMessageObject.highlightedWords.get(0), maxWidth, captionTextPaint), captionTextPaint, maxWidth, TextUtils.TruncateAt.END);
|
||||||
|
|
|
@ -435,7 +435,7 @@ public class SharedDocumentCell extends FrameLayout implements DownloadControlle
|
||||||
}
|
}
|
||||||
|
|
||||||
if (messageObject.hasHighlightedWords() && !TextUtils.isEmpty(message.messageOwner.message)) {
|
if (messageObject.hasHighlightedWords() && !TextUtils.isEmpty(message.messageOwner.message)) {
|
||||||
String str = message.messageOwner.message.replace("\n", " ").trim();
|
String str = message.messageOwner.message.replace("\n", " ").replaceAll(" +", " ").trim();
|
||||||
caption = AndroidUtilities.highlightText(str, message.highlightedWords);
|
caption = AndroidUtilities.highlightText(str, message.highlightedWords);
|
||||||
if (captionTextView != null) {
|
if (captionTextView != null) {
|
||||||
captionTextView.setVisibility(caption == null ? View.GONE : View.VISIBLE);
|
captionTextView.setVisibility(caption == null ? View.GONE : View.VISIBLE);
|
||||||
|
|
|
@ -349,7 +349,7 @@ public class SharedLinkCell extends FrameLayout {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (message != null && !TextUtils.isEmpty(message.messageOwner.message)) {
|
if (message != null && !TextUtils.isEmpty(message.messageOwner.message)) {
|
||||||
CharSequence caption = Emoji.replaceEmoji(message.messageOwner.message.replace("\n", " ").trim(), Theme.chat_msgTextPaint.getFontMetricsInt(), AndroidUtilities.dp(20), false);
|
CharSequence caption = Emoji.replaceEmoji(message.messageOwner.message.replace("\n", " ").replaceAll(" +", " ").trim(), Theme.chat_msgTextPaint.getFontMetricsInt(), AndroidUtilities.dp(20), false);
|
||||||
CharSequence sequence = AndroidUtilities.highlightText(caption, message.highlightedWords);
|
CharSequence sequence = AndroidUtilities.highlightText(caption, message.highlightedWords);
|
||||||
if (sequence != null) {
|
if (sequence != null) {
|
||||||
sequence = TextUtils.ellipsize(AndroidUtilities.ellipsizeCenterEnd(sequence, message.highlightedWords.get(0), maxWidth, captionTextPaint), captionTextPaint, maxWidth, TextUtils.TruncateAt.END);
|
sequence = TextUtils.ellipsize(AndroidUtilities.ellipsizeCenterEnd(sequence, message.highlightedWords.get(0), maxWidth, captionTextPaint), captionTextPaint, maxWidth, TextUtils.TruncateAt.END);
|
||||||
|
|
|
@ -378,6 +378,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
private int threadMaxInboxReadId;
|
private int threadMaxInboxReadId;
|
||||||
private int threadMaxOutboxReadId;
|
private int threadMaxOutboxReadId;
|
||||||
private int replyMaxReadId = 0;
|
private int replyMaxReadId = 0;
|
||||||
|
private Runnable delayedReadRunnable;
|
||||||
|
|
||||||
private ArrayList<MessageObject> animatingMessageObjects = new ArrayList<>();
|
private ArrayList<MessageObject> animatingMessageObjects = new ArrayList<>();
|
||||||
private HashMap<TLRPC.Document, Integer> animatingDocuments = new HashMap<>();
|
private HashMap<TLRPC.Document, Integer> animatingDocuments = new HashMap<>();
|
||||||
|
@ -1209,10 +1210,10 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
getNotificationCenter().addObserver(this, NotificationCenter.pinnedMessageDidLoad);
|
getNotificationCenter().addObserver(this, NotificationCenter.pinnedMessageDidLoad);
|
||||||
getNotificationCenter().addObserver(this, NotificationCenter.commentsRead);
|
getNotificationCenter().addObserver(this, NotificationCenter.commentsRead);
|
||||||
getNotificationCenter().addObserver(this, NotificationCenter.changeRepliesCounter);
|
getNotificationCenter().addObserver(this, NotificationCenter.changeRepliesCounter);
|
||||||
|
getNotificationCenter().addObserver(this, NotificationCenter.messagesRead);
|
||||||
} else {
|
} else {
|
||||||
getNotificationCenter().addObserver(this, NotificationCenter.threadMessagesRead);
|
getNotificationCenter().addObserver(this, NotificationCenter.threadMessagesRead);
|
||||||
}
|
}
|
||||||
getNotificationCenter().addObserver(this, NotificationCenter.messagesRead);
|
|
||||||
getNotificationCenter().addObserver(this, NotificationCenter.removeAllMessagesFromDialog);
|
getNotificationCenter().addObserver(this, NotificationCenter.removeAllMessagesFromDialog);
|
||||||
getNotificationCenter().addObserver(this, NotificationCenter.messagesReadContent);
|
getNotificationCenter().addObserver(this, NotificationCenter.messagesReadContent);
|
||||||
getNotificationCenter().addObserver(this, NotificationCenter.chatSearchResultsAvailable);
|
getNotificationCenter().addObserver(this, NotificationCenter.chatSearchResultsAvailable);
|
||||||
|
@ -3972,11 +3973,15 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onLayoutChildren(RecyclerView.Recycler recycler, RecyclerView.State state) {
|
public void onLayoutChildren(RecyclerView.Recycler recycler, RecyclerView.State state) {
|
||||||
try {
|
if (BuildVars.DEBUG_PRIVATE_VERSION) {
|
||||||
super.onLayoutChildren(recycler, state);
|
super.onLayoutChildren(recycler, state);
|
||||||
} catch (Exception e) {
|
} else {
|
||||||
FileLog.e(e);
|
try {
|
||||||
AndroidUtilities.runOnUIThread(() -> chatAdapter.notifyDataSetChanged(false));
|
super.onLayoutChildren(recycler, state);
|
||||||
|
} catch (Exception e) {
|
||||||
|
FileLog.e(e);
|
||||||
|
AndroidUtilities.runOnUIThread(() -> chatAdapter.notifyDataSetChanged(false));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -11968,9 +11973,16 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
if (obj != null && obj.hasReplies()) {
|
if (obj != null && obj.hasReplies()) {
|
||||||
int maxReadId = (Integer) args[2];
|
int maxReadId = (Integer) args[2];
|
||||||
if (paused) {
|
if (paused) {
|
||||||
|
if (delayedReadRunnable != null) {
|
||||||
|
AndroidUtilities.cancelRunOnUIThread(delayedReadRunnable);
|
||||||
|
delayedReadRunnable = null;
|
||||||
|
}
|
||||||
obj.messageOwner.replies.read_max_id = maxReadId;
|
obj.messageOwner.replies.read_max_id = maxReadId;
|
||||||
} else {
|
} else {
|
||||||
AndroidUtilities.runOnUIThread(() -> obj.messageOwner.replies.read_max_id = maxReadId, 1000);
|
AndroidUtilities.runOnUIThread(delayedReadRunnable = () -> {
|
||||||
|
delayedReadRunnable = null;
|
||||||
|
obj.messageOwner.replies.read_max_id = maxReadId;
|
||||||
|
}, 500);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13314,6 +13326,9 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
if (messageObject.messageOwner.replies != null && messageObject.messageOwner.replies.read_max_id > newValue.read_max_id) {
|
||||||
|
newValue.read_max_id = messageObject.messageOwner.replies.read_max_id;
|
||||||
|
}
|
||||||
messageObject.messageOwner.replies = newValue;
|
messageObject.messageOwner.replies = newValue;
|
||||||
}
|
}
|
||||||
if (messageObject.hasValidGroupId()) {
|
if (messageObject.hasValidGroupId()) {
|
||||||
|
@ -14001,10 +14016,18 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
public void onTransitionAnimationStart(boolean isOpen, boolean backward) {
|
public void onTransitionAnimationStart(boolean isOpen, boolean backward) {
|
||||||
int[] alowedNotifications = null;
|
int[] alowedNotifications = null;
|
||||||
if (isOpen) {
|
if (isOpen) {
|
||||||
alowedNotifications = new int[]{
|
if (threadMessageId != 0) {
|
||||||
NotificationCenter.dialogsNeedReload, NotificationCenter.closeChats,
|
alowedNotifications = new int[]{
|
||||||
NotificationCenter.botKeyboardDidLoad, NotificationCenter.needDeleteDialog
|
NotificationCenter.dialogsNeedReload, NotificationCenter.closeChats,
|
||||||
};
|
NotificationCenter.botKeyboardDidLoad, NotificationCenter.needDeleteDialog,
|
||||||
|
NotificationCenter.messagesDidLoad
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
alowedNotifications = new int[]{
|
||||||
|
NotificationCenter.dialogsNeedReload, NotificationCenter.closeChats,
|
||||||
|
NotificationCenter.botKeyboardDidLoad, NotificationCenter.needDeleteDialog
|
||||||
|
};
|
||||||
|
}
|
||||||
openAnimationEnded = false;
|
openAnimationEnded = false;
|
||||||
if (!backward) {
|
if (!backward) {
|
||||||
openAnimationStartTime = SystemClock.elapsedRealtime();
|
openAnimationStartTime = SystemClock.elapsedRealtime();
|
||||||
|
@ -17456,6 +17479,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
if (!noDiscussion && discussionMessage == null || noDiscussion || !noHistory && history == null) {
|
if (!noDiscussion && discussionMessage == null || noDiscussion || !noHistory && history == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (history != null && maxReadId != 1 && maxReadId != 0 && maxReadId != discussionMessage.read_inbox_max_id) {
|
if (history != null && maxReadId != 1 && maxReadId != 0 && maxReadId != discussionMessage.read_inbox_max_id) {
|
||||||
history = null;
|
history = null;
|
||||||
}
|
}
|
||||||
|
@ -17498,7 +17522,9 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
getMessagesController().processLoadedMessages(history, dialogId, 0, 30, maxReadId, 0, false, chatActivity.getClassGuid(), fnid, 0, 0, 0, 2, true, false, false, arrayList.get(arrayList.size() - 1).getId(), 1, false, 0);
|
TLRPC.messages_Messages historyFinal = history;
|
||||||
|
int fnidFinal = fnid;
|
||||||
|
Utilities.stageQueue.postRunnable(() -> getMessagesController().processLoadedMessages(historyFinal, dialogId, 0, 30, maxReadId, 0, false, chatActivity.getClassGuid(), fnidFinal, 0, 0, 0, 2, true, false, false, arrayList.get(arrayList.size() - 1).getId(), 1, false, 0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1944,7 +1944,9 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe
|
||||||
} else {
|
} else {
|
||||||
if (searchingType != 0) {
|
if (searchingType != 0) {
|
||||||
searchingType = 0;
|
searchingType = 0;
|
||||||
emojiView.closeSearch(false);
|
if (emojiView != null) {
|
||||||
|
emojiView.closeSearch(false);
|
||||||
|
}
|
||||||
messageEditText.requestFocus();
|
messageEditText.requestFocus();
|
||||||
}
|
}
|
||||||
if (stickersExpanded) {
|
if (stickersExpanded) {
|
||||||
|
@ -5988,7 +5990,7 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe
|
||||||
if (replyingMessageObject != null) {
|
if (replyingMessageObject != null) {
|
||||||
openKeyboardInternal();
|
openKeyboardInternal();
|
||||||
setButtons(botMessageObject, false);
|
setButtons(botMessageObject, false);
|
||||||
} else if (botButtonsMessageObject.messageOwner.reply_markup.single_use) {
|
} else if (botButtonsMessageObject != null && botButtonsMessageObject.messageOwner.reply_markup.single_use) {
|
||||||
if (open) {
|
if (open) {
|
||||||
openKeyboardInternal();
|
openKeyboardInternal();
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -2,14 +2,10 @@ package org.telegram.ui.Components;
|
||||||
|
|
||||||
import android.animation.Animator;
|
import android.animation.Animator;
|
||||||
import android.animation.AnimatorListenerAdapter;
|
import android.animation.AnimatorListenerAdapter;
|
||||||
import android.animation.AnimatorSet;
|
|
||||||
import android.animation.ObjectAnimator;
|
|
||||||
import android.animation.ValueAnimator;
|
import android.animation.ValueAnimator;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.graphics.Canvas;
|
import android.graphics.Canvas;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.util.SparseArray;
|
|
||||||
import android.util.SparseIntArray;
|
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewTreeObserver;
|
import android.view.ViewTreeObserver;
|
||||||
import android.widget.FrameLayout;
|
import android.widget.FrameLayout;
|
||||||
|
@ -61,7 +57,7 @@ public class SearchViewPager extends ViewPagerFixed implements FilteredSearchVie
|
||||||
|
|
||||||
private NumberTextView selectedMessagesCountTextView;
|
private NumberTextView selectedMessagesCountTextView;
|
||||||
private boolean isActionModeShowed;
|
private boolean isActionModeShowed;
|
||||||
private HashMap<FilteredSearchView.MessageHashId, MessageObject> selectedFiles = new HashMap();
|
private HashMap<FilteredSearchView.MessageHashId, MessageObject> selectedFiles = new HashMap<>();
|
||||||
|
|
||||||
private ArrayList<FiltersView.MediaFilterData> currentSearchFilters = new ArrayList<>();
|
private ArrayList<FiltersView.MediaFilterData> currentSearchFilters = new ArrayList<>();
|
||||||
|
|
||||||
|
@ -253,8 +249,10 @@ public class SearchViewPager extends ViewPagerFixed implements FilteredSearchVie
|
||||||
dialogsSearchAdapter.setFiltersDelegate(filteredSearchViewDelegate, false);
|
dialogsSearchAdapter.setFiltersDelegate(filteredSearchViewDelegate, false);
|
||||||
noMediaFiltersSearchView.animate().setListener(null).cancel();
|
noMediaFiltersSearchView.animate().setListener(null).cancel();
|
||||||
noMediaFiltersSearchView.setDelegate(null, false);
|
noMediaFiltersSearchView.setDelegate(null, false);
|
||||||
emptyView.showProgress(!dialogsSearchAdapter.isSearching(), false);
|
if (reset) {
|
||||||
emptyView.showProgress(dialogsSearchAdapter.isSearching(), false);
|
emptyView.showProgress(!dialogsSearchAdapter.isSearching(), false);
|
||||||
|
emptyView.showProgress(dialogsSearchAdapter.isSearching(), false);
|
||||||
|
}
|
||||||
if (reset) {
|
if (reset) {
|
||||||
noMediaFiltersSearchView.setVisibility(View.GONE);
|
noMediaFiltersSearchView.setVisibility(View.GONE);
|
||||||
} else {
|
} else {
|
||||||
|
@ -378,11 +376,9 @@ public class SearchViewPager extends ViewPagerFixed implements FilteredSearchVie
|
||||||
DialogsActivity fragment = new DialogsActivity(args);
|
DialogsActivity fragment = new DialogsActivity(args);
|
||||||
fragment.setDelegate((fragment1, dids, message, param) -> {
|
fragment.setDelegate((fragment1, dids, message, param) -> {
|
||||||
ArrayList<MessageObject> fmessages = new ArrayList<>();
|
ArrayList<MessageObject> fmessages = new ArrayList<>();
|
||||||
ArrayList<Integer> ids = new ArrayList<>();
|
|
||||||
Iterator<FilteredSearchView.MessageHashId> idIterator = selectedFiles.keySet().iterator();
|
Iterator<FilteredSearchView.MessageHashId> idIterator = selectedFiles.keySet().iterator();
|
||||||
while (idIterator.hasNext()) {
|
while (idIterator.hasNext()) {
|
||||||
FilteredSearchView.MessageHashId hashId = idIterator.next();
|
FilteredSearchView.MessageHashId hashId = idIterator.next();
|
||||||
ids.add(hashId.messageId);
|
|
||||||
fmessages.add(selectedFiles.get(hashId));
|
fmessages.add(selectedFiles.get(hashId));
|
||||||
}
|
}
|
||||||
selectedFiles.clear();
|
selectedFiles.clear();
|
||||||
|
@ -495,7 +491,6 @@ public class SearchViewPager extends ViewPagerFixed implements FilteredSearchVie
|
||||||
} else if (view instanceof DialogCell) {
|
} else if (view instanceof DialogCell) {
|
||||||
((DialogCell) view).setChecked(selectedFiles.containsKey(hashId), true);
|
((DialogCell) view).setChecked(selectedFiles.containsKey(hashId), true);
|
||||||
}
|
}
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -637,6 +632,7 @@ public class SearchViewPager extends ViewPagerFixed implements FilteredSearchVie
|
||||||
}
|
}
|
||||||
noMediaFiltersSearchView.messagesDeleted(channelId, markAsDeletedMessages);
|
noMediaFiltersSearchView.messagesDeleted(channelId, markAsDeletedMessages);
|
||||||
if (!selectedFiles.isEmpty()) {
|
if (!selectedFiles.isEmpty()) {
|
||||||
|
ArrayList<FilteredSearchView.MessageHashId> toRemove = null;
|
||||||
Iterator<FilteredSearchView.MessageHashId> iterator = selectedFiles.keySet().iterator();
|
Iterator<FilteredSearchView.MessageHashId> iterator = selectedFiles.keySet().iterator();
|
||||||
while (iterator.hasNext()) {
|
while (iterator.hasNext()) {
|
||||||
FilteredSearchView.MessageHashId hashId = iterator.next();
|
FilteredSearchView.MessageHashId hashId = iterator.next();
|
||||||
|
@ -646,14 +642,20 @@ public class SearchViewPager extends ViewPagerFixed implements FilteredSearchVie
|
||||||
if (currentChannelId == channelId) {
|
if (currentChannelId == channelId) {
|
||||||
for (int i = 0; i < markAsDeletedMessages.size(); i++) {
|
for (int i = 0; i < markAsDeletedMessages.size(); i++) {
|
||||||
if (messageObject.getId() == markAsDeletedMessages.get(i)) {
|
if (messageObject.getId() == markAsDeletedMessages.get(i)) {
|
||||||
selectedFiles.remove(hashId);
|
toRemove = new ArrayList<>();
|
||||||
selectedMessagesCountTextView.setNumber(selectedFiles.size(), true);
|
toRemove.add(hashId);
|
||||||
if (gotoItem != null) {
|
|
||||||
gotoItem.setVisibility(selectedFiles.size() == 1 ? View.VISIBLE : View.GONE);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (toRemove != null) {
|
||||||
|
for (int a = 0, N = toRemove.size(); a < N; a++) {
|
||||||
|
selectedFiles.remove(toRemove.get(a));
|
||||||
|
}
|
||||||
|
selectedMessagesCountTextView.setNumber(selectedFiles.size(), true);
|
||||||
|
if (gotoItem != null) {
|
||||||
|
gotoItem.setVisibility(selectedFiles.size() == 1 ? View.VISIBLE : View.GONE);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,6 +62,7 @@ import org.telegram.ui.ActionBar.BaseFragment;
|
||||||
import org.telegram.ui.ActionBar.BottomSheet;
|
import org.telegram.ui.ActionBar.BottomSheet;
|
||||||
import org.telegram.ui.ActionBar.Theme;
|
import org.telegram.ui.ActionBar.Theme;
|
||||||
import org.telegram.ui.ActionBar.ThemeDescription;
|
import org.telegram.ui.ActionBar.ThemeDescription;
|
||||||
|
import org.telegram.ui.Adapters.FiltersView;
|
||||||
import org.telegram.ui.Adapters.SearchAdapterHelper;
|
import org.telegram.ui.Adapters.SearchAdapterHelper;
|
||||||
import org.telegram.ui.ArticleViewer;
|
import org.telegram.ui.ArticleViewer;
|
||||||
import org.telegram.ui.Cells.ChatActionCell;
|
import org.telegram.ui.Cells.ChatActionCell;
|
||||||
|
@ -78,6 +79,7 @@ import org.telegram.ui.Cells.SharedPhotoVideoCell;
|
||||||
import org.telegram.ui.Cells.UserCell;
|
import org.telegram.ui.Cells.UserCell;
|
||||||
import org.telegram.ui.ChatActivity;
|
import org.telegram.ui.ChatActivity;
|
||||||
import org.telegram.ui.DialogsActivity;
|
import org.telegram.ui.DialogsActivity;
|
||||||
|
import org.telegram.ui.FilteredSearchView;
|
||||||
import org.telegram.ui.PhotoViewer;
|
import org.telegram.ui.PhotoViewer;
|
||||||
import org.telegram.ui.ProfileActivity;
|
import org.telegram.ui.ProfileActivity;
|
||||||
|
|
||||||
|
@ -94,12 +96,11 @@ public class SharedMediaLayout extends FrameLayout implements NotificationCenter
|
||||||
|
|
||||||
private static class MediaPage extends FrameLayout {
|
private static class MediaPage extends FrameLayout {
|
||||||
private RecyclerListView listView;
|
private RecyclerListView listView;
|
||||||
private LinearLayout progressView;
|
private FilteredSearchView.LoadingView progressView;
|
||||||
private TextView emptyTextView;
|
private TextView emptyTextView;
|
||||||
private ExtendedGridLayoutManager layoutManager;
|
private ExtendedGridLayoutManager layoutManager;
|
||||||
private ImageView emptyImageView;
|
private ImageView emptyImageView;
|
||||||
private LinearLayout emptyView;
|
private LinearLayout emptyView;
|
||||||
private RadialProgressView progressBar;
|
|
||||||
private ClippingImageView animatingImageView;
|
private ClippingImageView animatingImageView;
|
||||||
private RecyclerAnimationScrollHelper scrollHelper;
|
private RecyclerAnimationScrollHelper scrollHelper;
|
||||||
private int selectedType;
|
private int selectedType;
|
||||||
|
@ -1208,21 +1209,36 @@ public class SharedMediaLayout extends FrameLayout implements NotificationCenter
|
||||||
mediaPages[a].emptyTextView.setPadding(AndroidUtilities.dp(40), 0, AndroidUtilities.dp(40), AndroidUtilities.dp(128));
|
mediaPages[a].emptyTextView.setPadding(AndroidUtilities.dp(40), 0, AndroidUtilities.dp(40), AndroidUtilities.dp(128));
|
||||||
mediaPages[a].emptyView.addView(mediaPages[a].emptyTextView, LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.CENTER, 0, 24, 0, 0));
|
mediaPages[a].emptyView.addView(mediaPages[a].emptyTextView, LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.CENTER, 0, 24, 0, 0));
|
||||||
|
|
||||||
mediaPages[a].progressView = new LinearLayout(context) {
|
mediaPages[a].progressView = new FilteredSearchView.LoadingView(context) {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getColumnsCount() {
|
||||||
|
return columnsCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getType() {
|
||||||
|
if (mediaPage.selectedType == 0 || mediaPage.selectedType == 5) {
|
||||||
|
return 2;
|
||||||
|
} else if (mediaPage.selectedType == 1) {
|
||||||
|
return 3;
|
||||||
|
} else if (mediaPage.selectedType == 2 || mediaPage.selectedType == 4) {
|
||||||
|
return 4;
|
||||||
|
} else if (mediaPage.selectedType == 3) {
|
||||||
|
return 5;
|
||||||
|
}
|
||||||
|
return super.getType();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onDraw(Canvas canvas) {
|
protected void onDraw(Canvas canvas) {
|
||||||
backgroundPaint.setColor(Theme.getColor(Theme.key_windowBackgroundWhite));
|
backgroundPaint.setColor(Theme.getColor(Theme.key_windowBackgroundWhite));
|
||||||
canvas.drawRect(0, 0, getMeasuredWidth(), getMeasuredHeight(), backgroundPaint);
|
canvas.drawRect(0, 0, getMeasuredWidth(), getMeasuredHeight(), backgroundPaint);
|
||||||
|
super.onDraw(canvas);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
mediaPages[a].progressView.setWillNotDraw(false);
|
|
||||||
mediaPages[a].progressView.setGravity(Gravity.CENTER);
|
|
||||||
mediaPages[a].progressView.setOrientation(LinearLayout.VERTICAL);
|
|
||||||
mediaPages[a].progressView.setVisibility(View.GONE);
|
mediaPages[a].progressView.setVisibility(View.GONE);
|
||||||
mediaPages[a].addView(mediaPages[a].progressView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));
|
mediaPages[a].addView(mediaPages[a].progressView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));
|
||||||
|
|
||||||
mediaPages[a].progressBar = new RadialProgressView(context);
|
|
||||||
mediaPages[a].progressView.addView(mediaPages[a].progressBar, LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT));
|
|
||||||
if (a != 0) {
|
if (a != 0) {
|
||||||
mediaPages[a].setVisibility(View.GONE);
|
mediaPages[a].setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
@ -1928,7 +1944,6 @@ public class SharedMediaLayout extends FrameLayout implements NotificationCenter
|
||||||
height = Math.max(height, AndroidUtilities.dp(120));
|
height = Math.max(height, AndroidUtilities.dp(120));
|
||||||
for (int a = 0; a < mediaPages.length; a++) {
|
for (int a = 0; a < mediaPages.length; a++) {
|
||||||
mediaPages[a].emptyView.setTranslationY(-(getMeasuredHeight() - height) / 2);
|
mediaPages[a].emptyView.setTranslationY(-(getMeasuredHeight() - height) / 2);
|
||||||
mediaPages[a].progressView.setTranslationY(-(getMeasuredHeight() - height) / 2);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2014,8 +2029,10 @@ public class SharedMediaLayout extends FrameLayout implements NotificationCenter
|
||||||
profileActivity.getMediaDataController().loadMedia(mergeDialogId, 50, sharedMediaData[type].max_id[1], type, 1, profileActivity.getClassGuid());
|
profileActivity.getMediaDataController().loadMedia(mergeDialogId, 50, sharedMediaData[type].max_id[1], type, 1, profileActivity.getClassGuid());
|
||||||
}
|
}
|
||||||
if (adapter != null) {
|
if (adapter != null) {
|
||||||
|
RecyclerListView listView = null;
|
||||||
for (int a = 0; a < mediaPages.length; a++) {
|
for (int a = 0; a < mediaPages.length; a++) {
|
||||||
if (mediaPages[a].listView.getAdapter() == adapter) {
|
if (mediaPages[a].listView.getAdapter() == adapter) {
|
||||||
|
listView = mediaPages[a].listView;
|
||||||
mediaPages[a].listView.stopScroll();
|
mediaPages[a].listView.stopScroll();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2034,13 +2051,43 @@ public class SharedMediaLayout extends FrameLayout implements NotificationCenter
|
||||||
} else if (newItemCount < oldItemCount) {
|
} else if (newItemCount < oldItemCount) {
|
||||||
adapter.notifyItemRangeRemoved(newItemCount, (oldItemCount - newItemCount));
|
adapter.notifyItemRangeRemoved(newItemCount, (oldItemCount - newItemCount));
|
||||||
}
|
}
|
||||||
|
if (listView != null && oldItemCount == 0 && newItemCount > 0) {
|
||||||
|
RecyclerListView finalListView = listView;
|
||||||
|
getViewTreeObserver().addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() {
|
||||||
|
@Override
|
||||||
|
public boolean onPreDraw() {
|
||||||
|
getViewTreeObserver().removeOnPreDrawListener(this);
|
||||||
|
int n = finalListView.getChildCount();
|
||||||
|
AnimatorSet animatorSet = new AnimatorSet();
|
||||||
|
for (int i = 0; i < n; i++) {
|
||||||
|
View child = finalListView.getChildAt(i);
|
||||||
|
child.setAlpha(0);
|
||||||
|
int s = Math.min(finalListView.getMeasuredHeight(), Math.max(0, child.getTop()));
|
||||||
|
int delay = (int) ((s / (float) finalListView.getMeasuredHeight()) * 100);
|
||||||
|
ObjectAnimator a = ObjectAnimator.ofFloat(child, View.ALPHA, 0, 1f);
|
||||||
|
a.setStartDelay(delay);
|
||||||
|
a.setDuration(200);
|
||||||
|
animatorSet.playTogether(a);
|
||||||
|
}
|
||||||
|
animatorSet.start();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
scrolling = true;
|
scrolling = true;
|
||||||
for (int a = 0; a < mediaPages.length; a++) {
|
for (int a = 0; a < mediaPages.length; a++) {
|
||||||
if (mediaPages[a].selectedType == type) {
|
if (mediaPages[a].selectedType == type) {
|
||||||
if (!sharedMediaData[type].loading) {
|
if (!sharedMediaData[type].loading) {
|
||||||
if (mediaPages[a].progressView != null) {
|
if (mediaPages[a].progressView != null) {
|
||||||
mediaPages[a].progressView.setVisibility(View.GONE);
|
View v = mediaPages[a].progressView;
|
||||||
|
v.animate().alpha(0).setListener(new AnimatorListenerAdapter() {
|
||||||
|
@Override
|
||||||
|
public void onAnimationEnd(Animator animation) {
|
||||||
|
v.setAlpha(1f);
|
||||||
|
v.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
if (mediaPages[a].listView != null) {
|
if (mediaPages[a].listView != null) {
|
||||||
if (mediaPages[a].listView.getEmptyView() == null) {
|
if (mediaPages[a].listView.getEmptyView() == null) {
|
||||||
|
@ -3774,20 +3821,53 @@ public class SharedMediaLayout extends FrameLayout implements NotificationCenter
|
||||||
} else {
|
} else {
|
||||||
endReached = true;
|
endReached = true;
|
||||||
}
|
}
|
||||||
loading = false;
|
|
||||||
firstLoaded = true;
|
|
||||||
for (int a = 0; a < mediaPages.length; a++) {
|
for (int a = 0; a < mediaPages.length; a++) {
|
||||||
if (mediaPages[a].selectedType == 6) {
|
if (mediaPages[a].selectedType == 6) {
|
||||||
if (mediaPages[a].progressView != null) {
|
if (mediaPages[a].progressView != null) {
|
||||||
mediaPages[a].progressView.setVisibility(View.GONE);
|
View v = mediaPages[a].progressView;
|
||||||
|
v.animate().alpha(0).setListener(new AnimatorListenerAdapter() {
|
||||||
|
@Override
|
||||||
|
public void onAnimationEnd(Animator animation) {
|
||||||
|
v.setAlpha(1f);
|
||||||
|
v.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
if (mediaPages[a].listView != null) {
|
if (mediaPages[a].listView != null) {
|
||||||
if (mediaPages[a].listView.getEmptyView() == null) {
|
if (mediaPages[a].listView.getEmptyView() == null) {
|
||||||
mediaPages[a].listView.setEmptyView(mediaPages[a].emptyView);
|
mediaPages[a].listView.setEmptyView(mediaPages[a].emptyView);
|
||||||
}
|
}
|
||||||
|
final RecyclerListView listView = mediaPages[a].listView;
|
||||||
|
if (firstLoaded) {
|
||||||
|
if (listView != null) {
|
||||||
|
getViewTreeObserver().addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() {
|
||||||
|
@Override
|
||||||
|
public boolean onPreDraw() {
|
||||||
|
getViewTreeObserver().removeOnPreDrawListener(this);
|
||||||
|
int n = listView.getChildCount();
|
||||||
|
AnimatorSet animatorSet = new AnimatorSet();
|
||||||
|
for (int i = 0; i < n; i++) {
|
||||||
|
View child = listView.getChildAt(i);
|
||||||
|
child.setAlpha(0);
|
||||||
|
int s = Math.min(listView.getMeasuredHeight(), Math.max(0, child.getTop()));
|
||||||
|
int delay = (int) ((s / (float) listView.getMeasuredHeight()) * 100);
|
||||||
|
ObjectAnimator a = ObjectAnimator.ofFloat(child, View.ALPHA, 0, 1f);
|
||||||
|
a.setStartDelay(delay);
|
||||||
|
a.setDuration(200);
|
||||||
|
animatorSet.playTogether(a);
|
||||||
|
}
|
||||||
|
animatorSet.start();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
loading = false;
|
||||||
|
firstLoaded = true;
|
||||||
notifyDataSetChanged();
|
notifyDataSetChanged();
|
||||||
}));
|
}));
|
||||||
profileActivity.getConnectionsManager().bindRequestToGuid(reqId, profileActivity.getClassGuid());
|
profileActivity.getConnectionsManager().bindRequestToGuid(reqId, profileActivity.getClassGuid());
|
||||||
|
@ -4207,9 +4287,6 @@ public class SharedMediaLayout extends FrameLayout implements NotificationCenter
|
||||||
arrayList.add(new ThemeDescription(mediaPages[a].listView, ThemeDescription.FLAG_LISTGLOWCOLOR, null, null, null, null, Theme.key_actionBarDefault));
|
arrayList.add(new ThemeDescription(mediaPages[a].listView, ThemeDescription.FLAG_LISTGLOWCOLOR, null, null, null, null, Theme.key_actionBarDefault));
|
||||||
arrayList.add(new ThemeDescription(mediaPages[a].listView, ThemeDescription.FLAG_SELECTOR, null, null, null, null, Theme.key_listSelector));
|
arrayList.add(new ThemeDescription(mediaPages[a].listView, ThemeDescription.FLAG_SELECTOR, null, null, null, null, Theme.key_listSelector));
|
||||||
arrayList.add(new ThemeDescription(mediaPages[a].emptyView, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_emptyListPlaceholder));
|
arrayList.add(new ThemeDescription(mediaPages[a].emptyView, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_emptyListPlaceholder));
|
||||||
|
|
||||||
arrayList.add(new ThemeDescription(mediaPages[a].progressBar, ThemeDescription.FLAG_PROGRESSBAR, null, null, null, null, Theme.key_progressCircle));
|
|
||||||
|
|
||||||
arrayList.add(new ThemeDescription(mediaPages[a].emptyTextView, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteGrayText2));
|
arrayList.add(new ThemeDescription(mediaPages[a].emptyTextView, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteGrayText2));
|
||||||
|
|
||||||
arrayList.add(new ThemeDescription(mediaPages[a].listView, ThemeDescription.FLAG_SECTIONS, new Class[]{GraySectionCell.class}, new String[]{"textView"}, null, null, null, Theme.key_graySectionText));
|
arrayList.add(new ThemeDescription(mediaPages[a].listView, ThemeDescription.FLAG_SECTIONS, new Class[]{GraySectionCell.class}, new String[]{"textView"}, null, null, null, Theme.key_graySectionText));
|
||||||
|
|
|
@ -410,7 +410,7 @@ public class ContactsActivity extends BaseFragment implements NotificationCenter
|
||||||
String str = (String) object;
|
String str = (String) object;
|
||||||
if (!str.equals("section")) {
|
if (!str.equals("section")) {
|
||||||
NewContactActivity activity = new NewContactActivity();
|
NewContactActivity activity = new NewContactActivity();
|
||||||
activity.setInitialPhoneNumber(str);
|
activity.setInitialPhoneNumber(str, true);
|
||||||
presentFragment(activity);
|
presentFragment(activity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3012,6 +3012,13 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
|
||||||
|
|
||||||
updateFilterTabs(false);
|
updateFilterTabs(false);
|
||||||
|
|
||||||
|
if (folderId != 0) {
|
||||||
|
FiltersView.MediaFilterData filterData = new FiltersView.MediaFilterData(R.drawable.chats_archive, R.drawable.chats_archive, LocaleController.getString("Archive", R.string.Archive), null, FiltersView.FILTER_TYPE_ARCHIVE);
|
||||||
|
filterData.removable = false;
|
||||||
|
actionBar.setSearchFilter(filterData);
|
||||||
|
searchItem.collapseSearchFilters();
|
||||||
|
}
|
||||||
|
|
||||||
return fragmentView;
|
return fragmentView;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3025,10 +3032,18 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
|
||||||
searchTabsHeight = searchTabsView.getMeasuredHeight();
|
searchTabsHeight = searchTabsView.getMeasuredHeight();
|
||||||
}
|
}
|
||||||
if (fragmentContextView != null) {
|
if (fragmentContextView != null) {
|
||||||
fragmentContextView.setTranslationY(topPadding + actionBar.getTranslationY() + filtersTabsHeight * (1f - searchAnimationProgress) + searchTabsHeight * searchAnimationProgress);
|
float from = 0;
|
||||||
|
if (fragmentLocationContextView != null && fragmentLocationContextView.getVisibility() == View.VISIBLE) {
|
||||||
|
from += AndroidUtilities.dp(36);
|
||||||
|
}
|
||||||
|
fragmentContextView.setTranslationY(from + fragmentContextView.getTopPadding() + actionBar.getTranslationY() + filtersTabsHeight * (1f - searchAnimationProgress) + searchTabsHeight * searchAnimationProgress);
|
||||||
}
|
}
|
||||||
if (fragmentLocationContextView != null) {
|
if (fragmentLocationContextView != null) {
|
||||||
fragmentLocationContextView.setTranslationY(topPadding + actionBar.getTranslationY() + filtersTabsHeight * (1f - searchAnimationProgress) + searchTabsHeight * searchAnimationProgress);
|
float from = 0;
|
||||||
|
if (fragmentContextView != null) {
|
||||||
|
from += fragmentContextView.getTopPadding();
|
||||||
|
}
|
||||||
|
fragmentLocationContextView.setTranslationY(from + fragmentLocationContextView.getTopPadding() + actionBar.getTranslationY() + filtersTabsHeight * (1f - searchAnimationProgress) + searchTabsHeight * searchAnimationProgress);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3709,6 +3724,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
|
||||||
searchTabsView.hide(false, false);
|
searchTabsView.hide(false, false);
|
||||||
searchTabsView.setVisibility(View.VISIBLE);
|
searchTabsView.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
|
searchItem.getSearchContainer().setAlpha(0f);
|
||||||
} else {
|
} else {
|
||||||
viewPages[0].listView.setVisibility(View.VISIBLE);
|
viewPages[0].listView.setVisibility(View.VISIBLE);
|
||||||
viewPages[0].setVisibility(View.VISIBLE);
|
viewPages[0].setVisibility(View.VISIBLE);
|
||||||
|
@ -3768,6 +3784,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
|
||||||
AndroidUtilities.requestAdjustResize(getParentActivity(), classGuid);
|
AndroidUtilities.requestAdjustResize(getParentActivity(), classGuid);
|
||||||
searchItem.setVisibility(View.GONE);
|
searchItem.setVisibility(View.GONE);
|
||||||
} else {
|
} else {
|
||||||
|
searchItem.collapseSearchFilters();
|
||||||
whiteActionBar = false;
|
whiteActionBar = false;
|
||||||
searchViewPager.setVisibility(View.GONE);
|
searchViewPager.setVisibility(View.GONE);
|
||||||
if (searchTabsView != null) {
|
if (searchTabsView != null) {
|
||||||
|
@ -4022,7 +4039,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
|
||||||
actionBar.openSearchField(str, false);
|
actionBar.openSearchField(str, false);
|
||||||
} else if (!str.equals("section")) {
|
} else if (!str.equals("section")) {
|
||||||
NewContactActivity activity = new NewContactActivity();
|
NewContactActivity activity = new NewContactActivity();
|
||||||
activity.setInitialPhoneNumber(str);
|
activity.setInitialPhoneNumber(str, true);
|
||||||
presentFragment(activity);
|
presentFragment(activity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -326,7 +326,7 @@ public class FilteredSearchView extends FrameLayout implements NotificationCente
|
||||||
recyclerListView.setLayoutManager(layoutManager);
|
recyclerListView.setLayoutManager(layoutManager);
|
||||||
addView(loadingView = new LoadingView(context) {
|
addView(loadingView = new LoadingView(context) {
|
||||||
@Override
|
@Override
|
||||||
int getType() {
|
public int getType() {
|
||||||
if (currentSearchFilter == null) {
|
if (currentSearchFilter == null) {
|
||||||
return 1;
|
return 1;
|
||||||
} else if (currentSearchFilter.filterType == FiltersView.FILTER_TYPE_MEDIA) {
|
} else if (currentSearchFilter.filterType == FiltersView.FILTER_TYPE_MEDIA) {
|
||||||
|
@ -346,7 +346,7 @@ public class FilteredSearchView extends FrameLayout implements NotificationCente
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
int getColumnsCount() {
|
public int getColumnsCount() {
|
||||||
return columnsCount;
|
return columnsCount;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -488,11 +488,7 @@ public class FilteredSearchView extends FrameLayout implements NotificationCente
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!filterAndQueryIsSame) {
|
if (!filterAndQueryIsSame) {
|
||||||
//if (!filterAndQueryIsSame || TextUtils.isEmpty(query)) {
|
|
||||||
clearCurrentResultsRunnable.run();
|
clearCurrentResultsRunnable.run();
|
||||||
// } else {
|
|
||||||
// AndroidUtilities.runOnUIThread(clearCurrentResultsRunnable, 1000);
|
|
||||||
// }
|
|
||||||
emptyView.showProgress(true, !clearOldResults);
|
emptyView.showProgress(true, !clearOldResults);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -713,10 +709,10 @@ public class FilteredSearchView extends FrameLayout implements NotificationCente
|
||||||
boolean found = false;
|
boolean found = false;
|
||||||
for (int i = 0; i < localTipChats.size(); i++) {
|
for (int i = 0; i < localTipChats.size(); i++) {
|
||||||
if (localTipChats.get(i) instanceof TLRPC.User)
|
if (localTipChats.get(i) instanceof TLRPC.User)
|
||||||
if (UserConfig.getInstance(UserConfig.selectedAccount).getCurrentUser().id == ((TLRPC.User)localTipChats.get(i)).id) {
|
if (UserConfig.getInstance(UserConfig.selectedAccount).getCurrentUser().id == ((TLRPC.User) localTipChats.get(i)).id) {
|
||||||
found = true;
|
found = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!found) {
|
if (!found) {
|
||||||
localTipChats.add(0, UserConfig.getInstance(UserConfig.selectedAccount).getCurrentUser());
|
localTipChats.add(0, UserConfig.getInstance(UserConfig.selectedAccount).getCurrentUser());
|
||||||
|
@ -831,7 +827,7 @@ public class FilteredSearchView extends FrameLayout implements NotificationCente
|
||||||
View view;
|
View view;
|
||||||
switch (viewType) {
|
switch (viewType) {
|
||||||
case 0:
|
case 0:
|
||||||
view = new SharedPhotoVideoCell(mContext, SharedPhotoVideoCell.VIEW_TYPE_GLOBAL_SEARCH) ;
|
view = new SharedPhotoVideoCell(mContext, SharedPhotoVideoCell.VIEW_TYPE_GLOBAL_SEARCH);
|
||||||
SharedPhotoVideoCell cell = (SharedPhotoVideoCell) view;
|
SharedPhotoVideoCell cell = (SharedPhotoVideoCell) view;
|
||||||
cell.setDelegate(new SharedPhotoVideoCell.SharedPhotoVideoCellDelegate() {
|
cell.setDelegate(new SharedPhotoVideoCell.SharedPhotoVideoCellDelegate() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -1542,10 +1538,15 @@ public class FilteredSearchView extends FrameLayout implements NotificationCente
|
||||||
|
|
||||||
public interface UiCallback {
|
public interface UiCallback {
|
||||||
void goToMessage(MessageObject messageObject);
|
void goToMessage(MessageObject messageObject);
|
||||||
|
|
||||||
boolean actionModeShowing();
|
boolean actionModeShowing();
|
||||||
|
|
||||||
void toggleItemSelection(MessageObject item, View view, int a);
|
void toggleItemSelection(MessageObject item, View view, int a);
|
||||||
|
|
||||||
boolean isSelected(MessageHashId messageHashId);
|
boolean isSelected(MessageHashId messageHashId);
|
||||||
|
|
||||||
void showActionMode();
|
void showActionMode();
|
||||||
|
|
||||||
int getFolderId();
|
int getFolderId();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1561,11 +1562,11 @@ public class FilteredSearchView extends FrameLayout implements NotificationCente
|
||||||
int color0;
|
int color0;
|
||||||
int color1;
|
int color1;
|
||||||
|
|
||||||
int getType() {
|
public int getType() {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int getColumnsCount() {
|
public int getColumnsCount() {
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1588,15 +1589,18 @@ public class FilteredSearchView extends FrameLayout implements NotificationCente
|
||||||
int h = 0;
|
int h = 0;
|
||||||
while (h < getMeasuredHeight()) {
|
while (h < getMeasuredHeight()) {
|
||||||
int r = AndroidUtilities.dp(25);
|
int r = AndroidUtilities.dp(25);
|
||||||
canvas.drawCircle(AndroidUtilities.dp(9) + r, h + (AndroidUtilities.dp(78) >> 1), r, paint);
|
canvas.drawCircle(checkRtl(AndroidUtilities.dp(9) + r), h + (AndroidUtilities.dp(78) >> 1), r, paint);
|
||||||
|
|
||||||
rectF.set(AndroidUtilities.dp(68), h + AndroidUtilities.dp(20), AndroidUtilities.dp(140), h + AndroidUtilities.dp(28));
|
rectF.set(AndroidUtilities.dp(68), h + AndroidUtilities.dp(20), AndroidUtilities.dp(140), h + AndroidUtilities.dp(28));
|
||||||
|
checkRtl(rectF);
|
||||||
canvas.drawRoundRect(rectF, AndroidUtilities.dp(4), AndroidUtilities.dp(4), paint);
|
canvas.drawRoundRect(rectF, AndroidUtilities.dp(4), AndroidUtilities.dp(4), paint);
|
||||||
|
|
||||||
rectF.set(AndroidUtilities.dp(68), h + AndroidUtilities.dp(42), AndroidUtilities.dp(260), h + AndroidUtilities.dp(50));
|
rectF.set(AndroidUtilities.dp(68), h + AndroidUtilities.dp(42), AndroidUtilities.dp(260), h + AndroidUtilities.dp(50));
|
||||||
|
checkRtl(rectF);
|
||||||
canvas.drawRoundRect(rectF, AndroidUtilities.dp(4), AndroidUtilities.dp(4), paint);
|
canvas.drawRoundRect(rectF, AndroidUtilities.dp(4), AndroidUtilities.dp(4), paint);
|
||||||
|
|
||||||
rectF.set(getMeasuredWidth() - AndroidUtilities.dp(50), h + AndroidUtilities.dp(20), getMeasuredWidth() - AndroidUtilities.dp(12), h + AndroidUtilities.dp(28));
|
rectF.set(getMeasuredWidth() - AndroidUtilities.dp(50), h + AndroidUtilities.dp(20), getMeasuredWidth() - AndroidUtilities.dp(12), h + AndroidUtilities.dp(28));
|
||||||
|
checkRtl(rectF);
|
||||||
canvas.drawRoundRect(rectF, AndroidUtilities.dp(4), AndroidUtilities.dp(4), paint);
|
canvas.drawRoundRect(rectF, AndroidUtilities.dp(4), AndroidUtilities.dp(4), paint);
|
||||||
|
|
||||||
h += AndroidUtilities.dp(78) + 1;
|
h += AndroidUtilities.dp(78) + 1;
|
||||||
|
@ -1615,15 +1619,19 @@ public class FilteredSearchView extends FrameLayout implements NotificationCente
|
||||||
int h = 0;
|
int h = 0;
|
||||||
while (h < getMeasuredHeight()) {
|
while (h < getMeasuredHeight()) {
|
||||||
rectF.set(AndroidUtilities.dp(12), h + AndroidUtilities.dp(8), AndroidUtilities.dp(52), h + AndroidUtilities.dp(48));
|
rectF.set(AndroidUtilities.dp(12), h + AndroidUtilities.dp(8), AndroidUtilities.dp(52), h + AndroidUtilities.dp(48));
|
||||||
|
checkRtl(rectF);
|
||||||
canvas.drawRoundRect(rectF, AndroidUtilities.dp(4), AndroidUtilities.dp(4), paint);
|
canvas.drawRoundRect(rectF, AndroidUtilities.dp(4), AndroidUtilities.dp(4), paint);
|
||||||
|
|
||||||
rectF.set(AndroidUtilities.dp(68), h + AndroidUtilities.dp(12), AndroidUtilities.dp(140), h + AndroidUtilities.dp(20));
|
rectF.set(AndroidUtilities.dp(68), h + AndroidUtilities.dp(12), AndroidUtilities.dp(140), h + AndroidUtilities.dp(20));
|
||||||
|
checkRtl(rectF);
|
||||||
canvas.drawRoundRect(rectF, AndroidUtilities.dp(4), AndroidUtilities.dp(4), paint);
|
canvas.drawRoundRect(rectF, AndroidUtilities.dp(4), AndroidUtilities.dp(4), paint);
|
||||||
|
|
||||||
rectF.set(AndroidUtilities.dp(68), h + AndroidUtilities.dp(34), AndroidUtilities.dp(260), h + AndroidUtilities.dp(42));
|
rectF.set(AndroidUtilities.dp(68), h + AndroidUtilities.dp(34), AndroidUtilities.dp(260), h + AndroidUtilities.dp(42));
|
||||||
|
checkRtl(rectF);
|
||||||
canvas.drawRoundRect(rectF, AndroidUtilities.dp(4), AndroidUtilities.dp(4), paint);
|
canvas.drawRoundRect(rectF, AndroidUtilities.dp(4), AndroidUtilities.dp(4), paint);
|
||||||
|
|
||||||
rectF.set(getMeasuredWidth() - AndroidUtilities.dp(50), h + AndroidUtilities.dp(12), getMeasuredWidth() - AndroidUtilities.dp(12), h + AndroidUtilities.dp(20));
|
rectF.set(getMeasuredWidth() - AndroidUtilities.dp(50), h + AndroidUtilities.dp(12), getMeasuredWidth() - AndroidUtilities.dp(12), h + AndroidUtilities.dp(20));
|
||||||
|
checkRtl(rectF);
|
||||||
canvas.drawRoundRect(rectF, AndroidUtilities.dp(4), AndroidUtilities.dp(4), paint);
|
canvas.drawRoundRect(rectF, AndroidUtilities.dp(4), AndroidUtilities.dp(4), paint);
|
||||||
|
|
||||||
h += AndroidUtilities.dp(56) + 1;
|
h += AndroidUtilities.dp(56) + 1;
|
||||||
|
@ -1632,15 +1640,18 @@ public class FilteredSearchView extends FrameLayout implements NotificationCente
|
||||||
int h = 0;
|
int h = 0;
|
||||||
while (h < getMeasuredHeight()) {
|
while (h < getMeasuredHeight()) {
|
||||||
int radius = AndroidUtilities.dp(44) >> 1;
|
int radius = AndroidUtilities.dp(44) >> 1;
|
||||||
canvas.drawCircle(AndroidUtilities.dp(12) + radius, h + AndroidUtilities.dp(6) + radius, radius, paint);
|
canvas.drawCircle(checkRtl(AndroidUtilities.dp(12) + radius), h + AndroidUtilities.dp(6) + radius, radius, paint);
|
||||||
|
|
||||||
rectF.set(AndroidUtilities.dp(68), h + AndroidUtilities.dp(12), AndroidUtilities.dp(140), h + AndroidUtilities.dp(20));
|
rectF.set(AndroidUtilities.dp(68), h + AndroidUtilities.dp(12), AndroidUtilities.dp(140), h + AndroidUtilities.dp(20));
|
||||||
|
checkRtl(rectF);
|
||||||
canvas.drawRoundRect(rectF, AndroidUtilities.dp(4), AndroidUtilities.dp(4), paint);
|
canvas.drawRoundRect(rectF, AndroidUtilities.dp(4), AndroidUtilities.dp(4), paint);
|
||||||
|
|
||||||
rectF.set(AndroidUtilities.dp(68), h + AndroidUtilities.dp(34), AndroidUtilities.dp(260), h + AndroidUtilities.dp(42));
|
rectF.set(AndroidUtilities.dp(68), h + AndroidUtilities.dp(34), AndroidUtilities.dp(260), h + AndroidUtilities.dp(42));
|
||||||
|
checkRtl(rectF);
|
||||||
canvas.drawRoundRect(rectF, AndroidUtilities.dp(4), AndroidUtilities.dp(4), paint);
|
canvas.drawRoundRect(rectF, AndroidUtilities.dp(4), AndroidUtilities.dp(4), paint);
|
||||||
|
|
||||||
rectF.set(getMeasuredWidth() - AndroidUtilities.dp(50), h + AndroidUtilities.dp(12), getMeasuredWidth() - AndroidUtilities.dp(12), h + AndroidUtilities.dp(20));
|
rectF.set(getMeasuredWidth() - AndroidUtilities.dp(50), h + AndroidUtilities.dp(12), getMeasuredWidth() - AndroidUtilities.dp(12), h + AndroidUtilities.dp(20));
|
||||||
|
checkRtl(rectF);
|
||||||
canvas.drawRoundRect(rectF, AndroidUtilities.dp(4), AndroidUtilities.dp(4), paint);
|
canvas.drawRoundRect(rectF, AndroidUtilities.dp(4), AndroidUtilities.dp(4), paint);
|
||||||
|
|
||||||
h += AndroidUtilities.dp(56) + 1;
|
h += AndroidUtilities.dp(56) + 1;
|
||||||
|
@ -1649,18 +1660,23 @@ public class FilteredSearchView extends FrameLayout implements NotificationCente
|
||||||
int h = 0;
|
int h = 0;
|
||||||
while (h < getMeasuredHeight()) {
|
while (h < getMeasuredHeight()) {
|
||||||
rectF.set(AndroidUtilities.dp(10), h + AndroidUtilities.dp(11), AndroidUtilities.dp(62), h + AndroidUtilities.dp(11 + 52));
|
rectF.set(AndroidUtilities.dp(10), h + AndroidUtilities.dp(11), AndroidUtilities.dp(62), h + AndroidUtilities.dp(11 + 52));
|
||||||
|
checkRtl(rectF);
|
||||||
canvas.drawRoundRect(rectF, AndroidUtilities.dp(4), AndroidUtilities.dp(4), paint);
|
canvas.drawRoundRect(rectF, AndroidUtilities.dp(4), AndroidUtilities.dp(4), paint);
|
||||||
|
|
||||||
rectF.set(AndroidUtilities.dp(68), h + AndroidUtilities.dp(12), AndroidUtilities.dp(140), h + AndroidUtilities.dp(20));
|
rectF.set(AndroidUtilities.dp(68), h + AndroidUtilities.dp(12), AndroidUtilities.dp(140), h + AndroidUtilities.dp(20));
|
||||||
|
checkRtl(rectF);
|
||||||
canvas.drawRoundRect(rectF, AndroidUtilities.dp(4), AndroidUtilities.dp(4), paint);
|
canvas.drawRoundRect(rectF, AndroidUtilities.dp(4), AndroidUtilities.dp(4), paint);
|
||||||
|
|
||||||
rectF.set(AndroidUtilities.dp(68), h + AndroidUtilities.dp(34), AndroidUtilities.dp(268), h + AndroidUtilities.dp(42));
|
rectF.set(AndroidUtilities.dp(68), h + AndroidUtilities.dp(34), AndroidUtilities.dp(268), h + AndroidUtilities.dp(42));
|
||||||
|
checkRtl(rectF);
|
||||||
canvas.drawRoundRect(rectF, AndroidUtilities.dp(4), AndroidUtilities.dp(4), paint);
|
canvas.drawRoundRect(rectF, AndroidUtilities.dp(4), AndroidUtilities.dp(4), paint);
|
||||||
|
|
||||||
rectF.set(AndroidUtilities.dp(68), h + AndroidUtilities.dp(34 + 20), AndroidUtilities.dp(120 + 68), h + AndroidUtilities.dp(42 + 20));
|
rectF.set(AndroidUtilities.dp(68), h + AndroidUtilities.dp(34 + 20), AndroidUtilities.dp(120 + 68), h + AndroidUtilities.dp(42 + 20));
|
||||||
|
checkRtl(rectF);
|
||||||
canvas.drawRoundRect(rectF, AndroidUtilities.dp(4), AndroidUtilities.dp(4), paint);
|
canvas.drawRoundRect(rectF, AndroidUtilities.dp(4), AndroidUtilities.dp(4), paint);
|
||||||
|
|
||||||
rectF.set(getMeasuredWidth() - AndroidUtilities.dp(50), h + AndroidUtilities.dp(12), getMeasuredWidth() - AndroidUtilities.dp(12), h + AndroidUtilities.dp(20));
|
rectF.set(getMeasuredWidth() - AndroidUtilities.dp(50), h + AndroidUtilities.dp(12), getMeasuredWidth() - AndroidUtilities.dp(12), h + AndroidUtilities.dp(20));
|
||||||
|
checkRtl(rectF);
|
||||||
canvas.drawRoundRect(rectF, AndroidUtilities.dp(4), AndroidUtilities.dp(4), paint);
|
canvas.drawRoundRect(rectF, AndroidUtilities.dp(4), AndroidUtilities.dp(4), paint);
|
||||||
|
|
||||||
h += AndroidUtilities.dp(80);
|
h += AndroidUtilities.dp(80);
|
||||||
|
@ -1681,6 +1697,20 @@ public class FilteredSearchView extends FrameLayout implements NotificationCente
|
||||||
gradient.setLocalMatrix(matrix);
|
gradient.setLocalMatrix(matrix);
|
||||||
invalidate();
|
invalidate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private float checkRtl(float x) {
|
||||||
|
if (LocaleController.isRTL) {
|
||||||
|
return getMeasuredWidth() - x;
|
||||||
|
}
|
||||||
|
return x;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void checkRtl(RectF rectF) {
|
||||||
|
if (LocaleController.isRTL) {
|
||||||
|
rectF.left = getMeasuredWidth() - rectF.left;
|
||||||
|
rectF.right = getMeasuredWidth() - rectF.right;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showFloatingDateView() {
|
private void showFloatingDateView() {
|
||||||
|
|
|
@ -2140,7 +2140,7 @@ public class LaunchActivity extends Activity implements ActionBarLayout.ActionBa
|
||||||
fragment.setInitialName(names[0], names.length > 1 ? names[1] : null);
|
fragment.setInitialName(names[0], names.length > 1 ? names[1] : null);
|
||||||
}
|
}
|
||||||
if (newContactPhone != null) {
|
if (newContactPhone != null) {
|
||||||
fragment.setInitialPhoneNumber(PhoneFormat.stripExceptNumbers(newContactPhone));
|
fragment.setInitialPhoneNumber(PhoneFormat.stripExceptNumbers(newContactPhone, true), false);
|
||||||
}
|
}
|
||||||
actionBarLayout.presentFragment(fragment, false, true, true, false);
|
actionBarLayout.presentFragment(fragment, false, true, true, false);
|
||||||
if (AndroidUtilities.isTablet()) {
|
if (AndroidUtilities.isTablet()) {
|
||||||
|
|
|
@ -92,6 +92,7 @@ public class NewContactActivity extends BaseFragment implements AdapterView.OnIt
|
||||||
private boolean ignoreSelection;
|
private boolean ignoreSelection;
|
||||||
private boolean donePressed;
|
private boolean donePressed;
|
||||||
private String initialPhoneNumber;
|
private String initialPhoneNumber;
|
||||||
|
private boolean initialPhoneNumberWithCountryCode;
|
||||||
private String initialFirstName;
|
private String initialFirstName;
|
||||||
private String initialLastName;
|
private String initialLastName;
|
||||||
|
|
||||||
|
@ -568,7 +569,23 @@ public class NewContactActivity extends BaseFragment implements AdapterView.OnIt
|
||||||
Collections.sort(countriesArray, String::compareTo);
|
Collections.sort(countriesArray, String::compareTo);
|
||||||
|
|
||||||
if (!TextUtils.isEmpty(initialPhoneNumber)) {
|
if (!TextUtils.isEmpty(initialPhoneNumber)) {
|
||||||
codeField.setText(initialPhoneNumber);
|
TLRPC.User user = getUserConfig().getCurrentUser();
|
||||||
|
if (initialPhoneNumber.startsWith("+")) {
|
||||||
|
codeField.setText(initialPhoneNumber.substring(1));
|
||||||
|
} else if (initialPhoneNumberWithCountryCode || user == null || TextUtils.isEmpty(user.phone)) {
|
||||||
|
codeField.setText(initialPhoneNumber);
|
||||||
|
} else {
|
||||||
|
String phone = user.phone;
|
||||||
|
for (int a = 4; a >= 1; a--) {
|
||||||
|
String sub = phone.substring(0, a);
|
||||||
|
String country = codesMap.get(sub);
|
||||||
|
if (country != null) {
|
||||||
|
codeField.setText(sub);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
phoneField.setText(initialPhoneNumber);
|
||||||
|
}
|
||||||
initialPhoneNumber = null;
|
initialPhoneNumber = null;
|
||||||
} else {
|
} else {
|
||||||
String country = null;
|
String country = null;
|
||||||
|
@ -618,8 +635,9 @@ public class NewContactActivity extends BaseFragment implements AdapterView.OnIt
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setInitialPhoneNumber(String value) {
|
public void setInitialPhoneNumber(String value, boolean withCoutryCode) {
|
||||||
initialPhoneNumber = value;
|
initialPhoneNumber = value;
|
||||||
|
initialPhoneNumberWithCountryCode = withCoutryCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setInitialName(String firstName, String lastName) {
|
public void setInitialName(String firstName, String lastName) {
|
||||||
|
|
|
@ -5910,7 +5910,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
|
||||||
}
|
}
|
||||||
|
|
||||||
private void closeCaptionEnter(boolean apply) {
|
private void closeCaptionEnter(boolean apply) {
|
||||||
if (currentIndex < 0 || currentIndex >= imagesArrLocals.size()) {
|
if (currentIndex < 0 || currentIndex >= imagesArrLocals.size() || captionEditText.getTag() == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Object object = imagesArrLocals.get(currentIndex);
|
Object object = imagesArrLocals.get(currentIndex);
|
||||||
|
@ -9051,7 +9051,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
|
||||||
setItemVisible(masksItem, shouldMasksItemBeVisible, !pipItemVisible);
|
setItemVisible(masksItem, shouldMasksItemBeVisible, !pipItemVisible);
|
||||||
}
|
}
|
||||||
final boolean shouldAutoPlayed = shouldMessageObjectAutoPlayed(newMessageObject);
|
final boolean shouldAutoPlayed = shouldMessageObjectAutoPlayed(newMessageObject);
|
||||||
if (!shouldAutoPlayed) {
|
if (!shouldAutoPlayed && TextUtils.isEmpty(placeProvider.getTitleFor(switchingToIndex))) {
|
||||||
final boolean animated = !playerWasPlaying;
|
final boolean animated = !playerWasPlaying;
|
||||||
if (nameOverride != null) {
|
if (nameOverride != null) {
|
||||||
nameTextView.setText(nameOverride);
|
nameTextView.setText(nameOverride);
|
||||||
|
@ -9117,7 +9117,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
|
||||||
loadingMoreImages = true;
|
loadingMoreImages = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
CharSequence title = placeProvider.getTitleFor( switchingToIndex);
|
CharSequence title = placeProvider.getTitleFor(switchingToIndex);
|
||||||
if (title != null) {
|
if (title != null) {
|
||||||
actionBar.setTitle(title);
|
actionBar.setTitle(title);
|
||||||
CharSequence subtitle = placeProvider.getSubtitleFor(switchingToIndex);
|
CharSequence subtitle = placeProvider.getSubtitleFor(switchingToIndex);
|
||||||
|
|
|
@ -2790,6 +2790,9 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
|
||||||
}
|
}
|
||||||
frameLayout.addView(writeButton, LayoutHelper.createFrame(Build.VERSION.SDK_INT >= 21 ? 56 : 60, Build.VERSION.SDK_INT >= 21 ? 56 : 60, Gravity.RIGHT | Gravity.TOP, 0, 0, 16, 0));
|
frameLayout.addView(writeButton, LayoutHelper.createFrame(Build.VERSION.SDK_INT >= 21 ? 56 : 60, Build.VERSION.SDK_INT >= 21 ? 56 : 60, Gravity.RIGHT | Gravity.TOP, 0, 0, 16, 0));
|
||||||
writeButton.setOnClickListener(v -> {
|
writeButton.setOnClickListener(v -> {
|
||||||
|
if (writeButton.getTag() != null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (user_id != 0) {
|
if (user_id != 0) {
|
||||||
if (imageUpdater != null) {
|
if (imageUpdater != null) {
|
||||||
TLRPC.User user = MessagesController.getInstance(currentAccount).getUser(UserConfig.getInstance(currentAccount).getClientUserId());
|
TLRPC.User user = MessagesController.getInstance(currentAccount).getUser(UserConfig.getInstance(currentAccount).getClientUserId());
|
||||||
|
@ -4862,7 +4865,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
|
||||||
}
|
}
|
||||||
} else if (chat_id != 0) {
|
} else if (chat_id != 0) {
|
||||||
if (chatInfo != null && (!TextUtils.isEmpty(chatInfo.about) || chatInfo.location instanceof TLRPC.TL_channelLocation) || !TextUtils.isEmpty(currentChat.username)) {
|
if (chatInfo != null && (!TextUtils.isEmpty(chatInfo.about) || chatInfo.location instanceof TLRPC.TL_channelLocation) || !TextUtils.isEmpty(currentChat.username)) {
|
||||||
if (LocaleController.isRTL && ChatObject.isChannel(currentChat) && !currentChat.megagroup && chatInfo.linked_chat_id != 0) {
|
if (LocaleController.isRTL && ChatObject.isChannel(currentChat) && chatInfo != null && !currentChat.megagroup && chatInfo.linked_chat_id != 0) {
|
||||||
emptyRow = rowCount++;
|
emptyRow = rowCount++;
|
||||||
}
|
}
|
||||||
infoHeaderRow = rowCount++;
|
infoHeaderRow = rowCount++;
|
||||||
|
|
|
@ -10,6 +10,7 @@ import android.content.Context;
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
import android.graphics.Canvas;
|
import android.graphics.Canvas;
|
||||||
import android.graphics.Paint;
|
import android.graphics.Paint;
|
||||||
|
import android.graphics.Rect;
|
||||||
import android.graphics.RectF;
|
import android.graphics.RectF;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.graphics.drawable.GradientDrawable;
|
import android.graphics.drawable.GradientDrawable;
|
||||||
|
@ -93,6 +94,7 @@ public class ViewPagerFixed extends FrameLayout {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
private Rect rect = new Rect();
|
||||||
|
|
||||||
public ViewPagerFixed(@NonNull Context context) {
|
public ViewPagerFixed(@NonNull Context context) {
|
||||||
super(context);
|
super(context);
|
||||||
|
@ -270,6 +272,10 @@ public class ViewPagerFixed extends FrameLayout {
|
||||||
velocityTracker.addMovement(ev);
|
velocityTracker.addMovement(ev);
|
||||||
}
|
}
|
||||||
if (ev != null && ev.getAction() == MotionEvent.ACTION_DOWN && checkTabsAnimationInProgress()) {
|
if (ev != null && ev.getAction() == MotionEvent.ACTION_DOWN && checkTabsAnimationInProgress()) {
|
||||||
|
View child = findScrollingChild(this, ev.getX(), ev.getY());
|
||||||
|
if (child != null && (child.canScrollHorizontally(1) || child.canScrollHorizontally(-1))) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
startedTracking = true;
|
startedTracking = true;
|
||||||
startedTrackingPointerId = ev.getPointerId(0);
|
startedTrackingPointerId = ev.getPointerId(0);
|
||||||
startedTrackingX = (int) ev.getX();
|
startedTrackingX = (int) ev.getX();
|
||||||
|
@ -548,7 +554,7 @@ public class ViewPagerFixed extends FrameLayout {
|
||||||
if (direction == 0) {
|
if (direction == 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (tabsAnimationInProgress) {
|
if (tabsAnimationInProgress || startedTracking) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
boolean forward = direction > 0;
|
boolean forward = direction > 0;
|
||||||
|
@ -1389,5 +1395,27 @@ public class ViewPagerFixed extends FrameLayout {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private View findScrollingChild(ViewGroup parent, float x, float y) {
|
||||||
|
int n = parent.getChildCount();
|
||||||
|
for (int i = 0; i < n; i++) {
|
||||||
|
View child = parent.getChildAt(i);
|
||||||
|
if (child.getVisibility() != View.VISIBLE) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
child.getHitRect(rect);
|
||||||
|
if (rect.contains((int) x, (int) y)) {
|
||||||
|
if (child.canScrollHorizontally(-1)) {
|
||||||
|
return child;
|
||||||
|
} else if (child instanceof ViewGroup) {
|
||||||
|
View v = findScrollingChild((ViewGroup) child, x - rect.left, y - rect.top);
|
||||||
|
if (v != null) {
|
||||||
|
return v;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue