From fce78abb1cf985ac02af1c997ff8871f47ce97af Mon Sep 17 00:00:00 2001 From: iNPUTmice Date: Tue, 11 Nov 2014 00:16:43 +0100 Subject: temporarliy got rid of some insane work arounds in favor of some maybe less insane work arounds --- .../conversations/services/XmppConnectionService.java | 16 ++++++++-------- .../eu/siacs/conversations/ui/ConversationActivity.java | 9 ++++----- .../java/eu/siacs/conversations/ui/XmppActivity.java | 6 +++++- 3 files changed, 17 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java index dea0c050..831a54e1 100644 --- a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java +++ b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java @@ -401,10 +401,10 @@ public class XmppConnectionService extends Service { } } } - PowerManager pm = (PowerManager) this.getSystemService(Context.POWER_SERVICE); + /*PowerManager pm = (PowerManager) this.getSystemService(Context.POWER_SERVICE); if (!pm.isScreenOn()) { removeStaleListeners(); - } + }*/ if (wakeLock.isHeld()) { try { wakeLock.release(); @@ -1080,11 +1080,11 @@ public class XmppConnectionService extends Service { public void setOnConversationListChangedListener( OnConversationUpdate listener) { - if (!isScreenOn()) { + /*if (!isScreenOn()) { Log.d(Config.LOGTAG, "ignoring setOnConversationListChangedListener"); return; - } + }*/ synchronized (this.convChangedListenerCount) { if (checkListeners()) { switchToForeground(); @@ -1110,10 +1110,10 @@ public class XmppConnectionService extends Service { } public void setOnAccountListChangedListener(OnAccountUpdate listener) { - if (!isScreenOn()) { + /*if (!isScreenOn()) { Log.d(Config.LOGTAG, "ignoring setOnAccountListChangedListener"); return; - } + }*/ synchronized (this.accountChangedListenerCount) { if (checkListeners()) { switchToForeground(); @@ -1137,10 +1137,10 @@ public class XmppConnectionService extends Service { } public void setOnRosterUpdateListener(OnRosterUpdate listener) { - if (!isScreenOn()) { + /*if (!isScreenOn()) { Log.d(Config.LOGTAG, "ignoring setOnRosterUpdateListener"); return; - } + }*/ synchronized (this.rosterChangedListenerCount) { if (checkListeners()) { switchToForeground(); diff --git a/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java b/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java index c6ec63df..8cb8a3aa 100644 --- a/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java @@ -896,12 +896,11 @@ public class ConversationActivity extends XmppActivity implements public void run() { updateConversationList(); if (conversationList.size() == 0) { - startActivity(new Intent(getApplicationContext(), - StartConversationActivity.class)); - finish(); - } else { - ConversationActivity.this.mConversationFragment.updateMessages(); + startActivity(new Intent(getApplicationContext(), + StartConversationActivity.class)); + finish(); } + ConversationActivity.this.mConversationFragment.updateMessages(); } }); } diff --git a/src/main/java/eu/siacs/conversations/ui/XmppActivity.java b/src/main/java/eu/siacs/conversations/ui/XmppActivity.java index 78d7956a..2dafbd26 100644 --- a/src/main/java/eu/siacs/conversations/ui/XmppActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/XmppActivity.java @@ -105,7 +105,11 @@ public abstract class XmppActivity extends Activity { XmppConnectionBinder binder = (XmppConnectionBinder) service; xmppConnectionService = binder.getService(); xmppConnectionServiceBound = true; - onBackendConnected(); + if (!isFinishing() && !isDestroyed()) { + onBackendConnected(); + } else { + Log.d(Config.LOGTAG,"omitting call to onBackendConnected()"); + } } @Override -- cgit v1.2.3