Bug fixes

This commit is contained in:
DrKLO 2014-11-20 17:45:33 +03:00
parent dd61bbaa7a
commit a38e46cd8b
19 changed files with 183 additions and 119 deletions

View File

@ -80,7 +80,7 @@ android {
defaultConfig {
minSdkVersion 8
targetSdkVersion 21
versionCode 391
versionName "2.0.2"
versionCode 392
versionName "2.0.3"
}
}

View File

@ -1636,6 +1636,9 @@ public class ContactsController {
TLRPC.User toDbUser = new TLRPC.User();
TLRPC.TL_contactStatus status = (TLRPC.TL_contactStatus) object;
if (status == null) {
continue;
}
if (status.status instanceof TLRPC.TL_userStatusRecently) {
status.status.expires = -100;
} else if (status.status instanceof TLRPC.TL_userStatusLastWeek) {

View File

@ -1062,12 +1062,12 @@ public class MessagesController implements NotificationCenter.NotificationCenter
if (offset == 0) {
MessagesStorage.getInstance().deleteDialog(did, onlyHistory);
}
TLRPC.TL_dialog dialog = dialogs_dict.get(did);
if (dialog != null) {
int lower_part = (int)did;
int high_id = (int)(did >> 32);
if (offset == 0) {
TLRPC.TL_dialog dialog = dialogs_dict.get(did);
if (!onlyHistory) {
dialogs.remove(dialog);
dialogsServerOnly.remove(dialog);
@ -1135,7 +1135,6 @@ public class MessagesController implements NotificationCenter.NotificationCenter
}
}
}
}
public void loadChatInfo(final int chat_id, Semaphore semaphore) {
MessagesStorage.getInstance().loadChatInfo(chat_id, semaphore);
@ -1455,6 +1454,7 @@ public class MessagesController implements NotificationCenter.NotificationCenter
return;
}
loadingDialogs = true;
NotificationCenter.getInstance().postNotificationName(NotificationCenter.dialogsNeedReload);
if (fromCache) {
MessagesStorage.getInstance().getDialogs(offset, serverOffset, count);

View File

@ -397,6 +397,10 @@ public class NotificationsController {
.setGroup("messages")
.setGroupSummary(true);
//if (ApplicationLoader.mainInterfacePaused) {
// mBuilder.setPriority(NotificationCompat.PRIORITY_HIGH);
//}
String lastMessage = null;
String lastMessageFull = null;
if (pushMessages.size() == 1) {

View File

@ -2236,6 +2236,17 @@ public class ConnectionsManager implements Action.ActionDelegate, TcpConnection.
lastOutgoingMessageId = Math.max(messageId, lastOutgoingMessageId);
}
long resultMid = ((TLRPC.TL_bad_server_salt) message).bad_msg_id;
if (resultMid != 0) {
for (RPCRequest request : runningRequests) {
if ((request.flags & RPCRequest.RPCRequestClassDownloadMedia) == 0) {
continue;
}
if (request.respondsToMessageId(resultMid)) {
request.retryCount = 0;
}
}
}
datacenter.clearServerSalts();

View File

@ -628,8 +628,7 @@ public class ActionBarLayout extends FrameLayout {
currentAnimation = new AnimatorSetProxy();
currentAnimation.playTogether(
ObjectAnimatorProxy.ofFloat(containerView, "alpha", 0.0f, 1.0f),
ObjectAnimatorProxy.ofFloat(containerView, "scaleX", 0.8f, 1.0f),
ObjectAnimatorProxy.ofFloat(containerView, "scaleY", 0.8f, 1.0f));
ObjectAnimatorProxy.ofFloat(containerView, "translationY", AndroidUtilities.dp(48), 0));
currentAnimation.setInterpolator(new DecelerateInterpolator(1.5f));
currentAnimation.setDuration(200);
currentAnimation.addListener(new AnimatorListenerAdapterProxy() {
@ -731,14 +730,14 @@ public class ActionBarLayout extends FrameLayout {
@Override
public void run() {
closeLastFragmentInternalRemoveOld(currentFragment);
ViewProxy.setTranslationY(containerViewBack, 0);
}
};
currentAnimation = new AnimatorSetProxy();
currentAnimation.playTogether(
ObjectAnimatorProxy.ofFloat(containerViewBack, "alpha", 1.0f, 0.0f),
ObjectAnimatorProxy.ofFloat(containerViewBack, "scaleX", 1.0f, 0.8f),
ObjectAnimatorProxy.ofFloat(containerViewBack, "scaleY", 1.0f, 0.8f));
ObjectAnimatorProxy.ofFloat(containerViewBack, "translationY", 0, AndroidUtilities.dp(48)));
currentAnimation.setInterpolator(new DecelerateInterpolator(1.5f));
currentAnimation.setDuration(200);
currentAnimation.addListener(new AnimatorListenerAdapterProxy() {

View File

@ -134,8 +134,9 @@ public class ActionBarMenu extends LinearLayout {
View view = getChildAt(a);
if (view instanceof ActionBarMenuItem) {
ActionBarMenuItem item = (ActionBarMenuItem)view;
if (item.hasSubMenu()) {
if (item.hasSubMenu() && item.getVisibility() == VISIBLE) {
item.toggleSubMenu();
break;
}
}
}

View File

@ -214,6 +214,7 @@ public class BaseFragment {
} catch (Exception e) {
FileLog.e("tmessages", e);
}
try {
visibleDialog = builder.show();
visibleDialog.setCanceledOnTouchOutside(true);
visibleDialog.setOnDismissListener(new DialogInterface.OnDismissListener() {
@ -223,6 +224,9 @@ public class BaseFragment {
onDialogDismiss();
}
});
} catch (Exception e) {
FileLog.e("tmessages", e);
}
}
protected void onDialogDismiss() {

View File

@ -52,8 +52,10 @@ public class ContactsAdapter extends BaseSectionsAdapter {
if (onlyUsers) {
if (section < ContactsController.getInstance().sortedUsersSectionsArray.size()) {
ArrayList<TLRPC.TL_contact> arr = ContactsController.getInstance().usersSectionsDict.get(ContactsController.getInstance().sortedUsersSectionsArray.get(section));
if (position < arr.size()) {
return MessagesController.getInstance().getUser(arr.get(position).user_id);
}
}
return null;
} else {
if (section == 0) {

View File

@ -236,6 +236,11 @@ public class ChangeUsernameActivity extends BaseFragment {
}
lastNameAvailable = false;
if (name != null) {
if (name.startsWith("_") || name.endsWith("_")) {
checkTextView.setText(LocaleController.getString("UsernameInvalid", R.string.UsernameInvalid));
checkTextView.setTextColor(0xffcf3030);
return false;
}
for (int a = 0; a < name.length(); a++) {
char ch = name.charAt(a);
if (a == 0 && ch >= '0' && ch <= '9') {

View File

@ -473,7 +473,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
if (currentUser != null) {
MessagesController.getInstance().cancelLoadFullUser(currentUser.id);
}
if (!AndroidUtilities.isTablet()) {
if (!AndroidUtilities.isTablet() && getParentActivity() != null) {
getParentActivity().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);
}
AndroidUtilities.unlockOrientation(getParentActivity());
@ -1270,7 +1270,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
}
private void scrollToLastMessage() {
if ((forward_end_reached || first_unread_id == 0) && startLoadFromMessageId == 0) {
if (forward_end_reached && first_unread_id == 0 && startLoadFromMessageId == 0) {
chatListView.setSelectionFromTop(messages.size() - 1, -100000 - chatListView.getPaddingTop());
} else {
messages.clear();
@ -3087,7 +3087,13 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
presentFragment(chatActivity, true);
if (!AndroidUtilities.isTablet()) {
removeSelfFromStack();
chatActivity.getParentActivity().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
Activity parentActivity = getParentActivity();
if (parentActivity == null) {
parentActivity = chatActivity.getParentActivity();
}
if (parentActivity != null) {
parentActivity.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
}
}
} else {
activity.finishFragment();

View File

@ -1131,7 +1131,16 @@ public class LaunchActivity extends Activity implements ActionBarLayout.ActionBa
}
}
if (fragment instanceof ChatActivity) {
if (!tabletFullSize && layout != rightActionBarLayout) {
if (!tabletFullSize && layout == rightActionBarLayout || tabletFullSize && layout == actionBarLayout) {
if (!layersActionBarLayout.fragmentsStack.isEmpty()) {
for (int a = 0; a < layersActionBarLayout.fragmentsStack.size() - 1; a++) {
layersActionBarLayout.removeFragmentFromStack(layersActionBarLayout.fragmentsStack.get(0));
a--;
}
layersActionBarLayout.closeLastFragment(!forceWithoutAnimation);
}
return true;
} else if (!tabletFullSize && layout != rightActionBarLayout) {
rightActionBarLayout.setVisibility(View.VISIBLE);
backgroundTablet.setVisibility(View.GONE);
rightActionBarLayout.removeAllFragments();

View File

@ -530,6 +530,12 @@ public class MessagesActivity extends BaseFragment implements NotificationCenter
@SuppressWarnings("unchecked")
public void didReceivedNotification(int id, Object... args) {
if (id == NotificationCenter.dialogsNeedReload) {
if (dialogsAdapter != null) {
dialogsAdapter.notifyDataSetChanged();
}
if (dialogsSearchAdapter != null) {
dialogsSearchAdapter.notifyDataSetChanged();
}
if (messagesListView != null) {
if (MessagesController.getInstance().loadingDialogs && MessagesController.getInstance().dialogs.isEmpty()) {
searchEmptyView.setVisibility(View.GONE);
@ -537,33 +543,14 @@ public class MessagesActivity extends BaseFragment implements NotificationCenter
messagesListView.setEmptyView(progressView);
} else {
if (searching && searchWas) {
if (dialogsAdapter != null) {
dialogsAdapter.notifyDataSetChanged();
}
if (dialogsSearchAdapter != null) {
dialogsSearchAdapter.notifyDataSetChanged();
}
messagesListView.setEmptyView(searchEmptyView);
emptyView.setVisibility(View.GONE);
} else {
if (dialogsAdapter != null) {
dialogsAdapter.notifyDataSetChanged();
}
if (dialogsSearchAdapter != null) {
dialogsSearchAdapter.notifyDataSetChanged();
}
messagesListView.setEmptyView(emptyView);
searchEmptyView.setVisibility(View.GONE);
}
progressView.setVisibility(View.GONE);
}
} else {
if (dialogsAdapter != null) {
dialogsAdapter.notifyDataSetChanged();
}
if (dialogsSearchAdapter != null) {
dialogsSearchAdapter.notifyDataSetChanged();
}
}
} else if (id == NotificationCenter.emojiDidLoaded) {
if (messagesListView != null) {

View File

@ -183,7 +183,7 @@ public class PrivacySettingsActivity extends BaseFragment implements Notificatio
if (which == 0) {
value = 30;
} else if (which == 1) {
value = 60;
value = 90;
} else if (which == 2) {
value = 182;
} else if (which == 3) {

View File

@ -937,8 +937,8 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
public int compare(Integer lhs, Integer rhs) {
TLRPC.User user1 = MessagesController.getInstance().getUser(info.participants.get(rhs).user_id);
TLRPC.User user2 = MessagesController.getInstance().getUser(info.participants.get(lhs).user_id);
Integer status1 = 0;
Integer status2 = 0;
int status1 = 0;
int status2 = 0;
if (user1 != null && user1.status != null) {
if (user1.id == UserConfig.getClientUserId()) {
status1 = ConnectionsManager.getInstance().getCurrentTime() + 50000;
@ -953,7 +953,26 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
status2 = user2.status.expires;
}
}
return status1.compareTo(status2);
if (status1 > 0 && status2 > 0) {
if (status1 > status2) {
return 1;
} else if (status1 < status2) {
return -1;
}
return 0;
} else if (status1 < 0 && status2 < 0) {
if (status1 > status2) {
return 1;
} else if (status1 < status2) {
return -1;
}
return 0;
} else if (status1 < 0 && status2 > 0 || status1 == 0 && status2 != 0) {
return -1;
} else if (status2 < 0 && status1 > 0 || status2 == 0 && status1 != 0) {
return 1;
}
return 0;
}
});

View File

@ -184,8 +184,10 @@ public class VideoEditorActivity extends BaseFragment implements TextureView.Sur
@Override
public void onPrepared(MediaPlayer mp) {
playerPrepared = true;
if (videoTimelineView != null && videoPlayer != null) {
videoPlayer.seekTo((int) (videoTimelineView.getLeftProgress() * videoDuration));
}
}
});
try {
videoPlayer.setDataSource(videoPath);

View File

@ -391,9 +391,11 @@ public class ChatActivityEnterView implements NotificationCenter.NotificationCen
});
runningAnimation2.start();
if (messsageEditText != null) {
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) messsageEditText.getLayoutParams();
layoutParams.rightMargin = AndroidUtilities.dp(0);
messsageEditText.setLayoutParams(layoutParams);
}
delegate.onAttachButtonHidden();
}
@ -470,9 +472,11 @@ public class ChatActivityEnterView implements NotificationCenter.NotificationCen
runningAnimation2.setDuration(100);
runningAnimation2.start();
if (messsageEditText != null) {
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) messsageEditText.getLayoutParams();
layoutParams.rightMargin = AndroidUtilities.dp(50);
messsageEditText.setLayoutParams(layoutParams);
}
delegate.onAttachButtonShow();
}

View File

@ -132,6 +132,8 @@ public class SectionsListView extends ListView implements AbsListView.OnScrollLi
View child = getChildAt(itemNum - firstVisibleItem);
if (child != null) {
header.setTag(child.getTop());
} else {
header.setTag(-AndroidUtilities.dp(100));
}
itemNum += count;
}

View File

@ -106,6 +106,7 @@
<string name="SaveToDownloads">Save to downloads</string>
<string name="ApplyLocalizationFile">Apply localization file</string>
<string name="UnsupportedAttachment">Unsupported attachment</string>
<string name="SetTimer">Set timer</string>
<!--notification-->
<string name="MessageLifetimeChanged">%1$s set the self-destruct timer to %2$s</string>
<string name="MessageLifetimeChangedOutgoing">You set the self-destruct timer to %1$s</string>
@ -146,7 +147,7 @@
<string name="SelectContact">Select Contact</string>
<string name="NoContacts">No contacts yet</string>
<string name="InviteText">Hey, let\'s switch to Telegram: http://telegram.org/dl2</string>
<string name="TodayAt">today at</string>
<string name="TodayAt">at</string>
<string name="YesterdayAt">yesterday at</string>
<string name="Online">online</string>
<string name="LastSeen">last seen</string>
@ -271,6 +272,11 @@
<string name="NoMediaAutoDownload">No media</string>
<string name="SaveToGallerySettings">Save to gallery</string>
<string name="EditName">Edit name</string>
<string name="NotificationsPriority">Priority</string>
<string name="NotificationsPriorityDefault">Default</string>
<string name="NotificationsPriorityLow">Low</string>
<string name="NotificationsPriorityHigh">High</string>
<string name="NotificationsPriorityMax">Max</string>
<!--media view-->
<string name="NoMedia">No shared media yet</string>
<!--map view-->