Bug fixes
|
@ -83,7 +83,7 @@ android {
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
minSdkVersion 8
|
minSdkVersion 8
|
||||||
targetSdkVersion 19
|
targetSdkVersion 19
|
||||||
versionCode 299
|
versionCode 302
|
||||||
versionName "1.7.0"
|
versionName "1.7.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -92,6 +92,8 @@ public class MessagesController implements NotificationCenter.NotificationCenter
|
||||||
|
|
||||||
public boolean enableJoined = true;
|
public boolean enableJoined = true;
|
||||||
public int fontSize = AndroidUtilities.dp(16);
|
public int fontSize = AndroidUtilities.dp(16);
|
||||||
|
public int maxGroupCount = 200;
|
||||||
|
public int maxBroadcastCount = 100;
|
||||||
|
|
||||||
private TLRPC.ChatParticipants currentChatInfo = null;
|
private TLRPC.ChatParticipants currentChatInfo = null;
|
||||||
private int chatParticipantsId = 0;
|
private int chatParticipantsId = 0;
|
||||||
|
@ -191,9 +193,26 @@ public class MessagesController implements NotificationCenter.NotificationCenter
|
||||||
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("Notifications", Activity.MODE_PRIVATE);
|
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("Notifications", Activity.MODE_PRIVATE);
|
||||||
enableJoined = preferences.getBoolean("EnableContactJoined", true);
|
enableJoined = preferences.getBoolean("EnableContactJoined", true);
|
||||||
preferences = ApplicationLoader.applicationContext.getSharedPreferences("mainconfig", Activity.MODE_PRIVATE);
|
preferences = ApplicationLoader.applicationContext.getSharedPreferences("mainconfig", Activity.MODE_PRIVATE);
|
||||||
|
maxGroupCount = preferences.getInt("maxGroupCount", 200);
|
||||||
|
maxBroadcastCount = preferences.getInt("maxBroadcastCount", 100);
|
||||||
fontSize = preferences.getInt("fons_size", 16);
|
fontSize = preferences.getInt("fons_size", 16);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void updateConfig(final TLRPC.TL_config config) {
|
||||||
|
Utilities.RunOnUIThread(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
maxBroadcastCount = config.broadcast_size_max;
|
||||||
|
maxGroupCount = config.chat_size_max;
|
||||||
|
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("mainconfig", Activity.MODE_PRIVATE);
|
||||||
|
SharedPreferences.Editor editor = preferences.edit();
|
||||||
|
editor.putInt("maxGroupCount", maxGroupCount);
|
||||||
|
editor.putInt("maxBroadcastCount", maxBroadcastCount);
|
||||||
|
editor.commit();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
public void addSupportUser() {
|
public void addSupportUser() {
|
||||||
TLRPC.TL_userForeign user = new TLRPC.TL_userForeign();
|
TLRPC.TL_userForeign user = new TLRPC.TL_userForeign();
|
||||||
user.phone = "333";
|
user.phone = "333";
|
||||||
|
@ -4485,38 +4504,6 @@ public class MessagesController implements NotificationCenter.NotificationCenter
|
||||||
}
|
}
|
||||||
NotificationCenter.getInstance().postNotificationName(dialogsNeedReload);
|
NotificationCenter.getInstance().postNotificationName(dialogsNeedReload);
|
||||||
}
|
}
|
||||||
if (!markAsReadMessages.isEmpty()) {
|
|
||||||
for (Integer id : markAsReadMessages) {
|
|
||||||
MessageObject obj = dialogMessage.get(id);
|
|
||||||
if (obj != null) {
|
|
||||||
obj.messageOwner.unread = false;
|
|
||||||
updateMask |= UPDATE_MASK_READ_DIALOG_MESSAGE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!markAsReadEncrypted.isEmpty()) {
|
|
||||||
for (HashMap.Entry<Integer, Integer> entry : markAsReadEncrypted.entrySet()) {
|
|
||||||
NotificationCenter.getInstance().postNotificationName(messagesReadedEncrypted, entry.getKey(), entry.getValue());
|
|
||||||
long dialog_id = (long)(entry.getKey()) << 32;
|
|
||||||
TLRPC.TL_dialog dialog = dialogs_dict.get(dialog_id);
|
|
||||||
if (dialog != null) {
|
|
||||||
MessageObject message = dialogMessage.get(dialog.top_message);
|
|
||||||
if (message != null && message.messageOwner.date <= entry.getValue()) {
|
|
||||||
message.messageOwner.unread = false;
|
|
||||||
updateMask |= UPDATE_MASK_READ_DIALOG_MESSAGE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!deletedMessages.isEmpty()) {
|
|
||||||
NotificationCenter.getInstance().postNotificationName(messagesDeleted, deletedMessages);
|
|
||||||
for (Integer id : deletedMessages) {
|
|
||||||
MessageObject obj = dialogMessage.get(id);
|
|
||||||
if (obj != null) {
|
|
||||||
obj.deleted = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (printChangedArg) {
|
if (printChangedArg) {
|
||||||
updateMask |= UPDATE_MASK_USER_PRINT;
|
updateMask |= UPDATE_MASK_USER_PRINT;
|
||||||
}
|
}
|
||||||
|
@ -4542,9 +4529,44 @@ public class MessagesController implements NotificationCenter.NotificationCenter
|
||||||
Utilities.RunOnUIThread(new Runnable() {
|
Utilities.RunOnUIThread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
int updateMask = 0;
|
||||||
if (!markAsReadMessages.isEmpty()) {
|
if (!markAsReadMessages.isEmpty()) {
|
||||||
NotificationCenter.getInstance().postNotificationName(messagesReaded, markAsReadMessages);
|
NotificationCenter.getInstance().postNotificationName(messagesReaded, markAsReadMessages);
|
||||||
NotificationsController.getInstance().processReadMessages(markAsReadMessages, 0, 0, 0);
|
NotificationsController.getInstance().processReadMessages(markAsReadMessages, 0, 0, 0);
|
||||||
|
|
||||||
|
for (Integer id : markAsReadMessages) {
|
||||||
|
MessageObject obj = dialogMessage.get(id);
|
||||||
|
if (obj != null) {
|
||||||
|
obj.messageOwner.unread = false;
|
||||||
|
updateMask |= UPDATE_MASK_READ_DIALOG_MESSAGE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!markAsReadEncrypted.isEmpty()) {
|
||||||
|
for (HashMap.Entry<Integer, Integer> entry : markAsReadEncrypted.entrySet()) {
|
||||||
|
NotificationCenter.getInstance().postNotificationName(messagesReadedEncrypted, entry.getKey(), entry.getValue());
|
||||||
|
long dialog_id = (long)(entry.getKey()) << 32;
|
||||||
|
TLRPC.TL_dialog dialog = dialogs_dict.get(dialog_id);
|
||||||
|
if (dialog != null) {
|
||||||
|
MessageObject message = dialogMessage.get(dialog.top_message);
|
||||||
|
if (message != null && message.messageOwner.date <= entry.getValue()) {
|
||||||
|
message.messageOwner.unread = false;
|
||||||
|
updateMask |= UPDATE_MASK_READ_DIALOG_MESSAGE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!deletedMessages.isEmpty()) {
|
||||||
|
NotificationCenter.getInstance().postNotificationName(messagesDeleted, deletedMessages);
|
||||||
|
for (Integer id : deletedMessages) {
|
||||||
|
MessageObject obj = dialogMessage.get(id);
|
||||||
|
if (obj != null) {
|
||||||
|
obj.deleted = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (updateMask != 0) {
|
||||||
|
NotificationCenter.getInstance().postNotificationName(updateInterfaces, updateMask);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -4734,7 +4756,6 @@ public class MessagesController implements NotificationCenter.NotificationCenter
|
||||||
TLObject object = TLClassStore.Instance().TLdeserialize(is, is.readInt32());
|
TLObject object = TLClassStore.Instance().TLdeserialize(is, is.readInt32());
|
||||||
BuffersStorage.getInstance().reuseFreeBuffer(is);
|
BuffersStorage.getInstance().reuseFreeBuffer(is);
|
||||||
if (object != null) {
|
if (object != null) {
|
||||||
|
|
||||||
int from_id = chat.admin_id;
|
int from_id = chat.admin_id;
|
||||||
if (from_id == UserConfig.getClientUserId()) {
|
if (from_id == UserConfig.getClientUserId()) {
|
||||||
from_id = chat.participant_id;
|
from_id = chat.participant_id;
|
||||||
|
@ -4943,6 +4964,8 @@ public class MessagesController implements NotificationCenter.NotificationCenter
|
||||||
pendingEncMessagesToDelete.addAll(serviceMessage.action.random_ids);
|
pendingEncMessagesToDelete.addAll(serviceMessage.action.random_ids);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
FileLog.e("tmessages", "unkown message " + object);
|
FileLog.e("tmessages", "unkown message " + object);
|
||||||
|
@ -4951,9 +4974,9 @@ public class MessagesController implements NotificationCenter.NotificationCenter
|
||||||
FileLog.e("tmessages", "unkown TLObject");
|
FileLog.e("tmessages", "unkown TLObject");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
BuffersStorage.getInstance().reuseFreeBuffer(is);
|
||||||
FileLog.e("tmessages", "fingerprint mismatch");
|
FileLog.e("tmessages", "fingerprint mismatch");
|
||||||
}
|
}
|
||||||
BuffersStorage.getInstance().reuseFreeBuffer(is);
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -781,6 +781,7 @@ public class ConnectionsManager implements Action.ActionDelegate, TcpConnection.
|
||||||
|
|
||||||
processRequestQueue(RPCRequest.RPCRequestClassTransportMask, 0);
|
processRequestQueue(RPCRequest.RPCRequestClassTransportMask, 0);
|
||||||
}
|
}
|
||||||
|
MessagesController.getInstance().updateConfig(config);
|
||||||
}
|
}
|
||||||
updatingDcSettings = false;
|
updatingDcSettings = false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -509,7 +509,6 @@ public class FileLoadOperation {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -675,7 +674,11 @@ public class FileLoadOperation {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
httpTask = new DownloadImageTask();
|
httpTask = new DownloadImageTask();
|
||||||
httpTask.doInBackground(httpUrl);
|
if (android.os.Build.VERSION.SDK_INT >= 11) {
|
||||||
|
httpTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, null, null, null);
|
||||||
|
} else {
|
||||||
|
httpTask.execute(null, null, null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void processRequestResult(RequestInfo requestInfo, TLRPC.TL_error error) {
|
private void processRequestResult(RequestInfo requestInfo, TLRPC.TL_error error) {
|
||||||
|
|
|
@ -39,7 +39,6 @@ public class MessageObject {
|
||||||
public int contentType;
|
public int contentType;
|
||||||
public ArrayList<PhotoObject> photoThumbs;
|
public ArrayList<PhotoObject> photoThumbs;
|
||||||
public Bitmap imagePreview;
|
public Bitmap imagePreview;
|
||||||
public PhotoObject previewPhoto;
|
|
||||||
public String dateKey;
|
public String dateKey;
|
||||||
public boolean deleted = false;
|
public boolean deleted = false;
|
||||||
public float audioProgress;
|
public float audioProgress;
|
||||||
|
@ -138,10 +137,6 @@ public class MessageObject {
|
||||||
messageText = LocaleController.getString("ActionAddUser", R.string.ActionAddUser).replace("un2", "").replace("un1", "");
|
messageText = LocaleController.getString("ActionAddUser", R.string.ActionAddUser).replace("un2", "").replace("un1", "");
|
||||||
}
|
}
|
||||||
} else if (message.action instanceof TLRPC.TL_messageActionChatEditPhoto) {
|
} else if (message.action instanceof TLRPC.TL_messageActionChatEditPhoto) {
|
||||||
photoThumbs = new ArrayList<PhotoObject>();
|
|
||||||
for (TLRPC.PhotoSize size : message.action.photo.sizes) {
|
|
||||||
photoThumbs.add(new PhotoObject(size, preview));
|
|
||||||
}
|
|
||||||
if (isFromMe()) {
|
if (isFromMe()) {
|
||||||
messageText = LocaleController.getString("ActionYouChangedPhoto", R.string.ActionYouChangedPhoto);
|
messageText = LocaleController.getString("ActionYouChangedPhoto", R.string.ActionYouChangedPhoto);
|
||||||
} else {
|
} else {
|
||||||
|
@ -242,22 +237,8 @@ public class MessageObject {
|
||||||
}
|
}
|
||||||
} else if (message.media != null && !(message.media instanceof TLRPC.TL_messageMediaEmpty)) {
|
} else if (message.media != null && !(message.media instanceof TLRPC.TL_messageMediaEmpty)) {
|
||||||
if (message.media instanceof TLRPC.TL_messageMediaPhoto) {
|
if (message.media instanceof TLRPC.TL_messageMediaPhoto) {
|
||||||
photoThumbs = new ArrayList<PhotoObject>();
|
|
||||||
for (TLRPC.PhotoSize size : message.media.photo.sizes) {
|
|
||||||
PhotoObject obj = new PhotoObject(size, preview);
|
|
||||||
photoThumbs.add(obj);
|
|
||||||
if (imagePreview == null && obj.image != null) {
|
|
||||||
imagePreview = obj.image;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
messageText = LocaleController.getString("AttachPhoto", R.string.AttachPhoto);
|
messageText = LocaleController.getString("AttachPhoto", R.string.AttachPhoto);
|
||||||
} else if (message.media instanceof TLRPC.TL_messageMediaVideo) {
|
} else if (message.media instanceof TLRPC.TL_messageMediaVideo) {
|
||||||
photoThumbs = new ArrayList<PhotoObject>();
|
|
||||||
PhotoObject obj = new PhotoObject(message.media.video.thumb, preview);
|
|
||||||
photoThumbs.add(obj);
|
|
||||||
if (imagePreview == null && obj.image != null) {
|
|
||||||
imagePreview = obj.image;
|
|
||||||
}
|
|
||||||
messageText = LocaleController.getString("AttachVideo", R.string.AttachVideo);
|
messageText = LocaleController.getString("AttachVideo", R.string.AttachVideo);
|
||||||
} else if (message.media instanceof TLRPC.TL_messageMediaGeo) {
|
} else if (message.media instanceof TLRPC.TL_messageMediaGeo) {
|
||||||
messageText = LocaleController.getString("AttachLocation", R.string.AttachLocation);
|
messageText = LocaleController.getString("AttachLocation", R.string.AttachLocation);
|
||||||
|
@ -266,11 +247,6 @@ public class MessageObject {
|
||||||
} else if (message.media instanceof TLRPC.TL_messageMediaUnsupported) {
|
} else if (message.media instanceof TLRPC.TL_messageMediaUnsupported) {
|
||||||
messageText = LocaleController.getString("UnsuppotedMedia", R.string.UnsuppotedMedia);
|
messageText = LocaleController.getString("UnsuppotedMedia", R.string.UnsuppotedMedia);
|
||||||
} else if (message.media instanceof TLRPC.TL_messageMediaDocument) {
|
} else if (message.media instanceof TLRPC.TL_messageMediaDocument) {
|
||||||
if (!(message.media.document.thumb instanceof TLRPC.TL_photoSizeEmpty)) {
|
|
||||||
photoThumbs = new ArrayList<PhotoObject>();
|
|
||||||
PhotoObject obj = new PhotoObject(message.media.document.thumb, preview);
|
|
||||||
photoThumbs.add(obj);
|
|
||||||
}
|
|
||||||
messageText = LocaleController.getString("AttachDocument", R.string.AttachDocument);
|
messageText = LocaleController.getString("AttachDocument", R.string.AttachDocument);
|
||||||
} else if (message.media instanceof TLRPC.TL_messageMediaAudio) {
|
} else if (message.media instanceof TLRPC.TL_messageMediaAudio) {
|
||||||
messageText = LocaleController.getString("AttachAudio", R.string.AttachAudio);
|
messageText = LocaleController.getString("AttachAudio", R.string.AttachAudio);
|
||||||
|
@ -335,6 +311,80 @@ public class MessageObject {
|
||||||
dateKey = String.format("%d_%02d_%02d", dateYear, dateMonth, dateDay);
|
dateKey = String.format("%d_%02d_%02d", dateYear, dateMonth, dateDay);
|
||||||
|
|
||||||
generateLayout();
|
generateLayout();
|
||||||
|
generateThumbs(false, preview);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void generateThumbs(boolean update, int preview) {
|
||||||
|
if (messageOwner instanceof TLRPC.TL_messageService) {
|
||||||
|
if (messageOwner.action instanceof TLRPC.TL_messageActionChatEditPhoto) {
|
||||||
|
if (!update) {
|
||||||
|
photoThumbs = new ArrayList<PhotoObject>();
|
||||||
|
for (TLRPC.PhotoSize size : messageOwner.action.photo.sizes) {
|
||||||
|
photoThumbs.add(new PhotoObject(size, preview));
|
||||||
|
}
|
||||||
|
} else if (photoThumbs != null && !photoThumbs.isEmpty()) {
|
||||||
|
for (PhotoObject photoObject : photoThumbs) {
|
||||||
|
for (TLRPC.PhotoSize size : messageOwner.action.photo.sizes) {
|
||||||
|
if (size instanceof TLRPC.TL_photoSizeEmpty) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (size.type.equals(photoObject.photoOwner.type)) {
|
||||||
|
photoObject.photoOwner.location = size.location;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (messageOwner.media != null && !(messageOwner.media instanceof TLRPC.TL_messageMediaEmpty)) {
|
||||||
|
if (messageOwner.media instanceof TLRPC.TL_messageMediaPhoto) {
|
||||||
|
if (!update) {
|
||||||
|
photoThumbs = new ArrayList<PhotoObject>();
|
||||||
|
for (TLRPC.PhotoSize size : messageOwner.media.photo.sizes) {
|
||||||
|
PhotoObject obj = new PhotoObject(size, preview);
|
||||||
|
photoThumbs.add(obj);
|
||||||
|
if (imagePreview == null && obj.image != null) {
|
||||||
|
imagePreview = obj.image;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (photoThumbs != null && !photoThumbs.isEmpty()) {
|
||||||
|
for (PhotoObject photoObject : photoThumbs) {
|
||||||
|
for (TLRPC.PhotoSize size : messageOwner.media.photo.sizes) {
|
||||||
|
if (size instanceof TLRPC.TL_photoSizeEmpty) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (size.type.equals(photoObject.photoOwner.type)) {
|
||||||
|
photoObject.photoOwner.location = size.location;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (messageOwner.media instanceof TLRPC.TL_messageMediaVideo) {
|
||||||
|
if (!update) {
|
||||||
|
photoThumbs = new ArrayList<PhotoObject>();
|
||||||
|
PhotoObject obj = new PhotoObject(messageOwner.media.video.thumb, preview);
|
||||||
|
photoThumbs.add(obj);
|
||||||
|
if (imagePreview == null && obj.image != null) {
|
||||||
|
imagePreview = obj.image;
|
||||||
|
}
|
||||||
|
} else if (photoThumbs != null && !photoThumbs.isEmpty() && messageOwner.media.video.thumb != null) {
|
||||||
|
PhotoObject photoObject = photoThumbs.get(0);
|
||||||
|
photoObject.photoOwner.location = messageOwner.media.video.thumb.location;
|
||||||
|
}
|
||||||
|
} if (messageOwner.media instanceof TLRPC.TL_messageMediaDocument) {
|
||||||
|
if (!(messageOwner.media.document.thumb instanceof TLRPC.TL_photoSizeEmpty)) {
|
||||||
|
if (!update) {
|
||||||
|
photoThumbs = new ArrayList<PhotoObject>();
|
||||||
|
PhotoObject obj = new PhotoObject(messageOwner.media.document.thumb, preview);
|
||||||
|
photoThumbs.add(obj);
|
||||||
|
} else if (photoThumbs != null && !photoThumbs.isEmpty() && messageOwner.media.document.thumb != null) {
|
||||||
|
PhotoObject photoObject = photoThumbs.get(0);
|
||||||
|
photoObject.photoOwner.location = messageOwner.media.video.thumb.location;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getFileName() {
|
public String getFileName() {
|
||||||
|
|
|
@ -8,7 +8,6 @@
|
||||||
|
|
||||||
package org.telegram.ui;
|
package org.telegram.ui;
|
||||||
|
|
||||||
import android.app.Activity;
|
|
||||||
import android.app.AlarmManager;
|
import android.app.AlarmManager;
|
||||||
import android.app.Application;
|
import android.app.Application;
|
||||||
import android.app.PendingIntent;
|
import android.app.PendingIntent;
|
||||||
|
@ -93,34 +92,6 @@ public class ApplicationLoader extends Application {
|
||||||
|
|
||||||
UserConfig.loadConfig();
|
UserConfig.loadConfig();
|
||||||
if (UserConfig.getCurrentUser() != null) {
|
if (UserConfig.getCurrentUser() != null) {
|
||||||
boolean changed = false;
|
|
||||||
SharedPreferences preferences = applicationContext.getSharedPreferences("Notifications", MODE_PRIVATE);
|
|
||||||
int v = preferences.getInt("v", 0);
|
|
||||||
if (v != 1) {
|
|
||||||
SharedPreferences preferences2 = ApplicationLoader.applicationContext.getSharedPreferences("mainconfig", Activity.MODE_PRIVATE);
|
|
||||||
SharedPreferences.Editor editor = preferences2.edit();
|
|
||||||
if (preferences.contains("view_animations")) {
|
|
||||||
editor.putBoolean("view_animations", preferences.getBoolean("view_animations", false));
|
|
||||||
}
|
|
||||||
if (preferences.contains("selectedBackground")) {
|
|
||||||
editor.putInt("selectedBackground", preferences.getInt("selectedBackground", 1000001));
|
|
||||||
}
|
|
||||||
if (preferences.contains("selectedColor")) {
|
|
||||||
editor.putInt("selectedColor", preferences.getInt("selectedColor", 0));
|
|
||||||
}
|
|
||||||
if (preferences.contains("fons_size")) {
|
|
||||||
editor.putInt("fons_size", preferences.getInt("fons_size", 16));
|
|
||||||
}
|
|
||||||
editor.commit();
|
|
||||||
editor = preferences.edit();
|
|
||||||
editor.putInt("v", 1);
|
|
||||||
editor.remove("view_animations");
|
|
||||||
editor.remove("selectedBackground");
|
|
||||||
editor.remove("selectedColor");
|
|
||||||
editor.remove("fons_size");
|
|
||||||
editor.commit();
|
|
||||||
}
|
|
||||||
|
|
||||||
MessagesController.getInstance().users.put(UserConfig.getClientUserId(), UserConfig.getCurrentUser());
|
MessagesController.getInstance().users.put(UserConfig.getClientUserId(), UserConfig.getCurrentUser());
|
||||||
ConnectionsManager.getInstance().applyCountryPortNumber(UserConfig.getCurrentUser().phone);
|
ConnectionsManager.getInstance().applyCountryPortNumber(UserConfig.getCurrentUser().phone);
|
||||||
ConnectionsManager.getInstance().initPushConnection();
|
ConnectionsManager.getInstance().initPushConnection();
|
||||||
|
|
|
@ -60,9 +60,11 @@ public class ChatBaseCell extends BaseCell {
|
||||||
private static Drawable checkDrawable;
|
private static Drawable checkDrawable;
|
||||||
private static Drawable halfCheckDrawable;
|
private static Drawable halfCheckDrawable;
|
||||||
private static Drawable clockDrawable;
|
private static Drawable clockDrawable;
|
||||||
|
private static Drawable broadcastDrawable;
|
||||||
private static Drawable checkMediaDrawable;
|
private static Drawable checkMediaDrawable;
|
||||||
private static Drawable halfCheckMediaDrawable;
|
private static Drawable halfCheckMediaDrawable;
|
||||||
private static Drawable clockMediaDrawable;
|
private static Drawable clockMediaDrawable;
|
||||||
|
private static Drawable broadcastMediaDrawable;
|
||||||
private static Drawable errorDrawable;
|
private static Drawable errorDrawable;
|
||||||
protected static Drawable mediaBackgroundDrawable;
|
protected static Drawable mediaBackgroundDrawable;
|
||||||
private static TextPaint timePaintIn;
|
private static TextPaint timePaintIn;
|
||||||
|
@ -177,6 +179,8 @@ public class ChatBaseCell extends BaseCell {
|
||||||
clockMediaDrawable = getResources().getDrawable(R.drawable.msg_clock_photo);
|
clockMediaDrawable = getResources().getDrawable(R.drawable.msg_clock_photo);
|
||||||
errorDrawable = getResources().getDrawable(R.drawable.msg_warning);
|
errorDrawable = getResources().getDrawable(R.drawable.msg_warning);
|
||||||
mediaBackgroundDrawable = getResources().getDrawable(R.drawable.phototime);
|
mediaBackgroundDrawable = getResources().getDrawable(R.drawable.phototime);
|
||||||
|
broadcastDrawable = getResources().getDrawable(R.drawable.broadcast3);
|
||||||
|
broadcastMediaDrawable = getResources().getDrawable(R.drawable.broadcast4);
|
||||||
|
|
||||||
timePaintIn = new TextPaint(TextPaint.ANTI_ALIAS_FLAG);
|
timePaintIn = new TextPaint(TextPaint.ANTI_ALIAS_FLAG);
|
||||||
timePaintIn.setTextSize(AndroidUtilities.dp(12));
|
timePaintIn.setTextSize(AndroidUtilities.dp(12));
|
||||||
|
@ -569,6 +573,7 @@ public class ChatBaseCell extends BaseCell {
|
||||||
boolean drawCheck2 = false;
|
boolean drawCheck2 = false;
|
||||||
boolean drawClock = false;
|
boolean drawClock = false;
|
||||||
boolean drawError = false;
|
boolean drawError = false;
|
||||||
|
boolean isBroadcast = (int)(currentMessageObject.getDialogId() >> 32) == 1;
|
||||||
|
|
||||||
if (currentMessageObject.messageOwner.send_state == MessagesController.MESSAGE_SEND_STATE_SENDING) {
|
if (currentMessageObject.messageOwner.send_state == MessagesController.MESSAGE_SEND_STATE_SENDING) {
|
||||||
drawCheck1 = false;
|
drawCheck1 = false;
|
||||||
|
@ -601,30 +606,42 @@ public class ChatBaseCell extends BaseCell {
|
||||||
clockMediaDrawable.draw(canvas);
|
clockMediaDrawable.draw(canvas);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (drawCheck2) {
|
if (isBroadcast) {
|
||||||
if (!media) {
|
if (drawCheck1 || drawCheck2) {
|
||||||
if (drawCheck1) {
|
if (!media) {
|
||||||
setDrawableBounds(checkDrawable, layoutWidth - AndroidUtilities.dpf(22.5f) - checkDrawable.getIntrinsicWidth(), layoutHeight - AndroidUtilities.dpf(8.5f) - checkDrawable.getIntrinsicHeight());
|
setDrawableBounds(broadcastDrawable, layoutWidth - AndroidUtilities.dpf(20.5f) - broadcastDrawable.getIntrinsicWidth(), layoutHeight - AndroidUtilities.dpf(8.0f) - broadcastDrawable.getIntrinsicHeight());
|
||||||
|
broadcastDrawable.draw(canvas);
|
||||||
} else {
|
} else {
|
||||||
setDrawableBounds(checkDrawable, layoutWidth - AndroidUtilities.dpf(18.5f) - checkDrawable.getIntrinsicWidth(), layoutHeight - AndroidUtilities.dpf(8.5f) - checkDrawable.getIntrinsicHeight());
|
setDrawableBounds(broadcastMediaDrawable, layoutWidth - AndroidUtilities.dpf(24.0f) - broadcastMediaDrawable.getIntrinsicWidth(), layoutHeight - AndroidUtilities.dpf(13.0f) - broadcastMediaDrawable.getIntrinsicHeight());
|
||||||
|
broadcastMediaDrawable.draw(canvas);
|
||||||
}
|
}
|
||||||
checkDrawable.draw(canvas);
|
|
||||||
} else {
|
|
||||||
if (drawCheck1) {
|
|
||||||
setDrawableBounds(checkMediaDrawable, layoutWidth - AndroidUtilities.dpf(26.0f) - checkMediaDrawable.getIntrinsicWidth(), layoutHeight - AndroidUtilities.dpf(13.0f) - checkMediaDrawable.getIntrinsicHeight());
|
|
||||||
} else {
|
|
||||||
setDrawableBounds(checkMediaDrawable, layoutWidth - AndroidUtilities.dpf(22.0f) - checkMediaDrawable.getIntrinsicWidth(), layoutHeight - AndroidUtilities.dpf(13.0f) - checkMediaDrawable.getIntrinsicHeight());
|
|
||||||
}
|
|
||||||
checkMediaDrawable.draw(canvas);
|
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
if (drawCheck1) {
|
if (drawCheck2) {
|
||||||
if (!media) {
|
if (!media) {
|
||||||
setDrawableBounds(halfCheckDrawable, layoutWidth - AndroidUtilities.dp(18) - halfCheckDrawable.getIntrinsicWidth(), layoutHeight - AndroidUtilities.dpf(8.5f) - halfCheckDrawable.getIntrinsicHeight());
|
if (drawCheck1) {
|
||||||
halfCheckDrawable.draw(canvas);
|
setDrawableBounds(checkDrawable, layoutWidth - AndroidUtilities.dpf(22.5f) - checkDrawable.getIntrinsicWidth(), layoutHeight - AndroidUtilities.dpf(8.5f) - checkDrawable.getIntrinsicHeight());
|
||||||
} else {
|
} else {
|
||||||
setDrawableBounds(halfCheckMediaDrawable, layoutWidth - AndroidUtilities.dpf(20.5f) - halfCheckMediaDrawable.getIntrinsicWidth(), layoutHeight - AndroidUtilities.dpf(13.0f) - halfCheckMediaDrawable.getIntrinsicHeight());
|
setDrawableBounds(checkDrawable, layoutWidth - AndroidUtilities.dpf(18.5f) - checkDrawable.getIntrinsicWidth(), layoutHeight - AndroidUtilities.dpf(8.5f) - checkDrawable.getIntrinsicHeight());
|
||||||
halfCheckMediaDrawable.draw(canvas);
|
}
|
||||||
|
checkDrawable.draw(canvas);
|
||||||
|
} else {
|
||||||
|
if (drawCheck1) {
|
||||||
|
setDrawableBounds(checkMediaDrawable, layoutWidth - AndroidUtilities.dpf(26.0f) - checkMediaDrawable.getIntrinsicWidth(), layoutHeight - AndroidUtilities.dpf(13.0f) - checkMediaDrawable.getIntrinsicHeight());
|
||||||
|
} else {
|
||||||
|
setDrawableBounds(checkMediaDrawable, layoutWidth - AndroidUtilities.dpf(22.0f) - checkMediaDrawable.getIntrinsicWidth(), layoutHeight - AndroidUtilities.dpf(13.0f) - checkMediaDrawable.getIntrinsicHeight());
|
||||||
|
}
|
||||||
|
checkMediaDrawable.draw(canvas);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (drawCheck1) {
|
||||||
|
if (!media) {
|
||||||
|
setDrawableBounds(halfCheckDrawable, layoutWidth - AndroidUtilities.dp(18) - halfCheckDrawable.getIntrinsicWidth(), layoutHeight - AndroidUtilities.dpf(8.5f) - halfCheckDrawable.getIntrinsicHeight());
|
||||||
|
halfCheckDrawable.draw(canvas);
|
||||||
|
} else {
|
||||||
|
setDrawableBounds(halfCheckMediaDrawable, layoutWidth - AndroidUtilities.dpf(20.5f) - halfCheckMediaDrawable.getIntrinsicWidth(), layoutHeight - AndroidUtilities.dpf(13.0f) - halfCheckMediaDrawable.getIntrinsicHeight());
|
||||||
|
halfCheckMediaDrawable.draw(canvas);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (drawError) {
|
if (drawError) {
|
||||||
|
|
|
@ -2161,6 +2161,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
MessageObject newMsgObj = (MessageObject)args[2];
|
MessageObject newMsgObj = (MessageObject)args[2];
|
||||||
if (newMsgObj != null) {
|
if (newMsgObj != null) {
|
||||||
obj.messageOwner.media = newMsgObj.messageOwner.media;
|
obj.messageOwner.media = newMsgObj.messageOwner.media;
|
||||||
|
obj.generateThumbs(true, 1);
|
||||||
}
|
}
|
||||||
messagesDict.remove(msgId);
|
messagesDict.remove(msgId);
|
||||||
messagesDict.put(newMsgId, obj);
|
messagesDict.put(newMsgId, obj);
|
||||||
|
|
|
@ -143,7 +143,8 @@ public class ChatProfileActivity extends BaseFragment implements NotificationCen
|
||||||
membersSectionRow = rowCount++;
|
membersSectionRow = rowCount++;
|
||||||
rowCount += info.participants.size();
|
rowCount += info.participants.size();
|
||||||
membersEndRow = rowCount;
|
membersEndRow = rowCount;
|
||||||
if (info.participants.size() < 200) {
|
int maxCount = chat_id > 0 ? MessagesController.getInstance().maxGroupCount : MessagesController.getInstance().maxBroadcastCount;
|
||||||
|
if (info.participants.size() < maxCount) {
|
||||||
addMemberRow = rowCount++;
|
addMemberRow = rowCount++;
|
||||||
} else {
|
} else {
|
||||||
addMemberRow = -1;
|
addMemberRow = -1;
|
||||||
|
|
|
@ -91,6 +91,7 @@ public class GroupCreateActivity extends BaseFragment implements NotificationCen
|
||||||
private EditText userSelectEditText;
|
private EditText userSelectEditText;
|
||||||
private boolean ignoreChange = false;
|
private boolean ignoreChange = false;
|
||||||
private boolean isBroadcast = false;
|
private boolean isBroadcast = false;
|
||||||
|
private int maxCount = 200;
|
||||||
|
|
||||||
private HashMap<Integer, XImageSpan> selectedContacts = new HashMap<Integer, XImageSpan>();
|
private HashMap<Integer, XImageSpan> selectedContacts = new HashMap<Integer, XImageSpan>();
|
||||||
private ArrayList<XImageSpan> allSpans = new ArrayList<XImageSpan>();
|
private ArrayList<XImageSpan> allSpans = new ArrayList<XImageSpan>();
|
||||||
|
@ -113,6 +114,7 @@ public class GroupCreateActivity extends BaseFragment implements NotificationCen
|
||||||
public GroupCreateActivity(Bundle args) {
|
public GroupCreateActivity(Bundle args) {
|
||||||
super(args);
|
super(args);
|
||||||
isBroadcast = args.getBoolean("broadcast", false);
|
isBroadcast = args.getBoolean("broadcast", false);
|
||||||
|
maxCount = !isBroadcast ? MessagesController.getInstance().maxGroupCount : MessagesController.getInstance().maxBroadcastCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -141,7 +143,7 @@ public class GroupCreateActivity extends BaseFragment implements NotificationCen
|
||||||
} else {
|
} else {
|
||||||
actionBarLayer.setTitle(LocaleController.getString("NewGroup", R.string.NewGroup));
|
actionBarLayer.setTitle(LocaleController.getString("NewGroup", R.string.NewGroup));
|
||||||
}
|
}
|
||||||
actionBarLayer.setSubtitle(LocaleController.formatString("MembersCount", R.string.MembersCount, selectedContacts.size(), 200));
|
actionBarLayer.setSubtitle(LocaleController.formatString("MembersCount", R.string.MembersCount, selectedContacts.size(), maxCount));
|
||||||
|
|
||||||
actionBarLayer.setActionBarMenuOnItemClick(new ActionBarLayer.ActionBarMenuOnItemClick() {
|
actionBarLayer.setActionBarMenuOnItemClick(new ActionBarLayer.ActionBarMenuOnItemClick() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -216,7 +218,7 @@ public class GroupCreateActivity extends BaseFragment implements NotificationCen
|
||||||
selectedContacts.remove(sp.uid);
|
selectedContacts.remove(sp.uid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
actionBarLayer.setSubtitle(LocaleController.formatString("MembersCount", R.string.MembersCount, selectedContacts.size(), 200));
|
actionBarLayer.setSubtitle(LocaleController.formatString("MembersCount", R.string.MembersCount, selectedContacts.size(), maxCount));
|
||||||
listView.invalidateViews();
|
listView.invalidateViews();
|
||||||
} else {
|
} else {
|
||||||
search = true;
|
search = true;
|
||||||
|
@ -274,7 +276,7 @@ public class GroupCreateActivity extends BaseFragment implements NotificationCen
|
||||||
userSelectEditText.setSelection(text.length());
|
userSelectEditText.setSelection(text.length());
|
||||||
ignoreChange = false;
|
ignoreChange = false;
|
||||||
} else {
|
} else {
|
||||||
if (selectedContacts.size() == 200) {
|
if (selectedContacts.size() == maxCount) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ignoreChange = true;
|
ignoreChange = true;
|
||||||
|
@ -282,7 +284,7 @@ public class GroupCreateActivity extends BaseFragment implements NotificationCen
|
||||||
span.uid = user.id;
|
span.uid = user.id;
|
||||||
ignoreChange = false;
|
ignoreChange = false;
|
||||||
}
|
}
|
||||||
actionBarLayer.setSubtitle(LocaleController.formatString("MembersCount", R.string.MembersCount, selectedContacts.size(), 200));
|
actionBarLayer.setSubtitle(LocaleController.formatString("MembersCount", R.string.MembersCount, selectedContacts.size(), maxCount));
|
||||||
if (searching || searchWas) {
|
if (searching || searchWas) {
|
||||||
searching = false;
|
searching = false;
|
||||||
searchWas = false;
|
searchWas = false;
|
||||||
|
|
BIN
TMessagesProj/src/main/res/drawable-hdpi/broadcast3.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
TMessagesProj/src/main/res/drawable-hdpi/broadcast4.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
TMessagesProj/src/main/res/drawable-ldpi/broadcast3.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
TMessagesProj/src/main/res/drawable-ldpi/broadcast4.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
TMessagesProj/src/main/res/drawable-mdpi/broadcast3.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
TMessagesProj/src/main/res/drawable-mdpi/broadcast4.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
TMessagesProj/src/main/res/drawable-xhdpi/broadcast3.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
TMessagesProj/src/main/res/drawable-xhdpi/broadcast4.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
TMessagesProj/src/main/res/drawable-xxhdpi/broadcast3.png
Normal file
After Width: | Height: | Size: 1.4 KiB |
BIN
TMessagesProj/src/main/res/drawable-xxhdpi/broadcast4.png
Normal file
After Width: | Height: | Size: 1.3 KiB |