From a38e46cd8bde13b708ce073544b8092906a53e63 Mon Sep 17 00:00:00 2001 From: DrKLO Date: Thu, 20 Nov 2014 17:45:33 +0300 Subject: [PATCH] Bug fixes --- TMessagesProj/build.gradle | 4 +- .../telegram/android/ContactsController.java | 3 + .../telegram/android/MessagesController.java | 134 +++++++++--------- .../android/NotificationsController.java | 4 + .../messenger/ConnectionsManager.java | 11 ++ .../ui/ActionBar/ActionBarLayout.java | 7 +- .../telegram/ui/ActionBar/ActionBarMenu.java | 3 +- .../telegram/ui/ActionBar/BaseFragment.java | 22 +-- .../telegram/ui/Adapters/ContactsAdapter.java | 4 +- .../telegram/ui/ChangeUsernameActivity.java | 5 + .../java/org/telegram/ui/ChatActivity.java | 12 +- .../java/org/telegram/ui/LaunchActivity.java | 11 +- .../org/telegram/ui/MessagesActivity.java | 25 +--- .../telegram/ui/PrivacySettingsActivity.java | 2 +- .../java/org/telegram/ui/ProfileActivity.java | 25 +++- .../org/telegram/ui/VideoEditorActivity.java | 4 +- .../ui/Views/ChatActivityEnterView.java | 16 ++- .../telegram/ui/Views/SectionsListView.java | 2 + TMessagesProj/src/main/res/values/strings.xml | 8 +- 19 files changed, 183 insertions(+), 119 deletions(-) diff --git a/TMessagesProj/build.gradle b/TMessagesProj/build.gradle index 6cd896cc3..3a416eb7d 100644 --- a/TMessagesProj/build.gradle +++ b/TMessagesProj/build.gradle @@ -80,7 +80,7 @@ android { defaultConfig { minSdkVersion 8 targetSdkVersion 21 - versionCode 391 - versionName "2.0.2" + versionCode 392 + versionName "2.0.3" } } diff --git a/TMessagesProj/src/main/java/org/telegram/android/ContactsController.java b/TMessagesProj/src/main/java/org/telegram/android/ContactsController.java index d10ae4e71..8fe61f985 100644 --- a/TMessagesProj/src/main/java/org/telegram/android/ContactsController.java +++ b/TMessagesProj/src/main/java/org/telegram/android/ContactsController.java @@ -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) { diff --git a/TMessagesProj/src/main/java/org/telegram/android/MessagesController.java b/TMessagesProj/src/main/java/org/telegram/android/MessagesController.java index 69f5f2fff..f42c63cae 100644 --- a/TMessagesProj/src/main/java/org/telegram/android/MessagesController.java +++ b/TMessagesProj/src/main/java/org/telegram/android/MessagesController.java @@ -1062,77 +1062,76 @@ 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) { - if (!onlyHistory) { - dialogs.remove(dialog); - dialogsServerOnly.remove(dialog); - dialogs_dict.remove(did); - totalDialogsCount--; - } else { - dialog.unread_count = 0; - } - dialogMessage.remove(dialog.top_message); - MessagesStorage.getInstance().getStorageQueue().postRunnable(new Runnable() { - @Override - public void run() { - AndroidUtilities.runOnUIThread(new Runnable() { - @Override - public void run() { - NotificationsController.getInstance().processReadMessages(null, did, 0, Integer.MAX_VALUE, false); - HashMap dialogsToUpdate = new HashMap(); - dialogsToUpdate.put(did, 0); - NotificationsController.getInstance().processDialogsUpdateRead(dialogsToUpdate); - } - }); - } - }); - NotificationCenter.getInstance().postNotificationName(NotificationCenter.removeAllMessagesFromDialog, did); - NotificationCenter.getInstance().postNotificationName(NotificationCenter.dialogsNeedReload); - } + int lower_part = (int)did; + int high_id = (int)(did >> 32); - if (high_id == 1) { - return; - } - - if (lower_part != 0) { - TLRPC.TL_messages_deleteHistory req = new TLRPC.TL_messages_deleteHistory(); - req.offset = offset; - if (did < 0) { - req.peer = new TLRPC.TL_inputPeerChat(); - req.peer.chat_id = -lower_part; - } else { - TLRPC.User user = getUser(lower_part); - if (user instanceof TLRPC.TL_userForeign || user instanceof TLRPC.TL_userRequest) { - req.peer = new TLRPC.TL_inputPeerForeign(); - req.peer.access_hash = user.access_hash; - } else { - req.peer = new TLRPC.TL_inputPeerContact(); - } - req.peer.user_id = lower_part; - } - ConnectionsManager.getInstance().performRpc(req, new RPCRequest.RPCRequestDelegate() { - @Override - public void run(TLObject response, TLRPC.TL_error error) { - if (error == null) { - TLRPC.TL_messages_affectedHistory res = (TLRPC.TL_messages_affectedHistory) response; - if (res.offset > 0) { - deleteDialog(did, res.offset, onlyHistory); - } - processNewDifferenceParams(res.seq, res.pts, -1); - } - } - }); + if (offset == 0) { + TLRPC.TL_dialog dialog = dialogs_dict.get(did); + if (!onlyHistory) { + dialogs.remove(dialog); + dialogsServerOnly.remove(dialog); + dialogs_dict.remove(did); + totalDialogsCount--; } else { - if (onlyHistory) { - SendMessagesHelper.getInstance().sendClearHistoryMessage(getEncryptedChat(high_id), null); - } else { - declineSecretChat(high_id); + dialog.unread_count = 0; + } + dialogMessage.remove(dialog.top_message); + MessagesStorage.getInstance().getStorageQueue().postRunnable(new Runnable() { + @Override + public void run() { + AndroidUtilities.runOnUIThread(new Runnable() { + @Override + public void run() { + NotificationsController.getInstance().processReadMessages(null, did, 0, Integer.MAX_VALUE, false); + HashMap dialogsToUpdate = new HashMap(); + dialogsToUpdate.put(did, 0); + NotificationsController.getInstance().processDialogsUpdateRead(dialogsToUpdate); + } + }); } + }); + NotificationCenter.getInstance().postNotificationName(NotificationCenter.removeAllMessagesFromDialog, did); + NotificationCenter.getInstance().postNotificationName(NotificationCenter.dialogsNeedReload); + } + + if (high_id == 1) { + return; + } + + if (lower_part != 0) { + TLRPC.TL_messages_deleteHistory req = new TLRPC.TL_messages_deleteHistory(); + req.offset = offset; + if (did < 0) { + req.peer = new TLRPC.TL_inputPeerChat(); + req.peer.chat_id = -lower_part; + } else { + TLRPC.User user = getUser(lower_part); + if (user instanceof TLRPC.TL_userForeign || user instanceof TLRPC.TL_userRequest) { + req.peer = new TLRPC.TL_inputPeerForeign(); + req.peer.access_hash = user.access_hash; + } else { + req.peer = new TLRPC.TL_inputPeerContact(); + } + req.peer.user_id = lower_part; + } + ConnectionsManager.getInstance().performRpc(req, new RPCRequest.RPCRequestDelegate() { + @Override + public void run(TLObject response, TLRPC.TL_error error) { + if (error == null) { + TLRPC.TL_messages_affectedHistory res = (TLRPC.TL_messages_affectedHistory) response; + if (res.offset > 0) { + deleteDialog(did, res.offset, onlyHistory); + } + processNewDifferenceParams(res.seq, res.pts, -1); + } + } + }); + } else { + if (onlyHistory) { + SendMessagesHelper.getInstance().sendClearHistoryMessage(getEncryptedChat(high_id), null); + } else { + declineSecretChat(high_id); } } } @@ -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); diff --git a/TMessagesProj/src/main/java/org/telegram/android/NotificationsController.java b/TMessagesProj/src/main/java/org/telegram/android/NotificationsController.java index 3aa873fac..3b5a7a3b4 100644 --- a/TMessagesProj/src/main/java/org/telegram/android/NotificationsController.java +++ b/TMessagesProj/src/main/java/org/telegram/android/NotificationsController.java @@ -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) { diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/ConnectionsManager.java b/TMessagesProj/src/main/java/org/telegram/messenger/ConnectionsManager.java index 06570717a..dc7201798 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/ConnectionsManager.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/ConnectionsManager.java @@ -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(); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/ActionBarLayout.java b/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/ActionBarLayout.java index 224a7b1d9..fe968b6fa 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/ActionBarLayout.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/ActionBarLayout.java @@ -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() { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/ActionBarMenu.java b/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/ActionBarMenu.java index 8af54572a..7b9d202a0 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/ActionBarMenu.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/ActionBarMenu.java @@ -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; } } } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/BaseFragment.java b/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/BaseFragment.java index 072ef79cc..8646005b2 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/BaseFragment.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/BaseFragment.java @@ -214,15 +214,19 @@ public class BaseFragment { } catch (Exception e) { FileLog.e("tmessages", e); } - visibleDialog = builder.show(); - visibleDialog.setCanceledOnTouchOutside(true); - visibleDialog.setOnDismissListener(new DialogInterface.OnDismissListener() { - @Override - public void onDismiss(DialogInterface dialog) { - visibleDialog = null; - onDialogDismiss(); - } - }); + try { + visibleDialog = builder.show(); + visibleDialog.setCanceledOnTouchOutside(true); + visibleDialog.setOnDismissListener(new DialogInterface.OnDismissListener() { + @Override + public void onDismiss(DialogInterface dialog) { + visibleDialog = null; + onDialogDismiss(); + } + }); + } catch (Exception e) { + FileLog.e("tmessages", e); + } } protected void onDialogDismiss() { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Adapters/ContactsAdapter.java b/TMessagesProj/src/main/java/org/telegram/ui/Adapters/ContactsAdapter.java index ed57814ce..5cf62fbff 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Adapters/ContactsAdapter.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Adapters/ContactsAdapter.java @@ -52,7 +52,9 @@ public class ContactsAdapter extends BaseSectionsAdapter { if (onlyUsers) { if (section < ContactsController.getInstance().sortedUsersSectionsArray.size()) { ArrayList arr = ContactsController.getInstance().usersSectionsDict.get(ContactsController.getInstance().sortedUsersSectionsArray.get(section)); - return MessagesController.getInstance().getUser(arr.get(position).user_id); + if (position < arr.size()) { + return MessagesController.getInstance().getUser(arr.get(position).user_id); + } } return null; } else { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ChangeUsernameActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ChangeUsernameActivity.java index 29b6d31a5..6ebeae2dd 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ChangeUsernameActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ChangeUsernameActivity.java @@ -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') { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java index e49fb47a3..a6cf38344 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java @@ -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(); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/LaunchActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/LaunchActivity.java index 6364dd49c..3ee44ff87 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/LaunchActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/LaunchActivity.java @@ -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(); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/MessagesActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/MessagesActivity.java index 732a99d82..1ad46ff47 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/MessagesActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/MessagesActivity.java @@ -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) { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/PrivacySettingsActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/PrivacySettingsActivity.java index db3551741..54b5515fa 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/PrivacySettingsActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/PrivacySettingsActivity.java @@ -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) { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ProfileActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ProfileActivity.java index 6e2cadb66..82fb2410c 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ProfileActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ProfileActivity.java @@ -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; } }); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/VideoEditorActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/VideoEditorActivity.java index 24d4837e3..4c9aca489 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/VideoEditorActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/VideoEditorActivity.java @@ -184,7 +184,9 @@ public class VideoEditorActivity extends BaseFragment implements TextureView.Sur @Override public void onPrepared(MediaPlayer mp) { playerPrepared = true; - videoPlayer.seekTo((int) (videoTimelineView.getLeftProgress() * videoDuration)); + if (videoTimelineView != null && videoPlayer != null) { + videoPlayer.seekTo((int) (videoTimelineView.getLeftProgress() * videoDuration)); + } } }); try { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Views/ChatActivityEnterView.java b/TMessagesProj/src/main/java/org/telegram/ui/Views/ChatActivityEnterView.java index 0f919459a..bdb7efdc8 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Views/ChatActivityEnterView.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Views/ChatActivityEnterView.java @@ -391,9 +391,11 @@ public class ChatActivityEnterView implements NotificationCenter.NotificationCen }); runningAnimation2.start(); - FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) messsageEditText.getLayoutParams(); - layoutParams.rightMargin = AndroidUtilities.dp(0); - messsageEditText.setLayoutParams(layoutParams); + 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(); - FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) messsageEditText.getLayoutParams(); - layoutParams.rightMargin = AndroidUtilities.dp(50); - messsageEditText.setLayoutParams(layoutParams); + if (messsageEditText != null) { + FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) messsageEditText.getLayoutParams(); + layoutParams.rightMargin = AndroidUtilities.dp(50); + messsageEditText.setLayoutParams(layoutParams); + } delegate.onAttachButtonShow(); } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Views/SectionsListView.java b/TMessagesProj/src/main/java/org/telegram/ui/Views/SectionsListView.java index ca3b4e248..90898f5b2 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Views/SectionsListView.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Views/SectionsListView.java @@ -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; } diff --git a/TMessagesProj/src/main/res/values/strings.xml b/TMessagesProj/src/main/res/values/strings.xml index c694fc8d5..2af918f19 100644 --- a/TMessagesProj/src/main/res/values/strings.xml +++ b/TMessagesProj/src/main/res/values/strings.xml @@ -106,6 +106,7 @@ Save to downloads Apply localization file Unsupported attachment + Set timer %1$s set the self-destruct timer to %2$s You set the self-destruct timer to %1$s @@ -146,7 +147,7 @@ Select Contact No contacts yet Hey, let\'s switch to Telegram: http://telegram.org/dl2 - today at + at yesterday at online last seen @@ -271,6 +272,11 @@ No media Save to gallery Edit name + Priority + Default + Low + High + Max No shared media yet