diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/ConnectionsManager.java b/TMessagesProj/src/main/java/org/telegram/messenger/ConnectionsManager.java index ac5b2321d..016f29780 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/ConnectionsManager.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/ConnectionsManager.java @@ -147,7 +147,8 @@ public class ConnectionsManager implements Action.ActionDelegate, TcpConnection. if (datacenters != null) { MessagesController.getInstance().updateTimerProc(); - if (datacenterWithId(currentDatacenterId).authKey != null) { + Datacenter datacenter = datacenterWithId(currentDatacenterId); + if (datacenter != null && datacenter.authKey != null) { if (lastPingTime < System.currentTimeMillis() - 19000) { lastPingTime = System.currentTimeMillis(); generatePing(); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java index d1c81f25a..828b84774 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java @@ -1036,6 +1036,9 @@ public class ChatActivity extends BaseFragment implements SizeNotifierRelativeLa private String getTrimmedString(String src) { String result = src.trim(); + if (result.length() == 0) { + return result; + } while (src.startsWith("\n")) { src = src.substring(1); } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Views/ActionBar/ActionBar.java b/TMessagesProj/src/main/java/org/telegram/ui/Views/ActionBar/ActionBar.java index 3cdcdb644..795708ecd 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Views/ActionBar/ActionBar.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Views/ActionBar/ActionBar.java @@ -107,9 +107,10 @@ public class ActionBar extends FrameLayout { private void updateBackOverlay(int widthMeasureSpec, int heightMeasureSpec) { if (currentLayer != null) { - currentLayer.setBackLayoutVisible(currentBackOverlay == null ? VISIBLE : INVISIBLE); + currentLayer.setBackLayoutVisible(currentLayer.isSearchFieldVisible || currentBackOverlay == null ? VISIBLE : INVISIBLE); } if (currentBackOverlay != null) { + currentBackOverlay.setVisibility(currentLayer.isSearchFieldVisible ? GONE : VISIBLE); ViewGroup.LayoutParams layoutParams = currentBackOverlay.getLayoutParams(); if (currentLayer != null) { currentLayer.measure(widthMeasureSpec, heightMeasureSpec); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Views/ActionBar/ActionBarLayer.java b/TMessagesProj/src/main/java/org/telegram/ui/Views/ActionBar/ActionBarLayer.java index a2dcb81da..f9008ba9d 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Views/ActionBar/ActionBarLayer.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Views/ActionBar/ActionBarLayer.java @@ -40,6 +40,7 @@ public class ActionBarLayer extends FrameLayout { private ActionBar parentActionBar; private boolean oldUseLogo; private boolean oldUseBack; + private boolean isBackLayoutHidden = false; protected boolean isSearchFieldVisible; public ActionBarMenuOnItemClick actionBarMenuOnItemClick; @@ -329,7 +330,8 @@ public class ActionBarLayer extends FrameLayout { } public void setBackLayoutVisible(int visibility) { - backButtonFrameLayout.setVisibility(visibility); + isBackLayoutHidden = visibility != VISIBLE; + backButtonFrameLayout.setVisibility(isSearchFieldVisible ? VISIBLE : visibility); } public int getBackLayoutWidth() { @@ -406,6 +408,11 @@ public class ActionBarLayer extends FrameLayout { } else { setDisplayHomeAsUpEnabled(oldUseBack); } + if (visible) { + backButtonFrameLayout.setVisibility(VISIBLE); + } else { + backButtonFrameLayout.setVisibility(isBackLayoutHidden ? INVISIBLE : VISIBLE); + } logoImageView.setImageResource(visible ? R.drawable.ic_ab_search : R.drawable.ic_ab_logo); }