Previous commit fixes

This commit is contained in:
DrKLO 2014-06-04 03:57:30 +04:00
parent 3fecce9645
commit e657c4f010
4 changed files with 15 additions and 3 deletions

View file

@ -147,7 +147,8 @@ public class ConnectionsManager implements Action.ActionDelegate, TcpConnection.
if (datacenters != null) { if (datacenters != null) {
MessagesController.getInstance().updateTimerProc(); MessagesController.getInstance().updateTimerProc();
if (datacenterWithId(currentDatacenterId).authKey != null) { Datacenter datacenter = datacenterWithId(currentDatacenterId);
if (datacenter != null && datacenter.authKey != null) {
if (lastPingTime < System.currentTimeMillis() - 19000) { if (lastPingTime < System.currentTimeMillis() - 19000) {
lastPingTime = System.currentTimeMillis(); lastPingTime = System.currentTimeMillis();
generatePing(); generatePing();

View file

@ -1036,6 +1036,9 @@ public class ChatActivity extends BaseFragment implements SizeNotifierRelativeLa
private String getTrimmedString(String src) { private String getTrimmedString(String src) {
String result = src.trim(); String result = src.trim();
if (result.length() == 0) {
return result;
}
while (src.startsWith("\n")) { while (src.startsWith("\n")) {
src = src.substring(1); src = src.substring(1);
} }

View file

@ -107,9 +107,10 @@ public class ActionBar extends FrameLayout {
private void updateBackOverlay(int widthMeasureSpec, int heightMeasureSpec) { private void updateBackOverlay(int widthMeasureSpec, int heightMeasureSpec) {
if (currentLayer != null) { if (currentLayer != null) {
currentLayer.setBackLayoutVisible(currentBackOverlay == null ? VISIBLE : INVISIBLE); currentLayer.setBackLayoutVisible(currentLayer.isSearchFieldVisible || currentBackOverlay == null ? VISIBLE : INVISIBLE);
} }
if (currentBackOverlay != null) { if (currentBackOverlay != null) {
currentBackOverlay.setVisibility(currentLayer.isSearchFieldVisible ? GONE : VISIBLE);
ViewGroup.LayoutParams layoutParams = currentBackOverlay.getLayoutParams(); ViewGroup.LayoutParams layoutParams = currentBackOverlay.getLayoutParams();
if (currentLayer != null) { if (currentLayer != null) {
currentLayer.measure(widthMeasureSpec, heightMeasureSpec); currentLayer.measure(widthMeasureSpec, heightMeasureSpec);

View file

@ -40,6 +40,7 @@ public class ActionBarLayer extends FrameLayout {
private ActionBar parentActionBar; private ActionBar parentActionBar;
private boolean oldUseLogo; private boolean oldUseLogo;
private boolean oldUseBack; private boolean oldUseBack;
private boolean isBackLayoutHidden = false;
protected boolean isSearchFieldVisible; protected boolean isSearchFieldVisible;
public ActionBarMenuOnItemClick actionBarMenuOnItemClick; public ActionBarMenuOnItemClick actionBarMenuOnItemClick;
@ -329,7 +330,8 @@ public class ActionBarLayer extends FrameLayout {
} }
public void setBackLayoutVisible(int visibility) { public void setBackLayoutVisible(int visibility) {
backButtonFrameLayout.setVisibility(visibility); isBackLayoutHidden = visibility != VISIBLE;
backButtonFrameLayout.setVisibility(isSearchFieldVisible ? VISIBLE : visibility);
} }
public int getBackLayoutWidth() { public int getBackLayoutWidth() {
@ -406,6 +408,11 @@ public class ActionBarLayer extends FrameLayout {
} else { } else {
setDisplayHomeAsUpEnabled(oldUseBack); 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); logoImageView.setImageResource(visible ? R.drawable.ic_ab_search : R.drawable.ic_ab_logo);
} }