Bug fixes

This commit is contained in:
DrKLO 2014-07-12 01:47:50 +04:00
parent adbe66c860
commit fa1734518d
6 changed files with 27 additions and 13 deletions

View File

@ -83,7 +83,7 @@ android {
defaultConfig { defaultConfig {
minSdkVersion 8 minSdkVersion 8
targetSdkVersion 19 targetSdkVersion 19
versionCode 273 versionCode 274
versionName "1.6.0" versionName "1.6.0"
} }
} }

View File

@ -547,9 +547,9 @@ public class NotificationsController {
} }
if (old_unread_count != total_unread_count) { if (old_unread_count != total_unread_count) {
showOrUpdateNotification(notifyCheck); showOrUpdateNotification(notifyCheck);
setBadge(ApplicationLoader.applicationContext, total_unread_count);
notifyCheck = false; notifyCheck = false;
} }
setBadge(ApplicationLoader.applicationContext, total_unread_count);
} }
public void processLoadedUnreadMessages(HashMap<Long, Integer> dialogs) { public void processLoadedUnreadMessages(HashMap<Long, Integer> dialogs) {
@ -569,6 +569,7 @@ public class NotificationsController {
dialogsToLoad += "" + dialog_id; dialogsToLoad += "" + dialog_id;
} }
} }
setBadge(ApplicationLoader.applicationContext, total_unread_count);
} }
private void setBadge(Context context, int count) { private void setBadge(Context context, int count) {

View File

@ -788,6 +788,7 @@ public class ConnectionsManager implements Action.ActionDelegate, TcpConnection.
if (object.layer() > 0) { if (object.layer() > 0) {
Datacenter datacenter = datacenterWithId(datacenterId); Datacenter datacenter = datacenterWithId(datacenterId);
if (datacenter == null || datacenter.lastInitVersion != currentAppVersion) { if (datacenter == null || datacenter.lastInitVersion != currentAppVersion) {
registerForPush();
request.initRequest = true; request.initRequest = true;
TLRPC.initConnection invoke = new TLRPC.initConnection(); TLRPC.initConnection invoke = new TLRPC.initConnection();
invoke.query = object; invoke.query = object;

View File

@ -468,13 +468,11 @@ public class MessageObject {
FileLog.e("tmessages", e); FileLog.e("tmessages", e);
} }
int linesMaxWidth; int linesMaxWidth = (int)Math.ceil(lastLine);
int lastLineWidthWithLeft; int lastLineWidthWithLeft;
int linesMaxWidthWithLeft; int linesMaxWidthWithLeft;
boolean hasNonRTL = false; boolean hasNonRTL = false;
linesMaxWidth = (int)Math.ceil(lastLine);
if (a == blocksCount - 1) { if (a == blocksCount - 1) {
lastLineWidth = linesMaxWidth; lastLineWidth = linesMaxWidth;
} }
@ -494,6 +492,13 @@ public class MessageObject {
lineWidth = 0; lineWidth = 0;
} }
if (lineWidth > maxWidth + 100) {
int start = block.textLayout.getLineStart(n);
int end = block.textLayout.getLineEnd(n);
CharSequence text = block.textLayout.getText().subSequence(start, end);
continue;
}
try { try {
lineLeft = block.textLayout.getLineLeft(n); lineLeft = block.textLayout.getLineLeft(n);
} catch (Exception e) { } catch (Exception e) {

View File

@ -1439,7 +1439,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
public void run() { public void run() {
MessagesController.getInstance().sendMessage(photoFinal, originalPathFinal, dialog_id); MessagesController.getInstance().sendMessage(photoFinal, originalPathFinal, dialog_id);
if (chatListView != null) { if (chatListView != null) {
chatListView.setSelection(messages.size() + 1); chatListView.setSelectionFromTop(messages.size() - 1, -100000 - chatListView.getPaddingTop());
} }
if (paused) { if (paused) {
scrollToTopOnResume = true; scrollToTopOnResume = true;
@ -1528,7 +1528,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
public void run() { public void run() {
MessagesController.getInstance().sendMessage(documentFinal, originalPathFinal, dialog_id); MessagesController.getInstance().sendMessage(documentFinal, originalPathFinal, dialog_id);
if (chatListView != null) { if (chatListView != null) {
chatListView.setSelection(messages.size() + 1); chatListView.setSelectionFromTop(messages.size() - 1, -100000 - chatListView.getPaddingTop());
} }
if (paused) { if (paused) {
scrollToTopOnResume = true; scrollToTopOnResume = true;
@ -1609,7 +1609,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
public void run() { public void run() {
MessagesController.getInstance().sendMessage(videoFinal, originalPathFinal, dialog_id); MessagesController.getInstance().sendMessage(videoFinal, originalPathFinal, dialog_id);
if (chatListView != null) { if (chatListView != null) {
chatListView.setSelection(messages.size() + 1); chatListView.setSelectionFromTop(messages.size() - 1, -100000 - chatListView.getPaddingTop());
} }
if (paused) { if (paused) {
scrollToTopOnResume = true; scrollToTopOnResume = true;
@ -2113,7 +2113,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
} else if (id == 997) { } else if (id == 997) {
MessagesController.getInstance().sendMessage((Double) args[0], (Double) args[1], dialog_id); MessagesController.getInstance().sendMessage((Double) args[0], (Double) args[1], dialog_id);
if (chatListView != null) { if (chatListView != null) {
chatListView.setSelection(messages.size() + 1); chatListView.setSelectionFromTop(messages.size() - 1, -100000 - chatListView.getPaddingTop());
scrollToTopOnResume = true; scrollToTopOnResume = true;
} }
} else if (id == MessagesController.chatInfoDidLoaded) { } else if (id == MessagesController.chatInfoDidLoaded) {
@ -2347,7 +2347,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
} }
} else { } else {
if (chatListView != null) { if (chatListView != null) {
chatListView.setSelection(messages.size() + 1); chatListView.setSelectionFromTop(messages.size() - 1, -100000 - chatListView.getPaddingTop());
} }
} }
scrollToTopUnReadOnResume = false; scrollToTopUnReadOnResume = false;
@ -2768,7 +2768,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
random_ids.add(selectedObject.messageOwner.random_id); random_ids.add(selectedObject.messageOwner.random_id);
} }
MessagesController.getInstance().deleteMessages(arr, random_ids, currentEncryptedChat); MessagesController.getInstance().deleteMessages(arr, random_ids, currentEncryptedChat);
chatListView.setSelection(messages.size() + 1); chatListView.setSelectionFromTop(messages.size() - 1, -100000 - chatListView.getPaddingTop());
} }
} else if (option == 1) { } else if (option == 1) {
if (selectedObject != null) { if (selectedObject != null) {
@ -2843,6 +2843,13 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
MessagesController.getInstance().sendMessage((TLRPC.TL_document)messageObject.messageOwner.media.document, null, did); MessagesController.getInstance().sendMessage((TLRPC.TL_document)messageObject.messageOwner.media.document, null, did);
} else if (messageObject.messageOwner.media.geo instanceof TLRPC.TL_geoPoint) { } else if (messageObject.messageOwner.media.geo instanceof TLRPC.TL_geoPoint) {
MessagesController.getInstance().sendMessage(messageObject.messageOwner.media.geo.lat, messageObject.messageOwner.media.geo._long, did); MessagesController.getInstance().sendMessage(messageObject.messageOwner.media.geo.lat, messageObject.messageOwner.media.geo._long, did);
} else if (messageObject.messageOwner.media.phone_number != null) {
TLRPC.User user = new TLRPC.TL_userContact();
user.phone = messageObject.messageOwner.media.phone_number;
user.first_name = messageObject.messageOwner.media.first_name;
user.last_name = messageObject.messageOwner.media.last_name;
user.id = messageObject.messageOwner.media.user_id;
MessagesController.getInstance().sendMessage(user, did);
} else { } else {
MessagesController.getInstance().sendMessage(messageObject, did); MessagesController.getInstance().sendMessage(messageObject, did);
} }
@ -2900,7 +2907,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
} }
} else { } else {
activity.finishFragment(); activity.finishFragment();
chatListView.setSelection(messages.size() + 1); chatListView.setSelectionFromTop(messages.size() - 1, -100000 - chatListView.getPaddingTop());
scrollToTopOnResume = true; scrollToTopOnResume = true;
} }
} }

View File

@ -218,7 +218,7 @@ public class UserProfileActivity extends BaseFragment implements NotificationCen
return; return;
} }
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity()); AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
builder.setMessage(LocaleController.getString("AreYouSure", R.string.AreYouSure)); builder.setMessage(LocaleController.getString("AreYouSureSecretChat", R.string.AreYouSureSecretChat));
builder.setTitle(LocaleController.getString("AppName", R.string.AppName)); builder.setTitle(LocaleController.getString("AppName", R.string.AppName));
builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), new DialogInterface.OnClickListener() { builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), new DialogInterface.OnClickListener() {
@Override @Override